ppfsm.h revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder/***********************************************************************
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly* *
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly* This software is part of the ast package *
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly* Copyright (c) 1986-2011 AT&T Intellectual Property *
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly* and is licensed under the *
98890889ffb2e8f6f722b00e265a211f13b5a861Corneliu-Claudiu Prodescu* Eclipse Public License, Version 1.0 *
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly* by AT&T Intellectual Property *
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly* *
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly* A copy of the License is available at *
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly* http://www.eclipse.org/org/documents/epl-v10.html *
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly* *
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly* Information and Software Systems Research *
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly* AT&T Research *
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly* Florham Park NJ *
9aeda2b3ae8ce0b018955521e4ca835a8ba8a27bLiam O'Reilly* *
57221209d11b05aa0373cc3892d5df89ba96ebf9Christian Maeder* Glenn Fowler <gsf@research.att.com> *
66bc8d6e69cde43f1ccbeb76104cf7b8038acd6cChristian Maeder* *
66bc8d6e69cde43f1ccbeb76104cf7b8038acd6cChristian Maeder***********************************************************************/
e90dc723887d541f809007ae81c9bb73ced9592eChristian Maeder#pragma prototyped
d5833d2ee7bafcbf2fdd2bdfd9a728c769b100c7Christian Maeder/*
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly * Glenn Fowler
56899f6457976a2ee20f6a23f088cb5655b15715Liam O'Reilly * AT&T Research
66bc8d6e69cde43f1ccbeb76104cf7b8038acd6cChristian Maeder *
a00461fcf7432205a79a0f12dbe6c1ebc58bc000Christian Maeder * preprocessor lexical analyzer definitions
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly */
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly#ifndef _PPFSM_H
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define _PPFSM_H
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder#define BITSTATE 16 /* bitsof(state) */
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define BITNONTERM 7 /* bitsof(non-terminal-state) */
d5833d2ee7bafcbf2fdd2bdfd9a728c769b100c7Christian Maeder#define BITTERM 7 /* bitsof(terminal-state) */
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define NMAC 19 /* number of MAC states */
c0833539c8cf577dd3f2497792fbdd818442744cChristian Maeder
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define SPLICE (1<<BITTERM)
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder#define CODE(tok,act) ((((tok)-N_PP)<<(BITTERM+1))|(act))
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define TERM(st) ((st)&((1<<(BITTERM+1))-1))
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define NEXT(st) (((st)>>(BITTERM+1))&((1<<BITNONTERM)-1))
036ecbd8f721096321f47cf6a354a9d1bf3d032fChristian Maeder#define QUAL(st) (((st)<<(BITTERM+1))|(S_QUAL))
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define TYPE(st) (NEXT(st)+N_PP)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly#define BACK(tok) CODE(tok,S_TOKB)
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly#define KEEP(tok) CODE(tok,S_TOK)
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly
53bd0c89aa4743dc41a6394db5a90717c1ca4517Liam O'Reilly#undef MAX
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define MAX 255
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#undef EOB
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define EOB 0
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#undef EOF
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define EOF (MAX+1)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder/*
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder * FSM states
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder *
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder * NOTE: preserve the ranges
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder */
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define INDEX(p) (((p)-fsm[0])/(MAX+1))
4314e26a12954cb1c9be4dea10aa8103edac5bbbChristian Maeder
d5833d2ee7bafcbf2fdd2bdfd9a728c769b100c7Christian Maeder#define IDSTATE(x) (((x)>=0&&INQMACRO(fsm[x]))?QID:(x))
d5833d2ee7bafcbf2fdd2bdfd9a728c769b100c7Christian Maeder
9aeda2b3ae8ce0b018955521e4ca835a8ba8a27bLiam O'Reilly#define INCOMMENT(p) ((p)>=fsm[COM2]&&(p)<=fsm[COM7])
9aeda2b3ae8ce0b018955521e4ca835a8ba8a27bLiam O'Reilly#define INCOMMENTXX(p) ((p)>=fsm[COM5]&&(p)<=fsm[COM7])
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define INQMACRO(p) ((p)>=fsm[MAC0]&&(p)<=fsm[LIT0])
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define INTMACRO(p) ((p)>=fsm[NID]&&(p)<=fsm[LIT])
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define INQUOTE(p) ((p)>=fsm[LIT1]&&(p)<=fsm[LIT2])
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define INOPSPACE(p) ((p)==fsm[BIN1])
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define INSPACE(p) ((p)==fsm[WS1])
d5833d2ee7bafcbf2fdd2bdfd9a728c769b100c7Christian Maeder
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder/*
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly * proto non-terminal states
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly */
fa373bc327620e08861294716b4454be8d25669fChristian Maeder
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define PROTO 0
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define RES1 (PROTO+1)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define RES1a (PROTO+2)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define RES1e (PROTO+3)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define RES1f (PROTO+4)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define RES1h (PROTO+5)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define RES1l (PROTO+6)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define RES1n (PROTO+7)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define RES1o (PROTO+8)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define RES1t (PROTO+9)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define RES1x (PROTO+10)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define RES1y (PROTO+11)
d5833d2ee7bafcbf2fdd2bdfd9a728c769b100c7Christian Maeder#define COM1 (PROTO+12)
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder#define COM2 (PROTO+13)
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder#define COM3 (PROTO+14)
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder#define COM4 (PROTO+15)
9aeda2b3ae8ce0b018955521e4ca835a8ba8a27bLiam O'Reilly#define COM5 (PROTO+16)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define COM6 (PROTO+17)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define COM7 (PROTO+18)
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder#define NID (PROTO+19)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define LIT (PROTO+20)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define LIT1 (PROTO+21)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define LIT2 (PROTO+22)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define BAD1 (PROTO+23)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define BAD2 (PROTO+24)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define DOT (PROTO+25)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define DOT2 (PROTO+26)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define WS1 (PROTO+27)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#if PROTOMAIN
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define TERMINAL (PROTO+28) /* PROTOMAIN */
eb48217dfa67ddb87b8fbd846de293d0636bd578Christian Maeder
eb48217dfa67ddb87b8fbd846de293d0636bd578Christian Maeder#else
eb48217dfa67ddb87b8fbd846de293d0636bd578Christian Maeder
eb48217dfa67ddb87b8fbd846de293d0636bd578Christian Maeder/*
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder * quick non-terminal states
eb48217dfa67ddb87b8fbd846de293d0636bd578Christian Maeder */
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder
eb48217dfa67ddb87b8fbd846de293d0636bd578Christian Maeder#define QUICK (PROTO+28)
eb48217dfa67ddb87b8fbd846de293d0636bd578Christian Maeder#define QTOK (QUICK+1)
eb48217dfa67ddb87b8fbd846de293d0636bd578Christian Maeder#define QNUM (QUICK+2)
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder#define QEXP (QUICK+3)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define QCOM (QUICK+4)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define QID (QUICK+5)
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder#define MAC0 (QUICK+6)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define MACN (MAC0+NMAC-1)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define HIT0 (MACN+1)
4314e26a12954cb1c9be4dea10aa8103edac5bbbChristian Maeder#define HITN (HIT0+NMAC-1)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define LIT0 (HITN+1)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define SHARP1 (HITN+2)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder/*
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder * tokenize non-terminal states
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder */
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
4314e26a12954cb1c9be4dea10aa8103edac5bbbChristian Maeder#define TOKEN (HITN+3)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define OCT1 (TOKEN+1)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define OCT2 (TOKEN+2)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define OCT3 (TOKEN+3)
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define NOT1 (TOKEN+4)
d5833d2ee7bafcbf2fdd2bdfd9a728c769b100c7Christian Maeder#define PCT1 (TOKEN+5)
d5833d2ee7bafcbf2fdd2bdfd9a728c769b100c7Christian Maeder#define AND1 (TOKEN+6)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define STAR1 (TOKEN+7)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define PLUS1 (TOKEN+8)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define MINUS1 (TOKEN+9)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define ARROW1 (TOKEN+10)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define COLON1 (TOKEN+11)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define LT1 (TOKEN+12)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define LSH1 (TOKEN+13)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define EQ1 (TOKEN+14)
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder#define RSH1 (TOKEN+15)
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder#define GT1 (TOKEN+16)
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder#define CIRC1 (TOKEN+17)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define OR1 (TOKEN+18)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define DEC1 (TOKEN+19)
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder#define DEC2 (TOKEN+20)
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder#define HEX1 (TOKEN+21)
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder#define HEX2 (TOKEN+22)
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder#define HEX3 (TOKEN+23)
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder#define HEX4 (TOKEN+24)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define HEX5 (TOKEN+25)
7857a35e3af533dfbd0f0e18638ebd211e6358a0Christian Maeder#define HEX6 (TOKEN+26)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define HEX7 (TOKEN+27)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define HEX8 (TOKEN+28)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define DBL1 (TOKEN+29)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define DBL2 (TOKEN+30)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define DBL3 (TOKEN+31)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define DBL4 (TOKEN+32)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define DBL5 (TOKEN+33)
9aeda2b3ae8ce0b018955521e4ca835a8ba8a27bLiam O'Reilly#define DOT1 (TOKEN+34)
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define HDR1 (TOKEN+35)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder#define BIN1 (TOKEN+36)
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define TERMINAL (TOKEN+37)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#endif
fa373bc327620e08861294716b4454be8d25669fChristian Maeder
fa373bc327620e08861294716b4454be8d25669fChristian Maeder/*
fa373bc327620e08861294716b4454be8d25669fChristian Maeder * quick terminal states grouped together
fa373bc327620e08861294716b4454be8d25669fChristian Maeder */
fa373bc327620e08861294716b4454be8d25669fChristian Maeder
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define S_CHRB (TERMINAL+0)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define S_COMMENT (TERMINAL+1)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define S_EOB (TERMINAL+2)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define S_LITBEG (TERMINAL+3)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define S_LITEND (TERMINAL+4)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define S_LITESC (TERMINAL+5)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define S_MACRO (TERMINAL+6)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define S_NL (TERMINAL+7)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define S_QUAL (TERMINAL+8)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define S_SHARP (TERMINAL+9)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define S_VS (TERMINAL+10)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder
fa373bc327620e08861294716b4454be8d25669fChristian Maeder/*
fa373bc327620e08861294716b4454be8d25669fChristian Maeder * and the remaining terminal states
fa373bc327620e08861294716b4454be8d25669fChristian Maeder */
fa373bc327620e08861294716b4454be8d25669fChristian Maeder
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define S_CHR (TERMINAL+11)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define S_HUH (TERMINAL+12)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define S_TOK (TERMINAL+13)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define S_TOKB (TERMINAL+14)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define S_WS (TERMINAL+15)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define S_RESERVED (S_HUH)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder
fa373bc327620e08861294716b4454be8d25669fChristian Maeder/*
fa373bc327620e08861294716b4454be8d25669fChristian Maeder * the last terminal state (for tracing)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder */
fa373bc327620e08861294716b4454be8d25669fChristian Maeder
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define LAST (S_WS)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder
fa373bc327620e08861294716b4454be8d25669fChristian Maeder/*
fa373bc327620e08861294716b4454be8d25669fChristian Maeder * pseudo terminal states
fa373bc327620e08861294716b4454be8d25669fChristian Maeder */
fa373bc327620e08861294716b4454be8d25669fChristian Maeder
fa373bc327620e08861294716b4454be8d25669fChristian Maeder#define S_EOF (0)
fa373bc327620e08861294716b4454be8d25669fChristian Maeder
fa373bc327620e08861294716b4454be8d25669fChristian Maeder/*
fa373bc327620e08861294716b4454be8d25669fChristian Maeder * common lex macros
fa373bc327620e08861294716b4454be8d25669fChristian Maeder *
56899f6457976a2ee20f6a23f088cb5655b15715Liam O'Reilly * NOTE: common local variable names assumed
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder */
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder#define GET(p,c,tp,xp) \
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder do \
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder { \
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder if ((c = GETCHR()) == EOB && pp.in->type == IN_FILE) \
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder FGET(p, c, tp, xp); \
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder } while (0)
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder#define FGET(p,c,tp,xp) \
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder do \
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder { \
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder if (op > xp + PPTOKSIZ) \
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder { \
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder if (!INCOMMENT(rp) && !(pp.state & (NOTEXT|SKIPCONTROL))) \
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder error(2, "long token truncated"); \
eb48217dfa67ddb87b8fbd846de293d0636bd578Christian Maeder op = xp + PPTOKSIZ; \
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder } \
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder if ((pp.in->flags & IN_flush) && pp.level == 1 && !INMACRO(rp) && (!pp.comment || !INCOMMENT(rp)) && (c = op - pp.outbuf) > 0 && *(op - 1) == '\n') \
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder { \
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder PPWRITE(c); \
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder op = tp = pp.outp = pp.outbuf; \
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly } \
66bc8d6e69cde43f1ccbeb76104cf7b8038acd6cChristian Maeder SYNCIN(); \
66bc8d6e69cde43f1ccbeb76104cf7b8038acd6cChristian Maeder refill(p); \
66bc8d6e69cde43f1ccbeb76104cf7b8038acd6cChristian Maeder CACHEIN(); \
66bc8d6e69cde43f1ccbeb76104cf7b8038acd6cChristian Maeder if ((c = GETCHR()) == EOB) BACKIN(); \
66bc8d6e69cde43f1ccbeb76104cf7b8038acd6cChristian Maeder } while (0)
66bc8d6e69cde43f1ccbeb76104cf7b8038acd6cChristian Maeder
66bc8d6e69cde43f1ccbeb76104cf7b8038acd6cChristian Maeder#define POP() \
ace03c3051e5c5144e43ae78cae73f6a29dde6d5Christian Maeder do \
ace03c3051e5c5144e43ae78cae73f6a29dde6d5Christian Maeder { \
ace03c3051e5c5144e43ae78cae73f6a29dde6d5Christian Maeder debug((-7, "POP in=%s next=%s state=%s", ppinstr(cur), pptokchr(*prv->nextchr), pplexstr(INDEX(rp)))); \
ace03c3051e5c5144e43ae78cae73f6a29dde6d5Christian Maeder ip = (pp.in = prv)->nextchr; \
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder } while (0)
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder/*
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder * fsm implementaion globals
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder */
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define fsm _pp_fsmtab
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define refill _pp_refill
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly#define trigraph _pp_trigraph
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
648fe1220044aac847acbdfbc4155af5556063ebChristian Maeder/*
8e9c3881fb6e710b1e08bf5ac8ff9d393df2e74eChristian Maeder * first index is state, second is char, value is next state
8e9c3881fb6e710b1e08bf5ac8ff9d393df2e74eChristian Maeder * except for fsm[TERMINAL] where second is state+1 for EOF transition
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder */
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maeder
7830e8fa7442fb7452af7ecdba102bc297ae367eChristian Maederextern short fsm[TERMINAL+1][MAX+1];
33bdce26495121cdbce30331ef90a1969126a840Liam O'Reilly
a00461fcf7432205a79a0f12dbe6c1ebc58bc000Christian Maeder/*
a00461fcf7432205a79a0f12dbe6c1ebc58bc000Christian Maeder * the index is char, value is trigraph value for <?><?><char>, 0 if invalid
a00461fcf7432205a79a0f12dbe6c1ebc58bc000Christian Maeder */
a00461fcf7432205a79a0f12dbe6c1ebc58bc000Christian Maeder
a00461fcf7432205a79a0f12dbe6c1ebc58bc000Christian Maederextern char trigraph[MAX+1];
a00461fcf7432205a79a0f12dbe6c1ebc58bc000Christian Maeder
a00461fcf7432205a79a0f12dbe6c1ebc58bc000Christian Maederextern void refill(int);
a00461fcf7432205a79a0f12dbe6c1ebc58bc000Christian Maeder
a00461fcf7432205a79a0f12dbe6c1ebc58bc000Christian Maeder#endif
a00461fcf7432205a79a0f12dbe6c1ebc58bc000Christian Maeder