#include "..\h\config.h" #include "general.h" #include "tproto.h" #include "trans.h" #include "tlex.h" #include "token.h" /* * Token table - contains an entry for each token type * with printable name of token, token type, and flags * for semicolon insertion. */ struct toktab toktab[] = { /* token token type flags */ /* primitives */ "identifier", IDENT, Beginner+Ender, /* 0 */ "integer-literal", INTLIT, Beginner+Ender, /* 1 */ "real-literal", REALLIT, Beginner+Ender, /* 2 */ "string-literal", STRINGLIT, Beginner+Ender, /* 3 */ "cset-literal", CSETLIT, Beginner+Ender, /* 4 */ "end-of-file", EOFX, 0, /* 5 */ /* reserved words */ "break", BREAK, Beginner+Ender, /* 6 */ "by", BY, 0, /* 7 */ "case", CASE, Beginner, /* 8 */ "create", CREATE, Beginner, /* 9 */ "default", DEFAULT, Beginner, /* 10 */ "do", DO, 0, /* 11 */ "else", ELSE, 0, /* 12 */ "end", END, Beginner, /* 13 */ "every", EVERY, Beginner, /* 14 */ "fail", FAIL, Beginner+Ender, /* 15 */ "global", GLOBAL, 0, /* 16 */ "if", IF, Beginner, /* 17 */ "initial", INITIAL, Beginner, /* 18 */ "link", LINK, 0, /* 19 */ "local", LOCAL, Beginner, /* 20 */ "next", NEXT, Beginner+Ender, /* 21 */ "not", NOT, Beginner, /* 22 */ "of", OF, 0, /* 23 */ "procedure", PROCEDURE, 0, /* 24 */ "record", RECORD, 0, /* 25 */ "repeat", REPEAT, Beginner, /* 26 */ "return", RETURN, Beginner+Ender, /* 27 */ "static", STATIC, Beginner, /* 28 */ "suspend", SUSPEND, Beginner+Ender, /* 29 */ "then", THEN, 0, /* 30 */ "to", TO, 0, /* 31 */ "until", UNTIL, Beginner, /* 32 */ "while", WHILE, Beginner, /* 33 */ /* operators */ ":=", ASSIGN, 0, /* 34 */ "@", AT, Beginner, /* 35 */ "@:=", AUGACT, 0, /* 36 */ "&:=", AUGAND, 0, /* 37 */ "=:=", AUGEQ, 0, /* 38 */ "===:=", AUGEQV, 0, /* 39 */ ">=:=", AUGGE, 0, /* 40 */ ">:=", AUGGT, 0, /* 41 */ "<=:=", AUGLE, 0, /* 42 */ "<:=", AUGLT, 0, /* 43 */ "~=:=", AUGNE, 0, /* 44 */ "~===:=", AUGNEQV, 0, /* 45 */ "==:=", AUGSEQ, 0, /* 46 */ ">>=:=", AUGSGE, 0, /* 47 */ ">>:=", AUGSGT, 0, /* 48 */ "<<=:=", AUGSLE, 0, /* 49 */ "<<:=", AUGSLT, 0, /* 50 */ "~==:=", AUGSNE, 0, /* 51 */ "\\", BACKSLASH, Beginner, /* 52 */ "!", BANG, Beginner, /* 53 */ "|", BAR, Beginner, /* 54 */ "^", CARET, Beginner, /* 55 */ "^:=", CARETASGN, 0, /* 56 */ ":", COLON, 0, /* 57 */ ",", COMMA, 0, /* 58 */ "||", CONCAT, Beginner, /* 59 */ "||:=", CONCATASGN, 0, /* 60 */ "&", CONJUNC, Beginner, /* 61 */ ".", DOT, Beginner, /* 62 */ "--", DIFF, Beginner, /* 63 */ "--:=", DIFFASGN, 0, /* 64 */ "===", EQUIV, Beginner, /* 65 */ "**", INTER, Beginner, /* 66 */ "**:=", INTERASGN, 0, /* 67 */ "{", LBRACE, Beginner, /* 68 */ "[", LBRACK, Beginner, /* 69 */ "|||", LCONCAT, Beginner, /* 70 */ "|||:=", LCONCATASGN, 0, /* 71 */ "==", LEXEQ, Beginner, /* 72 */ ">>=", LEXGE, 0, /* 73 */ ">>", LEXGT, 0, /* 74 */ "<<=", LEXLE, 0, /* 75 */ "<<", LEXLT, 0, /* 76 */ "~==", LEXNE, Beginner, /* 77 */ "(", LPAREN, Beginner, /* 78 */ "-:", MCOLON, 0, /* 79 */ "-", MINUS, Beginner, /* 80 */ "-:=", MINUSASGN, 0, /* 81 */ "%", MOD, 0, /* 82 */ "%:=", MODASGN, 0, /* 83 */ "~===", NOTEQUIV, Beginner, /* 84 */ "=", NUMEQ, Beginner, /* 85 */ ">=", NUMGE, 0, /* 86 */ ">", NUMGT, 0, /* 87 */ "<=", NUMLE, 0, /* 88 */ "<", NUMLT, 0, /* 89 */ "~=", NUMNE, Beginner, /* 90 */ "+:", PCOLON, 0, /* 91 */ "+", PLUS, Beginner, /* 92 */ "+:=", PLUSASGN, 0, /* 93 */ "?", QMARK, Beginner, /* 94 */ "<-", REVASSIGN, 0, /* 95 */ "<->", REVSWAP, 0, /* 96 */ "}", RBRACE, Ender, /* 97 */ "]", RBRACK, Ender, /* 98 */ ")", RPAREN, Ender, /* 99 */ ";", SEMICOL, 0, /* 100 */ "?:=", SCANASGN, 0, /* 101 */ "/", SLASH, Beginner, /* 102 */ "/:=", SLASHASGN, 0, /* 103 */ "*", STAR, Beginner, /* 104 */ "*:=", STARASGN, 0, /* 105 */ ":=:", SWAP, 0, /* 106 */ "~", TILDE, Beginner, /* 107 */ "++", UNION, Beginner, /* 108 */ "++:=", UNIONASGN, 0, /* 109 */ "$(", LBRACE, Beginner, /* 110 */ "$)", RBRACE, Ender, /* 111 */ "$<", LBRACK, Beginner, /* 112 */ "$>", RBRACK, Ender, /* 113 */ "end-of-file", 0, 0, }; /* * restab[c] points to the first reserved word in toktab which * begins with the letter c. */ #if !EBCDIC struct toktab *restab[] = { NULL, &toktab[ 6], &toktab[ 8], &toktab[10], /* abcd */ &toktab[12], &toktab[15], &toktab[16], NULL, /* efgh */ &toktab[17], NULL, NULL, &toktab[19], /* ijkl */ NULL, &toktab[21], &toktab[23], &toktab[24], /* mnop */ NULL, &toktab[25], &toktab[28], &toktab[30], /* qrst */ &toktab[32], NULL, &toktab[33], NULL, /* uvwx */ NULL, NULL, /* yz */ }; #else /* !EBCDIC */ struct toktab *restab[] = { NULL ,&toktab[ 6],&toktab[ 8], /* 81-83 abc */ &toktab[10],&toktab[12],&toktab[15],&toktab[16], /* 84-87 defg */ NULL ,&toktab[17],NULL ,NULL , /* 88-8B hi.. */ NULL ,NULL ,NULL ,NULL , /* 8C-8F .... */ NULL ,NULL ,NULL ,&toktab[19], /* 90-93 .jkl */ NULL ,&toktab[21],&toktab[23],&toktab[24], /* 94-97 mnop */ NULL ,&toktab[25],NULL ,NULL , /* 98-9B qr.. */ NULL ,NULL ,NULL ,NULL , /* 9C-9F .... */ NULL ,NULL ,&toktab[28],&toktab[30], /* A0-A3 ..st */ &toktab[32],NULL ,&toktab[33],NULL, /* A4-A7 uvwx */ NULL ,NULL , /* A8-AB yz */ }; #endif /* !EBCDIC */