1: /* 2: * Token table structure. 3: */ 4: 5: struct toktab { 6: char *t_word; /* token */ 7: int t_type; /* token type returned by yylex */ 8: int t_flags; /* flags for semicolon insertion */ 9: }; 10: 11: extern struct toktab toktab[]; /* token table */ 12: extern struct toktab *restab[]; /* reserved word index */ 13: 14: #define T_IDENT &toktab[0] 15: #define T_INT &toktab[1] 16: #define T_REAL &toktab[2] 17: #define T_STRING &toktab[3] 18: #define T_CSET &toktab[4] 19: #define T_EOF &toktab[5] 20: 21: /* 22: * t_flags values for token table. 23: */ 24: 25: #define BEGINNER 1 /* token can follow a semicolon */ 26: #define ENDER 2 /* token can precede a semicolon */ 27: 28: /* 29: * Operator table - a finite-state automaton for recognizing Icon operators. 30: */ 31: 32: struct optab { 33: char o_input; 34: char o_action; 35: int o_val; 36: }; 37: 38: extern struct optab state0[]; 39: extern struct optab state1[]; 40: extern struct optab state2[]; 41: extern struct optab state3[]; 42: extern struct optab state4[]; 43: extern struct optab state5[]; 44: extern struct optab state6[]; 45: extern struct optab state7[]; 46: extern struct optab state8[]; 47: extern struct optab state9[]; 48: extern struct optab state10[]; 49: extern struct optab state11[]; 50: extern struct optab state12[]; 51: extern struct optab state13[]; 52: extern struct optab state14[]; 53: extern struct optab state15[]; 54: extern struct optab state16[]; 55: extern struct optab state17[]; 56: extern struct optab state18[]; 57: extern struct optab state19[]; 58: extern struct optab state20[]; 59: extern struct optab state21[]; 60: extern struct optab state22[]; 61: extern struct optab state23[]; 62: extern struct optab state24[]; 63: extern struct optab state25[]; 64: extern struct optab state26[]; 65: extern struct optab state27[]; 66: extern struct optab state28[]; 67: extern struct optab state29[]; 68: extern struct optab state30[]; 69: extern struct optab state31[]; 70: extern struct optab state32[]; 71: extern struct optab state33[]; 72: extern struct optab state34[]; 73: extern struct optab state35[]; 74: extern struct optab state36[]; 75: extern struct optab state37[]; 76: extern struct optab state38[]; 77: extern struct optab state39[]; 78: extern struct optab state40[]; 79: extern struct optab state41[]; 80: extern struct optab state42[]; 81: extern struct optab state43[]; 82: extern struct optab state44[]; 83: extern struct optab state45[]; 84: extern struct optab state46[]; 85: extern struct optab state47[]; 86: extern struct optab state48[]; 87: extern struct optab state49[]; 88: extern struct optab state50[]; 89: extern struct optab state51[]; 90: extern struct optab state52[]; 91: extern struct optab state53[]; 92: extern struct optab state54[]; 93: extern struct optab state55[]; 94: extern struct optab state56[]; 95: extern struct optab state57[]; 96: extern struct optab state58[]; 97: extern struct optab state59[]; 98: extern struct optab state60[]; 99: extern struct optab state61[]; 100: 101: /* 102: * o_action values. 103: */ 104: 105: #define A_GOTO 1 /* shift input and goto new state o_val */ 106: #define A_ERROR 2 /* illegal operator */ 107: #define A_RETURN 3 /* return o_val, save input char */ 108: #define A_IMMRET 4 /* return o_val, discard input char */ 109: 110: /* 111: * Miscellaneous. 112: */ 113: 114: #define isoctal(c) ((c)>='0'&&(c)<='7') /* macro to test for octal digit */ 115: #define NEXTCHAR nextchar() /* macro to get next character */ 116: #define PUSHCHAR(c) peekc=(c) /* macro to push back a character */ 117: 118: #define COMMENT '#' /* comment beginner */ 119: #define ESCAPE '\\' /* string literal escape character */