#include #include "awk.h" #include "awkgram.h" static const char * const printname[92] = { "FIRSTTOKEN", /* 57346 */ "PROGRAM", /* 57347 */ "PASTAT", /* 57348 */ "PASTAT2", /* 57349 */ "XBEGIN", /* 57350 */ "XEND", /* 57351 */ "NL", /* 57352 */ "ARRAY", /* 57353 */ "MATCH", /* 57354 */ "NOTMATCH", /* 57355 */ "MATCHOP", /* 57356 */ "FINAL", /* 57357 */ "DOT", /* 57358 */ "ALL", /* 57359 */ "CCL", /* 57360 */ "NCCL", /* 57361 */ "CHAR", /* 57362 */ "OR", /* 57363 */ "STAR", /* 57364 */ "QUEST", /* 57365 */ "PLUS", /* 57366 */ "AND", /* 57367 */ "BOR", /* 57368 */ "APPEND", /* 57369 */ "EQ", /* 57370 */ "GE", /* 57371 */ "GT", /* 57372 */ "LE", /* 57373 */ "LT", /* 57374 */ "NE", /* 57375 */ "IN", /* 57376 */ "ARG", /* 57377 */ "BLTIN", /* 57378 */ "BREAK", /* 57379 */ "CLOSE", /* 57380 */ "CONTINUE", /* 57381 */ "DELETE", /* 57382 */ "DO", /* 57383 */ "EXIT", /* 57384 */ "FOR", /* 57385 */ "FUNC", /* 57386 */ "SUB", /* 57387 */ "GSUB", /* 57388 */ "IF", /* 57389 */ "INDEX", /* 57390 */ "LSUBSTR", /* 57391 */ "MATCHFCN", /* 57392 */ "NEXT", /* 57393 */ "NEXTFILE", /* 57394 */ "ADD", /* 57395 */ "MINUS", /* 57396 */ "MULT", /* 57397 */ "DIVIDE", /* 57398 */ "MOD", /* 57399 */ "ASSIGN", /* 57400 */ "ASGNOP", /* 57401 */ "ADDEQ", /* 57402 */ "SUBEQ", /* 57403 */ "MULTEQ", /* 57404 */ "DIVEQ", /* 57405 */ "MODEQ", /* 57406 */ "POWEQ", /* 57407 */ "PRINT", /* 57408 */ "PRINTF", /* 57409 */ "SPRINTF", /* 57410 */ "ELSE", /* 57411 */ "INTEST", /* 57412 */ "CONDEXPR", /* 57413 */ "POSTINCR", /* 57414 */ "PREINCR", /* 57415 */ "POSTDECR", /* 57416 */ "PREDECR", /* 57417 */ "VAR", /* 57418 */ "IVAR", /* 57419 */ "VARNF", /* 57420 */ "CALL", /* 57421 */ "NUMBER", /* 57422 */ "STRING", /* 57423 */ "REGEXPR", /* 57424 */ "GETLINE", /* 57425 */ "RETURN", /* 57426 */ "SPLIT", /* 57427 */ "SUBSTR", /* 57428 */ "WHILE", /* 57429 */ "CAT", /* 57430 */ "NOT", /* 57431 */ "UMINUS", /* 57432 */ "POWER", /* 57433 */ "DECR", /* 57434 */ "INCR", /* 57435 */ "INDIRECT", /* 57436 */ "LASTTOKEN", /* 57437 */ }; Cell *(*proctab[92])(Node **, int) = { nullproc, /* FIRSTTOKEN */ program, /* PROGRAM */ pastat, /* PASTAT */ dopa2, /* PASTAT2 */ nullproc, /* XBEGIN */ nullproc, /* XEND */ nullproc, /* NL */ array, /* ARRAY */ matchop, /* MATCH */ matchop, /* NOTMATCH */ nullproc, /* MATCHOP */ nullproc, /* FINAL */ nullproc, /* DOT */ nullproc, /* ALL */ nullproc, /* CCL */ nullproc, /* NCCL */ nullproc, /* CHAR */ nullproc, /* OR */ nullproc, /* STAR */ nullproc, /* QUEST */ nullproc, /* PLUS */ boolop, /* AND */ boolop, /* BOR */ nullproc, /* APPEND */ relop, /* EQ */ relop, /* GE */ relop, /* GT */ relop, /* LE */ relop, /* LT */ relop, /* NE */ instat, /* IN */ arg, /* ARG */ bltin, /* BLTIN */ jump, /* BREAK */ closefile, /* CLOSE */ jump, /* CONTINUE */ awkdelete, /* DELETE */ dostat, /* DO */ jump, /* EXIT */ forstat, /* FOR */ nullproc, /* FUNC */ sub, /* SUB */ gsub, /* GSUB */ ifstat, /* IF */ sindex, /* INDEX */ nullproc, /* LSUBSTR */ matchop, /* MATCHFCN */ jump, /* NEXT */ jump, /* NEXTFILE */ arith, /* ADD */ arith, /* MINUS */ arith, /* MULT */ arith, /* DIVIDE */ arith, /* MOD */ assign, /* ASSIGN */ nullproc, /* ASGNOP */ assign, /* ADDEQ */ assign, /* SUBEQ */ assign, /* MULTEQ */ assign, /* DIVEQ */ assign, /* MODEQ */ assign, /* POWEQ */ printstat, /* PRINT */ awkprintf, /* PRINTF */ awksprintf, /* SPRINTF */ nullproc, /* ELSE */ intest, /* INTEST */ condexpr, /* CONDEXPR */ incrdecr, /* POSTINCR */ incrdecr, /* PREINCR */ incrdecr, /* POSTDECR */ incrdecr, /* PREDECR */ nullproc, /* VAR */ nullproc, /* IVAR */ getnf, /* VARNF */ call, /* CALL */ nullproc, /* NUMBER */ nullproc, /* STRING */ nullproc, /* REGEXPR */ getline, /* GETLINE */ jump, /* RETURN */ split, /* SPLIT */ substr, /* SUBSTR */ whilestat, /* WHILE */ cat, /* CAT */ boolop, /* NOT */ arith, /* UMINUS */ arith, /* POWER */ nullproc, /* DECR */ nullproc, /* INCR */ indirect, /* INDIRECT */ nullproc, /* LASTTOKEN */ }; const char *tokname(int n) { static char buf[100]; if (n < FIRSTTOKEN || n > LASTTOKEN) { sprintf(buf, "token %d", n); return buf; } return printname[n-FIRSTTOKEN]; }