Sync usage with man page.
[netbsd-mini2440.git] / dist / nawk / proctab.c
blobfe0c3ffb1e7c2616ae1e1f758ec9ec2226557b32
1 #if HAVE_NBTOOL_CONFIG_H
2 #include "nbtool_config.h"
3 #endif
5 #include <stdio.h>
6 #include "awk.h"
7 #include "awkgram.h"
9 static const char * const printname[94] = {
10 "FIRSTTOKEN", /* 257 */
11 "PROGRAM", /* 258 */
12 "PASTAT", /* 259 */
13 "PASTAT2", /* 260 */
14 "XBEGIN", /* 261 */
15 "XEND", /* 262 */
16 "NL", /* 263 */
17 "ARRAY", /* 264 */
18 "MATCH", /* 265 */
19 "NOTMATCH", /* 266 */
20 "MATCHOP", /* 267 */
21 "FINAL", /* 268 */
22 "DOT", /* 269 */
23 "ALL", /* 270 */
24 "CCL", /* 271 */
25 "NCCL", /* 272 */
26 "CHAR", /* 273 */
27 "OR", /* 274 */
28 "STAR", /* 275 */
29 "QUEST", /* 276 */
30 "PLUS", /* 277 */
31 "EMPTYRE", /* 278 */
32 "AND", /* 279 */
33 "BOR", /* 280 */
34 "APPEND", /* 281 */
35 "EQ", /* 282 */
36 "GE", /* 283 */
37 "GT", /* 284 */
38 "LE", /* 285 */
39 "LT", /* 286 */
40 "NE", /* 287 */
41 "IN", /* 288 */
42 "ARG", /* 289 */
43 "BLTIN", /* 290 */
44 "BREAK", /* 291 */
45 "CLOSE", /* 292 */
46 "CONTINUE", /* 293 */
47 "DELETE", /* 294 */
48 "DO", /* 295 */
49 "EXIT", /* 296 */
50 "FOR", /* 297 */
51 "FUNC", /* 298 */
52 "SUB", /* 299 */
53 "GSUB", /* 300 */
54 "IF", /* 301 */
55 "INDEX", /* 302 */
56 "LSUBSTR", /* 303 */
57 "MATCHFCN", /* 304 */
58 "NEXT", /* 305 */
59 "NEXTFILE", /* 306 */
60 "ADD", /* 307 */
61 "MINUS", /* 308 */
62 "MULT", /* 309 */
63 "DIVIDE", /* 310 */
64 "MOD", /* 311 */
65 "ASSIGN", /* 312 */
66 "ASGNOP", /* 313 */
67 "ADDEQ", /* 314 */
68 "SUBEQ", /* 315 */
69 "MULTEQ", /* 316 */
70 "DIVEQ", /* 317 */
71 "MODEQ", /* 318 */
72 "POWEQ", /* 319 */
73 "PRINT", /* 320 */
74 "PRINTF", /* 321 */
75 "SPRINTF", /* 322 */
76 "ELSE", /* 323 */
77 "INTEST", /* 324 */
78 "CONDEXPR", /* 325 */
79 "POSTINCR", /* 326 */
80 "PREINCR", /* 327 */
81 "POSTDECR", /* 328 */
82 "PREDECR", /* 329 */
83 "VAR", /* 330 */
84 "IVAR", /* 331 */
85 "VARNF", /* 332 */
86 "CALL", /* 333 */
87 "NUMBER", /* 334 */
88 "STRING", /* 335 */
89 "REGEXPR", /* 336 */
90 "GETLINE", /* 337 */
91 "GENSUB", /* 338 */
92 "RETURN", /* 339 */
93 "SPLIT", /* 340 */
94 "SUBSTR", /* 341 */
95 "WHILE", /* 342 */
96 "CAT", /* 343 */
97 "NOT", /* 344 */
98 "UMINUS", /* 345 */
99 "POWER", /* 346 */
100 "DECR", /* 347 */
101 "INCR", /* 348 */
102 "INDIRECT", /* 349 */
103 "LASTTOKEN", /* 350 */
107 Cell *(*proctab[94])(Node **, int) = {
108 nullproc, /* FIRSTTOKEN */
109 program, /* PROGRAM */
110 pastat, /* PASTAT */
111 dopa2, /* PASTAT2 */
112 nullproc, /* XBEGIN */
113 nullproc, /* XEND */
114 nullproc, /* NL */
115 array, /* ARRAY */
116 matchop, /* MATCH */
117 matchop, /* NOTMATCH */
118 nullproc, /* MATCHOP */
119 nullproc, /* FINAL */
120 nullproc, /* DOT */
121 nullproc, /* ALL */
122 nullproc, /* CCL */
123 nullproc, /* NCCL */
124 nullproc, /* CHAR */
125 nullproc, /* OR */
126 nullproc, /* STAR */
127 nullproc, /* QUEST */
128 nullproc, /* PLUS */
129 nullproc, /* EMPTYRE */
130 boolop, /* AND */
131 boolop, /* BOR */
132 nullproc, /* APPEND */
133 relop, /* EQ */
134 relop, /* GE */
135 relop, /* GT */
136 relop, /* LE */
137 relop, /* LT */
138 relop, /* NE */
139 instat, /* IN */
140 arg, /* ARG */
141 bltin, /* BLTIN */
142 jump, /* BREAK */
143 closefile, /* CLOSE */
144 jump, /* CONTINUE */
145 awkdelete, /* DELETE */
146 dostat, /* DO */
147 jump, /* EXIT */
148 forstat, /* FOR */
149 nullproc, /* FUNC */
150 sub, /* SUB */
151 gsub, /* GSUB */
152 ifstat, /* IF */
153 sindex, /* INDEX */
154 nullproc, /* LSUBSTR */
155 matchop, /* MATCHFCN */
156 jump, /* NEXT */
157 jump, /* NEXTFILE */
158 arith, /* ADD */
159 arith, /* MINUS */
160 arith, /* MULT */
161 arith, /* DIVIDE */
162 arith, /* MOD */
163 assign, /* ASSIGN */
164 nullproc, /* ASGNOP */
165 assign, /* ADDEQ */
166 assign, /* SUBEQ */
167 assign, /* MULTEQ */
168 assign, /* DIVEQ */
169 assign, /* MODEQ */
170 assign, /* POWEQ */
171 printstat, /* PRINT */
172 awkprintf, /* PRINTF */
173 awksprintf, /* SPRINTF */
174 nullproc, /* ELSE */
175 intest, /* INTEST */
176 condexpr, /* CONDEXPR */
177 incrdecr, /* POSTINCR */
178 incrdecr, /* PREINCR */
179 incrdecr, /* POSTDECR */
180 incrdecr, /* PREDECR */
181 nullproc, /* VAR */
182 nullproc, /* IVAR */
183 getnf, /* VARNF */
184 call, /* CALL */
185 nullproc, /* NUMBER */
186 nullproc, /* STRING */
187 nullproc, /* REGEXPR */
188 get_line, /* GETLINE */
189 gensub, /* GENSUB */
190 jump, /* RETURN */
191 split, /* SPLIT */
192 substr, /* SUBSTR */
193 whilestat, /* WHILE */
194 cat, /* CAT */
195 boolop, /* NOT */
196 arith, /* UMINUS */
197 arith, /* POWER */
198 nullproc, /* DECR */
199 nullproc, /* INCR */
200 indirect, /* INDIRECT */
201 nullproc, /* LASTTOKEN */
204 const char *tokname(int n)
206 static char buf[100];
208 if (n < FIRSTTOKEN || n > LASTTOKEN) {
209 snprintf(buf, sizeof(buf), "token %d", n);
210 return buf;
212 return printname[n-FIRSTTOKEN];