1: #include "awk.h" 2: struct tok 3: { char *tnm; 4: int yval; 5: } tok[] = { 6: "FIRSTTOKEN", 257, 7: "FINAL", 258, 8: "FATAL", 259, 9: "LT", 260, 10: "LE", 261, 11: "GT", 262, 12: "GE", 263, 13: "EQ", 264, 14: "NE", 265, 15: "MATCH", 266, 16: "NOTMATCH", 267, 17: "APPEND", 268, 18: "ADD", 269, 19: "MINUS", 270, 20: "MULT", 271, 21: "DIVIDE", 272, 22: "MOD", 273, 23: "UMINUS", 274, 24: "ASSIGN", 275, 25: "ADDEQ", 276, 26: "SUBEQ", 277, 27: "MULTEQ", 278, 28: "DIVEQ", 279, 29: "MODEQ", 280, 30: "JUMP", 281, 31: "XBEGIN", 282, 32: "XEND", 283, 33: "NL", 284, 34: "PRINT", 285, 35: "PRINTF", 286, 36: "SPRINTF", 287, 37: "SPLIT", 288, 38: "IF", 289, 39: "ELSE", 290, 40: "WHILE", 291, 41: "FOR", 292, 42: "IN", 293, 43: "NEXT", 294, 44: "EXIT", 295, 45: "BREAK", 296, 46: "CONTINUE", 297, 47: "PROGRAM", 298, 48: "PASTAT", 299, 49: "PASTAT2", 300, 50: "ASGNOP", 301, 51: "BOR", 302, 52: "AND", 303, 53: "NOT", 304, 54: "NUMBER", 305, 55: "VAR", 306, 56: "ARRAY", 307, 57: "FNCN", 308, 58: "SUBSTR", 309, 59: "LSUBSTR", 310, 60: "INDEX", 311, 61: "RELOP", 312, 62: "MATCHOP", 313, 63: "OR", 314, 64: "STRING", 315, 65: "DOT", 316, 66: "CCL", 317, 67: "NCCL", 318, 68: "CHAR", 319, 69: "CAT", 320, 70: "STAR", 321, 71: "PLUS", 322, 72: "QUEST", 323, 73: "POSTINCR", 324, 74: "PREINCR", 325, 75: "POSTDECR", 326, 76: "PREDECR", 327, 77: "INCR", 328, 78: "DECR", 329, 79: "FIELD", 330, 80: "INDIRECT", 331, 81: "LASTTOKEN", 332, 82: }; 83: ptoken(n) 84: { 85: if(n<128) printf("lex: %c\n",n); 86: else if(n<=256) printf("lex:? %o\n",n); 87: else if(n<LASTTOKEN) printf("lex: %s\n",tok[n-257].tnm); 88: else printf("lex:? %o\n",n); 89: return; 90: } 91: 92: char *tokname(n) 93: { 94: if (n<=256 || n >= LASTTOKEN) 95: n = 257; 96: return(tok[n-257].tnm); 97: }