1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 23 /* All Rights Reserved */ 24 25 26 #ident "%Z%%M% %I% %E% SMI" 27 28 #include "awk.h" 29 30 struct tok 31 { char *tnm; 32 int yval; 33 } tok[] = { 34 "FIRSTTOKEN", 257, 35 "FINAL", 258, 36 "FATAL", 259, 37 "LT", 260, 38 "LE", 261, 39 "GT", 262, 40 "GE", 263, 41 "EQ", 264, 42 "NE", 265, 43 "MATCH", 266, 44 "NOTMATCH", 267, 45 "APPEND", 268, 46 "ADD", 269, 47 "MINUS", 270, 48 "MULT", 271, 49 "DIVIDE", 272, 50 "MOD", 273, 51 "UMINUS", 274, 52 "ASSIGN", 275, 53 "ADDEQ", 276, 54 "SUBEQ", 277, 55 "MULTEQ", 278, 56 "DIVEQ", 279, 57 "MODEQ", 280, 58 "JUMP", 281, 59 "XBEGIN", 282, 60 "XEND", 283, 61 "NL", 284, 62 "PRINT", 285, 63 "PRINTF", 286, 64 "SPRINTF", 287, 65 "SPLIT", 288, 66 "IF", 289, 67 "ELSE", 290, 68 "WHILE", 291, 69 "FOR", 292, 70 "IN", 293, 71 "NEXT", 294, 72 "EXIT", 295, 73 "BREAK", 296, 74 "CONTINUE", 297, 75 "PROGRAM", 298, 76 "PASTAT", 299, 77 "PASTAT2", 300, 78 "ASGNOP", 301, 79 "BOR", 302, 80 "AND", 303, 81 "NOT", 304, 82 "NUMBER", 305, 83 "VAR", 306, 84 "ARRAY", 307, 85 "FNCN", 308, 86 "SUBSTR", 309, 87 "LSUBSTR", 310, 88 "INDEX", 311, 89 "GETLINE", 312, 90 "RELOP", 313, 91 "MATCHOP", 314, 92 "OR", 315, 93 "STRING", 316, 94 "DOT", 317, 95 "CCL", 318, 96 "NCCL", 319, 97 "CHAR", 320, 98 "CAT", 321, 99 "STAR", 322, 100 "PLUS", 323, 101 "QUEST", 324, 102 "POSTINCR", 325, 103 "PREINCR", 326, 104 "POSTDECR", 327, 105 "PREDECR", 328, 106 "INCR", 329, 107 "DECR", 330, 108 "FIELD", 331, 109 "INDIRECT", 332, 110 "JUMPTRUE", 333, 111 "JUMPFALSE", 334, 112 "PUSH", 335, 113 "GETREC", 336, 114 "NEWSTAT", 337, 115 "IN_INIT", 338, 116 "IN_EXIT", 339, 117 "LASTTOKEN", 340, 118 }; 119 ptoken(n) 120 { 121 if (n<128) printf("lex: %c\n", n); 122 else if (n<=256) printf("lex:? %o\n", n); 123 else if (n<LASTTOKEN) printf("lex: %s\n", tok[n-257].tnm); 124 else printf("lex:? %o\n", n); 125 return; 126 } 127 128 char *tokname(n) 129 { 130 if (n<=256 || n >= LASTTOKEN) 131 n = 257; 132 return (tok[n-257].tnm); 133 } 134