diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-07-15 01:26:45 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-07-15 01:26:45 +0000 |
commit | ca4224d8780bbb23f51d3a5bda642a81e6a46b01 (patch) | |
tree | a2c4655ada2f9fca785ba57990d414fb9a023b3d | |
parent | 73af097db58528a3b8b9b69af035786eb3724ae3 (diff) | |
parent | 990cac9c8728bc00e0b8676c5579f37876c0dee1 (diff) | |
download | one-true-awk-android12-mainline-conscrypt-release.tar.gz |
Snap for 7550844 from 990cac9c8728bc00e0b8676c5579f37876c0dee1 to mainline-conscrypt-releaseandroid-mainline-12.0.0_r8android-mainline-12.0.0_r25android12-mainline-conscrypt-release
Change-Id: I3e7539e5b9d66203d45f940dc0532c7aedf96940
39 files changed, 862 insertions, 4502 deletions
@@ -1,6 +1,4 @@ a.out maketab proctab.c -ytab.c -ytab.h *.o @@ -1,3 +1,33 @@ +package { + default_applicable_licenses: ["external_one-true-awk_license"], +} + +// Added automatically by a large-scale-change that took the approach of +// 'apply every license found to every target'. While this makes sure we respect +// every license restriction, it may not be entirely correct. +// +// e.g. GPL in an MIT project might only apply to the contrib/ directory. +// +// Please consider splitting the single license below into multiple licenses, +// taking care not to lose any license_kind information, and overriding the +// default license using the 'licenses: [...]' property on targets as needed. +// +// For unused files, consider creating a 'fileGroup' with "//visibility:private" +// to attach the license to, and including a comment whether the files may be +// used in the current project. +// See: http://go/android-license-faq +license { + name: "external_one-true-awk_license", + visibility: [":__subpackages__"], + license_kinds: [ + "SPDX-license-identifier-BSD", + "SPDX-license-identifier-MIT", + ], + license_text: [ + "LICENSE", + ], +} + cc_defaults { name: "awk-flags", cflags: [ @@ -16,6 +46,7 @@ cc_defaults { // in stdio2.h, and this #defines it in awk.h "-Wno-macro-redefined", ], + c_std: "gnu11", stl: "none", yacc: { flags: [ @@ -24,28 +55,57 @@ cc_defaults { }, } -// TODO: we should actually rebuild awkgram.y and pass the output through maketab. -// For now we just rebuild the checked-in generated files. +genrule { + name: "awkgram.tab.c", + cmd: "M4=$(location m4) $(location bison) -y --no-lines --output=$(genDir)/awkgram.tab.c $(in)", + out: ["awkgram.tab.c"], + srcs: ["awkgram.y"], + tools: [ + "bison", + "m4", + ], +} + +genrule { + name: "awkgram.tab.h", + cmd: "M4=$(location m4) $(location bison) -y --no-lines --defines=$(genDir)/awkgram.tab.h --output=$(genDir)/awkgram.tab.c $(in)", + out: ["awkgram.tab.h"], + srcs: ["awkgram.y"], + tools: [ + "bison", + "m4", + ], +} + +genrule { + name: "proctab.c", + tools: ["awk-maketab"], + cmd: "$(location awk-maketab) $(in) > $(genDir)/proctab.c", + out: ["proctab.c"], + srcs: [":awkgram.tab.h"], +} + cc_binary_host { name: "awk-maketab", defaults: ["awk-flags"], - srcs: ["maketab.c"] + generated_headers: ["awkgram.tab.h"], + srcs: ["maketab.c"], } cc_defaults { name: "awk-defaults", defaults: ["awk-flags"], - + generated_headers: ["awkgram.tab.h"], srcs: [ "b.c", "lex.c", "lib.c", "main.c", "parse.c", - "proctab.c", + ":proctab.c", "run.c", "tran.c", - "ytab.c", + ":awkgram.tab.c", ], } @@ -1,3 +1,15 @@ +2020-07-30 Arnold D. Robbins <arnold@skeeve.com> + + By fiat, we use bison for $(YACC). Trying to accommodate + different versions didn't work. + + * makefile: Significant cleanup. Replace all ytab* references + with awkgram.tab.* and simplify definition of YACC. + * .gitignore: Remove ytab* references. + * b.c, lex.c, maketab.c, parse.c, run.c: Replace include of ytab.h + with awkgram.tab.h. + * lib.c, main.c, tran.c: Remove include of ytab.h, wasn't needed. + 2020-01-20 Arnold D. Robbins <arnold@skeeve.com> * run.c (openfile): Set the close-on-exec flag for file @@ -25,6 +25,109 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the AWK book was sent to the printers in August, 1987. +February 15, 2021: + Small fix so that awk will compile again with g++. Thanks to + Arnold Robbins. + +January 06, 2021: + Fix a decision bug with trailing stuff in lib.c:is_valid_number + after recent changes. Thanks to Ozan Yigit. + +December 18, 2020: + Fix problems converting inf and NaN values in lib.c:is_valid_number. + Enhance number to string conversion to do the right thing for + NaN and inf values. Things are now pretty much the same as in + gawk. (Found a gawk bug while we're at it.) Added a torture + test for these values. Thanks to Arnold Robbins. Allows closing + of PR #101. + +December 15, 2020: + Merge PR #99, which gets the right header for strcasecmp. + Thanks to GitHub user michaelforney. + +December 8, 2020: + Merge PR #98: Disallow hex data. Allow only +nan, -nan, + +inf, -inf (case independent) to give NaN and infinity values. + Improve things so that string to double conversion is only + done once, yielding something of a speedup. This obviate + PR #95. Thanks to Arnold Robbins. + +December 3, 2020: + Fix to argument parsing to avoid printing spurious newlines. + Thanks to Todd Miller. Merges PR #97. + +October 13, 2020: + Add casts before all the calls to malloc/calloc/realloc in order + to get it to compile with g++. Thanks to Arnold Robbins. + +August 16, 2020: + Additional fixes for DJGPP. Thanks to Eli Zaretskii for + the testing. + +August 7, 2020: + Merge PR #93, which adds casts to (void*) for debug prints + using the %p format specifier. Thanks to GitHub user YongHaoWu + ("Chris") for the fixes. + +August 4, 2020: + In run.c, use non-restartable multibyte routines to attain + portability to DJGPP. Should fix Issue 92. Thanks to Albert Wik + for the report and to Todd Miller for the suggested fix. + +July 30, 2020: + Merge PRs 88-91 which fix small bugs. Thanks to Todd Miller and + Tim van der Molen for the fixes. + + In order to make life easier, we move exclusively to bison + as the parser generator. + +July 2, 2020: + Merge PRs 85 and 86 which fix regressions. Thanks to + Tim van der Molen for the fixes. + +June 25, 2020: + Merge PRs 82 and 84. The latter fixes issue #83. Thanks to + Todd Miller and awkfan77. + +June 12, 2020: + Clear errno before calling errcheck to avoid any spurious errors + left over from previous calls that may have set it. Thanks to + Todd Miller for the fix, from PR #80. + + Fix Issue #78 by allowing \r to follow floating point numbers in + lib.c:is_number. Thanks to GitHub user ajcarr for the report + and to Arnold Robbins for the fix. + +June 5, 2020: + In fldbld(), make sure that inputFS is set before trying to + use it. Thanks to Steffen Nurpmeso <steffen@sdaoden.eu> + for the report. + +May 5, 2020: + Fix checks for compilers that can handle noreturn. Thanks to + GitHub user enh-google for pointing it out. Closes Issue #79. + +April 16, 2020: + Handle old compilers that don't support C11 (for noreturn). + Thanks to Arnold Robbins. + +April 5, 2020: + Use <stdnoreturn.h> and noreturn instead of GCC attributes. + Thanks to GitHub user awkfan77. Closes PR #77. + +February 28, 2020: + More cleanups from Christos Zoulas: notably backslash continuation + inside strings removes the newline and a fix for RS = "^a". + Fix for address sanitizer-found problem. Thanks to GitHub user + enh-google. + +February 19, 2020: + More small cleanups from Christos Zoulas. + +February 18, 2020: + Additional cleanups from Christos Zoulas. It's no longer necessary + to use the -y flag to bison. + February 6, 2020: Additional small cleanups from Christos Zoulas. awk is now a little more robust about reporting I/O errors upon exit. @@ -5,11 +5,11 @@ third_party { type: GIT value: "https://github.com/onetrueawk/awk.git" } - version: "e9c99065fd31253a4db4a6bce673decd143f7a3e" + version: "c0f4e97e4561ff42544e92512bbaf3d7d1f6a671" license_type: NOTICE last_upgrade_date { - year: 2020 - month: 2 - day: 7 + year: 2021 + month: 4 + day: 1 } } @@ -1 +0,0 @@ -LICENSE
\ No newline at end of file @@ -99,10 +99,21 @@ welcome. This compiles without change on Macintosh OS X using `gcc` and the standard developer tools. +You can also use `make CC=g++` to build with the GNU C++ compiler, +should you choose to do so. + The version of `malloc` that comes with some systems is sometimes astonishly slow. If `awk` seems slow, you might try fixing that. More generally, turning on optimization can significantly improve `awk`'s speed, perhaps by 1/3 for highest levels. +## A Note About Maintenance + +NOTICE! Maintenance of this program is on a ``best effort'' +basis. We try to get to issues and pull requests as quickly +as we can. Unfortunately, however, keeping this program going +is not at the top of our priority list. + #### Last Updated -Wed Jan 1 22:44:38 IST 2020 + +Fri Dec 25 16:53:34 EST 2020 @@ -33,3 +33,7 @@ then fi REGRESS + +cd .. +cd bugs-fixed +REGRESS @@ -7,6 +7,10 @@ .fi .ft 1 .. +.de TF +.IP "" "\w'\fB\\$1\ \ \fP'u" +.PD 0 +.. .TH AWK 1 .CT 1 files prog_other .SH NAME @@ -568,8 +572,61 @@ There are no explicit conversions between numbers and strings. To force an expression to be treated as a number add 0 to it; to force it to be treated as a string concatenate \&\f(CW""\fP to it. -.br +.PP The scope rules for variables in functions are a botch; the syntax is worse. -.br +.PP Only eight-bit characters sets are handled correctly. +.SH UNUSUAL FLOATING-POINT VALUES +.I Awk +was designed before IEEE 754 arithmetic defined Not-A-Number (NaN) +and Infinity values, which are supported by all modern floating-point +hardware. +.PP +Because +.I awk +uses +.IR strtod (3) +and +.IR atof (3) +to convert string values to double-precision floating-point values, +modern C libraries also convert strings starting with +.B inf +and +.B nan +into infinity and NaN values respectively. This led to strange results, +with something like this: +.PP +.EX +.nf +echo nancy | awk '{ print $1 + 0 }' +.fi +.EE +.PP +printing +.B nan +instead of zero. +.PP +.I Awk +now follows GNU AWK, and prefilters string values before attempting +to convert them to numbers, as follows: +.TP +.I "Hexadecimal values" +Hexadecimal values (allowed since C99) convert to zero, as they did +prior to C99. +.TP +.I "NaN values" +The two strings +.B +nan +and +.B \-nan +(case independent) convert to NaN. No others do. +(NaNs can have signs.) +.TP +.I "Infinity values" +The two strings +.B +inf +and +.B \-inf +(case independent) convert to positive and negative infinity, respectively. +No others do. @@ -25,6 +25,11 @@ THIS SOFTWARE. #include <assert.h> #include <stdint.h> #include <stdbool.h> +#if __STDC_VERSION__ <= 199901L +#define noreturn +#else +#include <stdnoreturn.h> +#endif typedef double Awkfloat; @@ -39,14 +44,13 @@ typedef unsigned char uschar; */ #define setptr(ptr, a) (*(char *)(intptr_t)(ptr)) = (a) -#define NN(p) ((p) ? (p) : "(null)") /* guaranteed non-null for dprintf +#define NN(p) ((p) ? (p) : "(null)") /* guaranteed non-null for DPRINTF */ #define DEBUG #ifdef DEBUG - /* uses have to be doubly parenthesized */ -# define dprintf(x) if (dbg) printf x +# define DPRINTF(...) if (dbg) printf(__VA_ARGS__) #else -# define dprintf(x) +# define DPRINTF(...) #endif extern enum compile_states { @@ -32,7 +32,7 @@ THIS SOFTWARE. #include <string.h> #include <stdlib.h> #include "awk.h" -#include "ytab.h" +#include "awkgram.tab.h" #define MAXLIN 22 @@ -83,7 +83,7 @@ int nfatab = 0; /* entries in fatab */ static int * intalloc(size_t n, const char *f) { - void *p = calloc(n, sizeof(int)); + int *p = (int *) calloc(n, sizeof(int)); if (p == NULL) overflo(f); return p; @@ -96,8 +96,8 @@ resizesetvec(const char *f) maxsetvec = MAXLIN; else maxsetvec *= 4; - setvec = realloc(setvec, maxsetvec * sizeof(*setvec)); - tmpset = realloc(tmpset, maxsetvec * sizeof(*tmpset)); + setvec = (int *) realloc(setvec, maxsetvec * sizeof(*setvec)); + tmpset = (int *) realloc(tmpset, maxsetvec * sizeof(*tmpset)); if (setvec == NULL || tmpset == NULL) overflo(f); } @@ -105,7 +105,9 @@ resizesetvec(const char *f) static void resize_state(fa *f, int state) { - void *p; + unsigned int **p; + uschar *p2; + int **p3; int i, new_count; if (++state < f->state_count) @@ -113,23 +115,23 @@ resize_state(fa *f, int state) new_count = state + 10; /* needs to be tuned */ - p = realloc(f->gototab, new_count * sizeof(f->gototab[0])); + p = (unsigned int **) realloc(f->gototab, new_count * sizeof(f->gototab[0])); if (p == NULL) goto out; f->gototab = p; - p = realloc(f->out, new_count * sizeof(f->out[0])); - if (p == NULL) + p2 = (uschar *) realloc(f->out, new_count * sizeof(f->out[0])); + if (p2 == NULL) goto out; - f->out = p; + f->out = p2; - p = realloc(f->posns, new_count * sizeof(f->posns[0])); - if (p == NULL) + p3 = (int **) realloc(f->posns, new_count * sizeof(f->posns[0])); + if (p3 == NULL) goto out; - f->posns = p; + f->posns = p3; for (i = f->state_count; i < new_count; ++i) { - f->gototab[i] = calloc(NCHARS, sizeof(**f->gototab)); + f->gototab[i] = (unsigned int *) calloc(NCHARS, sizeof(**f->gototab)); if (f->gototab[i] == NULL) goto out; f->out[i] = 0; @@ -195,7 +197,7 @@ fa *mkdfa(const char *s, bool anchor) /* does the real work of making a dfa */ poscnt = 0; penter(p1); /* enter parent pointers and leaf indices */ - if ((f = calloc(1, sizeof(fa) + poscnt * sizeof(rrow))) == NULL) + if ((f = (fa *) calloc(1, sizeof(fa) + poscnt * sizeof(rrow))) == NULL) overflo(__func__); f->accept = poscnt-1; /* penter has computed number of positions in re */ cfoll(f, p1); /* set up follow sets */ @@ -365,7 +367,7 @@ char *cclenter(const char *argp) /* add a character class */ static int bufsz = 100; op = p; - if (buf == NULL && (buf = malloc(bufsz)) == NULL) + if (buf == NULL && (buf = (uschar *) malloc(bufsz)) == NULL) FATAL("out of space for character class [%.10s...] 1", p); bp = buf; for (i = 0; (c = *p++) != 0; ) { @@ -397,7 +399,7 @@ char *cclenter(const char *argp) /* add a character class */ i++; } *bp = 0; - dprintf( ("cclenter: in = |%s|, out = |%s|\n", op, buf) ); + DPRINTF("cclenter: in = |%s|, out = |%s|\n", op, buf); xfree(op); return (char *) tostring((char *) buf); } @@ -684,7 +686,7 @@ bool fnematch(fa *pfa, FILE *f, char **pbuf, int *pbufsize, int quantum) FATAL("stream '%.30s...' too long", buf); buf[k++] = (c = getc(f)) != EOF ? c : 0; } - c = buf[j]; + c = (uschar)buf[j]; /* assert(c < NCHARS); */ if ((ns = pfa->gototab[s][c]) != 0) @@ -733,7 +735,7 @@ Node *reparse(const char *p) /* parses regular expression pointed to by p */ { /* uses relex() to scan regular expression */ Node *np; - dprintf( ("reparse <%s>\n", p) ); + DPRINTF("reparse <%s>\n", p); lastre = prestr = (const uschar *) p; /* prestr points to string to be parsed */ rtok = relex(); /* GNU compatibility: an empty regexp matches anything */ @@ -937,7 +939,7 @@ replace_repeat(const uschar *reptok, int reptoklen, const uschar *atom, } else if (special_case == REPEAT_ZERO) { size += 2; /* just a null ERE: () */ } - if ((buf = malloc(size + 1)) == NULL) + if ((buf = (uschar *) malloc(size + 1)) == NULL) FATAL("out of space in reg expr %.10s..", lastre); memcpy(buf, basestr, prefix_length); /* copy prefix */ j = prefix_length; @@ -1065,7 +1067,7 @@ rescan: rlxval = c; return CHAR; case '[': - if (buf == NULL && (buf = malloc(bufsz)) == NULL) + if (buf == NULL && (buf = (uschar *) malloc(bufsz)) == NULL) FATAL("out of space in reg expr %.10s..", lastre); bp = buf; if (*prestr == '^') { @@ -1105,6 +1107,12 @@ rescan: if (!adjbuf((char **) &buf, &bufsz, bp-buf+1, 100, (char **) &bp, "relex2")) FATAL("out of space for reg expr %.10s...", lastre); if (cc->cc_func(i)) { + /* escape backslash */ + if (i == '\\') { + *bp++ = '\\'; + n++; + } + *bp++ = i; n++; } diff --git a/bugs-fixed/REGRESS b/bugs-fixed/REGRESS new file mode 100755 index 0000000..0716003 --- /dev/null +++ b/bugs-fixed/REGRESS @@ -0,0 +1,28 @@ +#! /bin/bash + +if [ ! -f ../a.out ] +then + echo Making executable + (cd .. ; make) || exit 0 +fi + +for i in *.awk +do + echo === $i + OUT=${i%.awk}.OUT + OK=${i%.awk}.ok + IN=${i%.awk}.in + input= + if [ -f $IN ] + then + input=$IN + fi + + ../a.out -f $i $input > $OUT 2>&1 + if cmp -s $OK $OUT + then + rm -f $OUT + else + echo ++++ $i failed! + fi +done diff --git a/bugs-fixed/fs-overflow.ok b/bugs-fixed/fs-overflow.ok new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/bugs-fixed/fs-overflow.ok @@ -0,0 +1 @@ +foo diff --git a/bugs-fixed/inf-nan-torture.awk b/bugs-fixed/inf-nan-torture.awk new file mode 100644 index 0000000..8d145f2 --- /dev/null +++ b/bugs-fixed/inf-nan-torture.awk @@ -0,0 +1,4 @@ +{ + for (i = 1; i <= NF; i++) + print i, $i, $i + 0 +} diff --git a/bugs-fixed/inf-nan-torture.in b/bugs-fixed/inf-nan-torture.in new file mode 100644 index 0000000..45dfdc8 --- /dev/null +++ b/bugs-fixed/inf-nan-torture.in @@ -0,0 +1 @@ +-inf -inform inform -nan -nancy nancy -123 0 123 +123 nancy +nancy +nan inform +inform +inf diff --git a/bugs-fixed/inf-nan-torture.ok b/bugs-fixed/inf-nan-torture.ok new file mode 100644 index 0000000..40d3194 --- /dev/null +++ b/bugs-fixed/inf-nan-torture.ok @@ -0,0 +1,16 @@ +1 -inf -inf +2 -inform 0 +3 inform 0 +4 -nan -nan +5 -nancy 0 +6 nancy 0 +7 -123 -123 +8 0 0 +9 123 123 +10 +123 123 +11 nancy 0 +12 +nancy 0 +13 +nan +nan +14 inform 0 +15 +inform 0 +16 +inf +inf diff --git a/bugs-fixed/missing-precision.ok b/bugs-fixed/missing-precision.ok index 608b4fa..75e1e3d 100644 --- a/bugs-fixed/missing-precision.ok +++ b/bugs-fixed/missing-precision.ok @@ -1,2 +1,2 @@ -./a.out: not enough args in printf(%*s) +../a.out: not enough args in printf(%*s) source line number 1 diff --git a/bugs-fixed/negative-nf.ok b/bugs-fixed/negative-nf.ok index 71c8604..de97f8b 100644 --- a/bugs-fixed/negative-nf.ok +++ b/bugs-fixed/negative-nf.ok @@ -1,2 +1,2 @@ -./a.out: cannot set NF to a negative value +../a.out: cannot set NF to a negative value source line number 1 diff --git a/bugs-fixed/pfile-overflow.awk b/bugs-fixed/pfile-overflow.awk new file mode 100644 index 0000000..b7d5379 --- /dev/null +++ b/bugs-fixed/pfile-overflow.awk @@ -0,0 +1 @@ +\
\ No newline at end of file diff --git a/bugs-fixed/pfile-overflow.ok b/bugs-fixed/pfile-overflow.ok new file mode 100644 index 0000000..a0de50f --- /dev/null +++ b/bugs-fixed/pfile-overflow.ok @@ -0,0 +1,4 @@ +../a.out: syntax error at source line 1 source file pfile-overflow.awk + context is + >>> <<< +../a.out: bailing out at source line 1 source file pfile-overflow.awk diff --git a/bugs-fixed/rs_underflow.awk b/bugs-fixed/rs_underflow.awk new file mode 100644 index 0000000..4cf1702 --- /dev/null +++ b/bugs-fixed/rs_underflow.awk @@ -0,0 +1 @@ +BEGIN { RS="zx" } { print $1 } diff --git a/bugs-fixed/rs_underflow.in b/bugs-fixed/rs_underflow.in new file mode 100644 index 0000000..74c8035 --- /dev/null +++ b/bugs-fixed/rs_underflow.in @@ -0,0 +1 @@ +Ä diff --git a/bugs-fixed/rs_underflow.ok b/bugs-fixed/rs_underflow.ok new file mode 100644 index 0000000..74c8035 --- /dev/null +++ b/bugs-fixed/rs_underflow.ok @@ -0,0 +1 @@ +Ä @@ -27,7 +27,7 @@ THIS SOFTWARE. #include <string.h> #include <ctype.h> #include "awk.h" -#include "ytab.h" +#include "awkgram.tab.h" extern YYSTYPE yylval; extern bool infunc; @@ -148,7 +148,7 @@ static int gettok(char **pbuf, int *psz) /* get next input token */ strtod(buf, &rem); /* parse the number */ if (rem == buf) { /* it wasn't a valid number at all */ buf[1] = 0; /* return one character as token */ - retc = buf[0]; /* character is its own type */ + retc = (uschar)buf[0]; /* character is its own type */ unputstr(rem+1); /* put rest back for later */ } else { /* some prefix was a number */ unputstr(rem); /* put rest back for later */ @@ -173,7 +173,7 @@ int yylex(void) static char *buf = NULL; static int bufsize = 5; /* BUG: setting this small causes core dump! */ - if (buf == NULL && (buf = malloc(bufsize)) == NULL) + if (buf == NULL && (buf = (char *) malloc(bufsize)) == NULL) FATAL( "out of space in yylex" ); if (sc) { sc = false; @@ -191,7 +191,12 @@ int yylex(void) return word(buf); if (isdigit(c)) { char *cp = tostring(buf); - yylval.cp = setsymtab(buf, cp, atof(buf), CON|NUM, symtab); + double result; + + if (is_number(cp, & result)) + yylval.cp = setsymtab(buf, cp, result, CON|NUM, symtab); + else + yylval.cp = setsymtab(buf, cp, 0.0, STR, symtab); free(cp); /* should this also have STR set? */ RET(NUMBER); @@ -370,7 +375,7 @@ int string(void) static char *buf = NULL; static int bufsz = 500; - if (buf == NULL && (buf = malloc(bufsz)) == NULL) + if (buf == NULL && (buf = (char *) malloc(bufsz)) == NULL) FATAL("out of space for strings"); for (bp = buf; (c = input()) != '"'; ) { if (!adjbuf(&buf, &bufsz, bp-buf+2, 500, &bp, "string")) @@ -388,6 +393,7 @@ int string(void) case '\\': c = input(); switch (c) { + case '\n': break; case '"': *bp++ = '"'; break; case 'n': *bp++ = '\n'; break; case 't': *bp++ = '\t'; break; @@ -518,7 +524,7 @@ int regexpr(void) static int bufsz = 500; char *bp; - if (buf == NULL && (buf = malloc(bufsz)) == NULL) + if (buf == NULL && (buf = (char *) malloc(bufsz)) == NULL) FATAL("out of space for rex expr"); bp = buf; for ( ; (c = input()) != '/' && c != 0; ) { @@ -25,16 +25,18 @@ THIS SOFTWARE. #define DEBUG #include <stdio.h> #include <string.h> +#include <strings.h> #include <ctype.h> #include <errno.h> #include <stdlib.h> #include <stdarg.h> #include <limits.h> +#include <math.h> #include "awk.h" -#include "ytab.h" char EMPTY[] = { '\0' }; FILE *infile = NULL; +bool innew; /* true = infile has not been read by readrec */ char *file = EMPTY; char *record; int recsize = RECSIZE; @@ -55,15 +57,15 @@ int lastfld = 0; /* last used field */ int argno = 1; /* current input argument number */ extern Awkfloat *ARGC; -static Cell dollar0 = { OCELL, CFLD, NULL, EMPTY, 0.0, REC|STR|DONTFREE }; -static Cell dollar1 = { OCELL, CFLD, NULL, EMPTY, 0.0, FLD|STR|DONTFREE }; +static Cell dollar0 = { OCELL, CFLD, NULL, EMPTY, 0.0, REC|STR|DONTFREE, NULL, NULL }; +static Cell dollar1 = { OCELL, CFLD, NULL, EMPTY, 0.0, FLD|STR|DONTFREE, NULL, NULL }; void recinit(unsigned int n) { - if ( (record = malloc(n)) == NULL - || (fields = malloc(n+1)) == NULL - || (fldtab = calloc(nfields+2, sizeof(*fldtab))) == NULL - || (fldtab[0] = malloc(sizeof(**fldtab))) == NULL) + if ( (record = (char *) malloc(n)) == NULL + || (fields = (char *) malloc(n+1)) == NULL + || (fldtab = (Cell **) calloc(nfields+2, sizeof(*fldtab))) == NULL + || (fldtab[0] = (Cell *) malloc(sizeof(**fldtab))) == NULL) FATAL("out of space for $0 and fields"); *record = '\0'; *fldtab[0] = dollar0; @@ -78,7 +80,7 @@ void makefields(int n1, int n2) /* create $n1..$n2 inclusive */ int i; for (i = n1; i <= n2; i++) { - fldtab[i] = malloc(sizeof(**fldtab)); + fldtab[i] = (Cell *) malloc(sizeof(**fldtab)); if (fldtab[i] == NULL) FATAL("out of space in makefields %d", i); *fldtab[i] = dollar1; @@ -106,6 +108,7 @@ void initgetrec(void) argno++; } infile = stdin; /* no filenames, so use stdin */ + innew = true; } /* @@ -126,7 +129,7 @@ void savefs(void) } len_inputFS = len + 1; - inputFS = realloc(inputFS, len_inputFS); + inputFS = (char *) realloc(inputFS, len_inputFS); if (inputFS == NULL) FATAL("field separator %.10s... is too long", *FS); memcpy(inputFS, *FS, len_inputFS); @@ -145,8 +148,8 @@ int getrec(char **pbuf, int *pbufsize, bool isrecord) /* get next input record * firsttime = false; initgetrec(); } - dprintf( ("RS=<%s>, FS=<%s>, ARGC=%g, FILENAME=%s\n", - *RS, *FS, *ARGC, *FILENAME) ); + DPRINTF("RS=<%s>, FS=<%s>, ARGC=%g, FILENAME=%s\n", + *RS, *FS, *ARGC, *FILENAME); if (isrecord) { donefld = false; donerec = true; @@ -155,7 +158,7 @@ int getrec(char **pbuf, int *pbufsize, bool isrecord) /* get next input record * saveb0 = buf[0]; buf[0] = 0; while (argno < *ARGC || infile == stdin) { - dprintf( ("argno=%d, file=|%s|\n", argno, file) ); + DPRINTF("argno=%d, file=|%s|\n", argno, file); if (infile == NULL) { /* have to open a new file */ file = getargv(argno); if (file == NULL || *file == '\0') { /* deleted or zapped */ @@ -168,22 +171,26 @@ int getrec(char **pbuf, int *pbufsize, bool isrecord) /* get next input record * continue; } *FILENAME = file; - dprintf( ("opening file %s\n", file) ); + DPRINTF("opening file %s\n", file); if (*file == '-' && *(file+1) == '\0') infile = stdin; else if ((infile = fopen(file, "r")) == NULL) FATAL("can't open file %s", file); setfval(fnrloc, 0.0); } - c = readrec(&buf, &bufsize, infile); + c = readrec(&buf, &bufsize, infile, innew); + if (innew) + innew = false; if (c != 0 || buf[0] != '\0') { /* normal record */ if (isrecord) { + double result; + if (freeable(fldtab[0])) xfree(fldtab[0]->sval); fldtab[0]->sval = buf; /* buf == record */ fldtab[0]->tval = REC | STR | DONTFREE; - if (is_number(fldtab[0]->sval)) { - fldtab[0]->fval = atof(fldtab[0]->sval); + if (is_number(fldtab[0]->sval, & result)) { + fldtab[0]->fval = result; fldtab[0]->tval |= NUM; } } @@ -213,7 +220,7 @@ void nextfile(void) argno++; } -int readrec(char **pbuf, int *pbufsize, FILE *inf) /* read one record into buf */ +int readrec(char **pbuf, int *pbufsize, FILE *inf, bool newflag) /* read one record into buf */ { int sep, c, isrec; char *rr, *buf = *pbuf; @@ -224,7 +231,14 @@ int readrec(char **pbuf, int *pbufsize, FILE *inf) /* read one record into buf * bool found; fa *pfa = makedfa(rs, 1); - found = fnematch(pfa, inf, &buf, &bufsize, recsize); + if (newflag) + found = fnematch(pfa, inf, &buf, &bufsize, recsize); + else { + int tempstat = pfa->initstat; + pfa->initstat = 2; + found = fnematch(pfa, inf, &buf, &bufsize, recsize); + pfa->initstat = tempstat; + } if (found) setptr(patbeg, '\0'); } else { @@ -260,7 +274,7 @@ int readrec(char **pbuf, int *pbufsize, FILE *inf) /* read one record into buf * *pbuf = buf; *pbufsize = bufsize; isrec = *buf || !feof(inf); - dprintf( ("readrec saw <%s>, returns %d\n", buf, isrec) ); + DPRINTF("readrec saw <%s>, returns %d\n", buf, isrec); return isrec; } @@ -275,7 +289,7 @@ char *getargv(int n) /* get ARGV[n] */ return NULL; x = setsymtab(temp, "", 0.0, STR, ARGVtab); s = getsval(x); - dprintf( ("getargv(%d) returns |%s|\n", n, s) ); + DPRINTF("getargv(%d) returns |%s|\n", n, s); return s; } @@ -283,6 +297,7 @@ void setclvar(char *s) /* set var=value from s */ { char *p; Cell *q; + double result; for (p=s; *p != '='; p++) ; @@ -290,11 +305,11 @@ void setclvar(char *s) /* set var=value from s */ p = qstring(p, '\0'); q = setsymtab(s, p, 0.0, STR, symtab); setsval(q, p); - if (is_number(q->sval)) { - q->fval = atof(q->sval); + if (is_number(q->sval, & result)) { + q->fval = result; q->tval |= NUM; } - dprintf( ("command line set %s to |%s|\n", s, p) ); + DPRINTF("command line set %s to |%s|\n", s, p); } @@ -315,12 +330,14 @@ void fldbld(void) /* create fields from current record */ n = strlen(r); if (n > fieldssize) { xfree(fields); - if ((fields = malloc(n+2)) == NULL) /* possibly 2 final \0s */ + if ((fields = (char *) malloc(n+2)) == NULL) /* possibly 2 final \0s */ FATAL("out of space for fields in fldbld %d", n); fieldssize = n; } fr = fields; i = 0; /* number of fields accumulated here */ + if (inputFS == NULL) /* make sure we have a copy of FS */ + savefs(); if (strlen(inputFS) > 1) { /* it's a regular expression */ i = refldbld(r, inputFS); } else if ((sep = *inputFS) == ' ') { /* default whitespace */ @@ -390,9 +407,11 @@ void fldbld(void) /* create fields from current record */ lastfld = i; donefld = true; for (j = 1; j <= lastfld; j++) { + double result; + p = fldtab[j]; - if(is_number(p->sval)) { - p->fval = atof(p->sval); + if(is_number(p->sval, & result)) { + p->fval = result; p->tval |= NUM; } } @@ -461,8 +480,8 @@ void growfldtab(int n) /* make new fields up to at least $n */ if (n > nf) nf = n; s = (nf+1) * (sizeof (struct Cell *)); /* freebsd: how much do we need? */ - if (s / sizeof(struct Cell *) - 1 == nf) /* didn't overflow */ - fldtab = realloc(fldtab, s); + if (s / sizeof(struct Cell *) - 1 == (size_t)nf) /* didn't overflow */ + fldtab = (Cell **) realloc(fldtab, s); else /* overflow sizeof int */ xfree(fldtab); /* make it null */ if (fldtab == NULL) @@ -482,7 +501,7 @@ int refldbld(const char *rec, const char *fs) /* build fields from reg expr in F n = strlen(rec); if (n > fieldssize) { xfree(fields); - if ((fields = malloc(n+1)) == NULL) + if ((fields = (char *) malloc(n+1)) == NULL) FATAL("out of space for fields in refldbld %d", n); fieldssize = n; } @@ -491,7 +510,7 @@ int refldbld(const char *rec, const char *fs) /* build fields from reg expr in F if (*rec == '\0') return 0; pfa = makedfa(fs, 1); - dprintf( ("into refldbld, rec = <%s>, pat = <%s>\n", rec, fs) ); + DPRINTF("into refldbld, rec = <%s>, pat = <%s>\n", rec, fs); tempstat = pfa->initstat; for (i = 1; ; i++) { if (i > nfields) @@ -500,16 +519,16 @@ int refldbld(const char *rec, const char *fs) /* build fields from reg expr in F xfree(fldtab[i]->sval); fldtab[i]->tval = FLD | STR | DONTFREE; fldtab[i]->sval = fr; - dprintf( ("refldbld: i=%d\n", i) ); + DPRINTF("refldbld: i=%d\n", i); if (nematch(pfa, rec)) { pfa->initstat = 2; /* horrible coupling to b.c */ - dprintf( ("match %s (%d chars)\n", patbeg, patlen) ); + DPRINTF("match %s (%d chars)\n", patbeg, patlen); strncpy(fr, rec, patbeg-rec); fr += patbeg - rec + 1; *(fr-1) = '\0'; rec = patbeg + patlen; } else { - dprintf( ("no match %s\n", rec) ); + DPRINTF("no match %s\n", rec); strcpy(fr, rec); pfa->initstat = tempstat; break; @@ -543,15 +562,15 @@ void recbld(void) /* create $0 from $1..$NF if necessary */ if (!adjbuf(&record, &recsize, 2+r-record, recsize, &r, "recbld 3")) FATAL("built giant record `%.30s...'", record); *r = '\0'; - dprintf( ("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, (void*)fldtab[0]) ); + DPRINTF("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, (void*)fldtab[0]); if (freeable(fldtab[0])) xfree(fldtab[0]->sval); fldtab[0]->tval = REC | STR | DONTFREE; fldtab[0]->sval = record; - dprintf( ("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, (void*)fldtab[0]) ); - dprintf( ("recbld = |%s|\n", record) ); + DPRINTF("in recbld inputFS=%s, fldtab[0]=%p\n", inputFS, (void*)fldtab[0]); + DPRINTF("recbld = |%s|\n", record); donerec = true; } @@ -584,11 +603,6 @@ void SYNTAX(const char *fmt, ...) eprint(); } -void fpecatch(int n) -{ - FATAL("floating point exception %d", n); -} - extern int bracecnt, brackcnt, parencnt; void bracecheck(void) @@ -662,12 +676,11 @@ void error() fprintf(stderr, " source line number %d", curnode->lineno); else if (lineno) fprintf(stderr, " source line number %d", lineno); + if (compile_time == COMPILING && cursource() != NULL) + fprintf(stderr, " source file %s", cursource()); + fprintf(stderr, "\n"); + eprint(); } - - if (compile_time == COMPILING && cursource() != NULL) - fprintf(stderr, " source file %s", cursource()); - fprintf(stderr, "\n"); - eprint(); } void eprint(void) /* try to print context around error */ @@ -751,19 +764,75 @@ int isclvar(const char *s) /* is s of form var=something ? */ /* appears to be broken in gcc on linux: thinks 0x123 is a valid FP number */ /* wrong: violates 4.10.1.4 of ansi C standard */ -#include <math.h> -int is_number(const char *s) +/* well, not quite. As of C99, hex floating point is allowed. so this is + * a bit of a mess. We work around the mess by checking for a hexadecimal + * value and disallowing it. Similarly, we now follow gawk and allow only + * +nan, -nan, +inf, and -inf for NaN and infinity values. + */ + +/* + * This routine now has a more complicated interface, the main point + * being to avoid the double conversion of a string to double, and + * also to convey out, if requested, the information that the numeric + * value was a leading string or is all of the string. The latter bit + * is used in getfval(). + */ + +bool is_valid_number(const char *s, bool trailing_stuff_ok, + bool *no_trailing, double *result) { double r; char *ep; + bool retval = false; + bool is_nan = false; + bool is_inf = false; + + if (no_trailing) + *no_trailing = false; + + while (isspace(*s)) + s++; + + // no hex floating point, sorry + if (s[0] == '0' && tolower(s[1]) == 'x') + return false; + + // allow +nan, -nan, +inf, -inf, any other letter, no + if (s[0] == '+' || s[0] == '-') { + is_nan = (strncasecmp(s+1, "nan", 3) == 0); + is_inf = (strncasecmp(s+1, "inf", 3) == 0); + if ((is_nan || is_inf) + && (isspace(s[4]) || s[4] == '\0')) + goto convert; + else if (! isdigit(s[1]) && s[1] != '.') + return false; + } + else if (! isdigit(s[0]) && s[0] != '.') + return false; + +convert: errno = 0; r = strtod(s, &ep); - if (ep == s || r == HUGE_VAL || errno == ERANGE) - return 0; - while (*ep == ' ' || *ep == '\t' || *ep == '\n') + if (ep == s || errno == ERANGE) + return false; + + if (isnan(r) && s[0] == '-' && signbit(r) == 0) + r = -r; + + if (result != NULL) + *result = r; + + /* + * check for trailing stuff + */ + while (isspace(*ep)) ep++; - if (*ep == '\0') - return 1; - else - return 0; + + if (no_trailing != NULL) + *no_trailing = (*ep == '\0'); + + // return true if found the end, or trailing stuff is allowed + retval = *ep == '\0' || trailing_stuff_ok; + + return retval; } @@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ****************************************************************/ -const char *version = "version 20200206"; +const char *version = "version 20210215"; #define DEBUG #include <stdio.h> @@ -32,7 +32,6 @@ const char *version = "version 20200206"; #include <string.h> #include <signal.h> #include "awk.h" -#include "ytab.h" extern char **environ; extern int nfields; @@ -45,14 +44,40 @@ char *lexprog; /* points to program argument if it exists */ extern int errorflag; /* non-zero if any syntax errors; set by yyerror */ enum compile_states compile_time = ERROR_PRINTING; -#define MAX_PFILE 20 /* max number of -f's */ - -char *pfile[MAX_PFILE]; /* program filenames from -f's */ -int npfile = 0; /* number of filenames */ -int curpfile = 0; /* current filename */ +static char **pfile; /* program filenames from -f's */ +static size_t maxpfile; /* max program filename */ +static size_t npfile; /* number of filenames */ +static size_t curpfile; /* current filename */ bool safe = false; /* true => "safe" mode */ +static noreturn void fpecatch(int n +#ifdef SA_SIGINFO + , siginfo_t *si, void *uc +#endif +) +{ +#ifdef SA_SIGINFO + static const char *emsg[] = { + [0] = "Unknown error", + [FPE_INTDIV] = "Integer divide by zero", + [FPE_INTOVF] = "Integer overflow", + [FPE_FLTDIV] = "Floating point divide by zero", + [FPE_FLTOVF] = "Floating point overflow", + [FPE_FLTUND] = "Floating point underflow", + [FPE_FLTRES] = "Floating point inexact result", + [FPE_FLTINV] = "Invalid Floating point operation", + [FPE_FLTSUB] = "Subscript out of range", + }; +#endif + FATAL("floating point exception" +#ifdef SA_SIGINFO + ": %s", (size_t)si->si_code < sizeof(emsg) / sizeof(emsg[0]) && + emsg[si->si_code] ? emsg[si->si_code] : emsg[0] +#endif + ); +} + /* Can this work with recursive calls? I don't think so. void segvcatch(int n) { @@ -60,9 +85,34 @@ void segvcatch(int n) } */ +static const char * +setfs(char *p) +{ + /* wart: t=>\t */ + if (p[0] == 't' && p[1] == '\0') + return "\t"; + else if (p[0] != '\0') + return p; + return NULL; +} + +static char * +getarg(int *argc, char ***argv, const char *msg) +{ + if ((*argv)[1][2] != '\0') { /* arg is -fsomething */ + return &(*argv)[1][2]; + } else { /* arg is -f something */ + (*argc)--; (*argv)++; + if (*argc <= 1) + FATAL("%s", msg); + return (*argv)[1]; + } +} + int main(int argc, char *argv[]) { const char *fs = NULL; + char *fn, *vn; setlocale(LC_CTYPE, ""); setlocale(LC_NUMERIC, "C"); /* for parsing cmdline & prog */ @@ -73,19 +123,29 @@ int main(int argc, char *argv[]) cmdname); exit(1); } - signal(SIGFPE, fpecatch); +#ifdef SA_SIGINFO + { + struct sigaction sa; + sa.sa_sigaction = fpecatch; + sa.sa_flags = SA_SIGINFO; + sigemptyset(&sa.sa_mask); + (void)sigaction(SIGFPE, &sa, NULL); + } +#else + (void)signal(SIGFPE, fpecatch); +#endif /*signal(SIGSEGV, segvcatch); experiment */ + /* Set and keep track of the random seed */ srand_seed = 1; srandom((unsigned long) srand_seed); yyin = NULL; symtab = makesymtab(NSYMTAB/NSYMTAB); while (argc > 1 && argv[1][0] == '-' && argv[1][1] != '\0') { - if (strcmp(argv[1],"-version") == 0 || strcmp(argv[1],"--version") == 0) { + if (strcmp(argv[1], "-version") == 0 || strcmp(argv[1], "--version") == 0) { printf("awk %s\n", version); - exit(0); - break; + return 0; } if (strcmp(argv[1], "--") == 0) { /* explicit end of args */ argc--; @@ -98,50 +158,26 @@ int main(int argc, char *argv[]) safe = true; break; case 'f': /* next argument is program filename */ - if (argv[1][2] != 0) { /* arg is -fsomething */ - if (npfile >= MAX_PFILE - 1) - FATAL("too many -f options"); - pfile[npfile++] = &argv[1][2]; - } else { /* arg is -f something */ - argc--; argv++; - if (argc <= 1) - FATAL("no program filename"); - if (npfile >= MAX_PFILE - 1) - FATAL("too many -f options"); - pfile[npfile++] = argv[1]; - } - break; + fn = getarg(&argc, &argv, "no program filename"); + if (npfile >= maxpfile) { + maxpfile += 20; + pfile = (char **) realloc(pfile, maxpfile * sizeof(*pfile)); + if (pfile == NULL) + FATAL("error allocating space for -f options"); + } + pfile[npfile++] = fn; + break; case 'F': /* set field separator */ - if (argv[1][2] != 0) { /* arg is -Fsomething */ - if (argv[1][2] == 't' && argv[1][3] == 0) /* wart: t=>\t */ - fs = "\t"; - else if (argv[1][2] != 0) - fs = &argv[1][2]; - } else { /* arg is -F something */ - argc--; argv++; - if (argc > 1 && argv[1][0] == 't' && argv[1][1] == 0) /* wart: t=>\t */ - fs = "\t"; - else if (argc > 1 && argv[1][0] != 0) - fs = &argv[1][0]; - } - if (fs == NULL || *fs == '\0') + fs = setfs(getarg(&argc, &argv, "no field separator")); + if (fs == NULL) WARNING("field separator FS is empty"); break; case 'v': /* -v a=1 to be done NOW. one -v for each */ - if (argv[1][2] != 0) { /* arg is -vsomething */ - if (isclvar(&argv[1][2])) - setclvar(&argv[1][2]); - else - FATAL("invalid -v option argument: %s", &argv[1][2]); - } else { /* arg is -v something */ - argc--; argv++; - if (argc <= 1) - FATAL("no variable name"); - if (isclvar(argv[1])) - setclvar(argv[1]); - else - FATAL("invalid -v option argument: %s", argv[1]); - } + vn = getarg(&argc, &argv, "no variable name"); + if (isclvar(vn)) + setclvar(vn); + else + FATAL("invalid -v option argument: %s", vn); break; case 'd': dbg = atoi(&argv[1][2]); @@ -163,7 +199,7 @@ int main(int argc, char *argv[]) exit(0); FATAL("no program given"); } - dprintf( ("program = |%s|\n", argv[1]) ); + DPRINTF("program = |%s|\n", argv[1]); lexprog = argv[1]; argc--; argv++; @@ -172,15 +208,19 @@ int main(int argc, char *argv[]) syminit(); compile_time = COMPILING; argv[0] = cmdname; /* put prog name at front of arglist */ - dprintf( ("argc=%d, argv[0]=%s\n", argc, argv[0]) ); + DPRINTF("argc=%d, argv[0]=%s\n", argc, argv[0]); arginit(argc, argv); if (!safe) envinit(environ); yyparse(); +#if 0 + // Doing this would comply with POSIX, but is not compatible with + // other awks and with what most users expect. So comment it out. setlocale(LC_NUMERIC, ""); /* back to whatever it is locally */ +#endif if (fs) *FS = qstring(fs, '\0'); - dprintf( ("errorflag=%d\n", errorflag) ); + DPRINTF("errorflag=%d\n", errorflag); if (errorflag == 0) { compile_time = RUNNING; run(winner); @@ -215,7 +255,7 @@ int pgetc(void) /* get 1 character from awk program */ char *cursource(void) /* current source file name */ { if (npfile > 0) - return pfile[curpfile]; + return pfile[curpfile < npfile ? curpfile : curpfile - 1]; else return NULL; } @@ -34,54 +34,43 @@ CFLAGS = -O2 HOSTCC = gcc -g -Wall -pedantic -Wcast-qual CC = $(HOSTCC) # change this is cross-compiling. -# yacc options. pick one; this varies a lot by system. -#YFLAGS = -d -S -YACC = bison -d -y -#YACC = yacc -d -# -S uses sprintf in yacc parser instead of sprint +# By fiat, to make our lives easier, yacc is now defined to be bison. +# If you want something else, you're on your own. +YACC = bison -d OFILES = b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o -SOURCE = awk.h ytab.c ytab.h proto.h awkgram.y lex.c b.c main.c \ +SOURCE = awk.h awkgram.tab.c awkgram.tab.h proto.h awkgram.y lex.c b.c main.c \ maketab.c parse.c lib.c run.c tran.c proctab.c LISTING = awk.h proto.h awkgram.y lex.c b.c main.c maketab.c parse.c \ lib.c run.c tran.c -SHIP = README LICENSE FIXES $(SOURCE) ytab[ch].bak makefile \ +SHIP = README LICENSE FIXES $(SOURCE) awkgram.tab.[ch].bak makefile \ awk.1 -a.out: ytab.o $(OFILES) - $(CC) $(CFLAGS) ytab.o $(OFILES) $(ALLOC) -lm +a.out: awkgram.tab.o $(OFILES) + $(CC) $(CFLAGS) awkgram.tab.o $(OFILES) $(ALLOC) -lm -$(OFILES): awk.h ytab.h proto.h +$(OFILES): awk.h awkgram.tab.h proto.h -#Clear dependency for parallel build: (make -j) -#YACC generated y.tab.c and y.tab.h at the same time -#this needs to be a static pattern rules otherwise multiple target -#are mapped onto multiple executions of yacc, which overwrite -#each others outputs. -y%.c y%.h: awk.h proto.h awkgram.y +awkgram.tab.c awkgram.tab.h: awk.h proto.h awkgram.y $(YACC) $(YFLAGS) awkgram.y - mv y.$*.c y$*.c - mv y.$*.h y$*.h - -ytab.h: ytab.c proctab.c: maketab - ./maketab ytab.h >proctab.c + ./maketab awkgram.tab.h >proctab.c -maketab: ytab.h maketab.c +maketab: awkgram.tab.h maketab.c $(HOSTCC) $(CFLAGS) maketab.c -o maketab bundle: - @cp ytab.h ytabh.bak - @cp ytab.c ytabc.bak + @cp awkgram.tab.h awkgram.tab.h.bak + @cp awkgram.tab.c awkgram.tab.c.bak @bundle $(SHIP) tar: - @cp ytab.h ytabh.bak - @cp ytab.c ytabc.bak + @cp awkgram.tab.h awkgram.tab.h.bak + @cp awkgram.tab.c awkgram.tab.c.bak @bundle $(SHIP) >awk.shar @tar cf awk.tar $(SHIP) gzip awk.tar @@ -110,13 +99,13 @@ clean: testclean rm -f a.out *.o *.obj maketab maketab.exe *.bb *.bbg *.da *.gcov *.gcno *.gcda # proctab.c cleaner: testclean - rm -f a.out *.o *.obj maketab maketab.exe *.bb *.bbg *.da *.gcov *.gcno *.gcda proctab.c ytab* + rm -f a.out *.o *.obj maketab maketab.exe *.bb *.bbg *.da *.gcov *.gcno *.gcda proctab.c awkgram.tab.* # This is a bit of a band-aid until we can invest some more time # in the test suite. testclean: - cd testdir; rm -fr arnold-fixes beebe echo foo* \ + cd testdir; rm -fr arnold-fixes beebe devnull echo foo* \ glop glop1 glop2 lilly.diff tempbig tempsmall time # For the habits of GNU maintainers: -distclean: clean +distclean: cleaner @@ -25,14 +25,14 @@ THIS SOFTWARE. /* * this program makes the table to link function names * and type indices that is used by execute() in run.c. - * it finds the indices in ytab.h, produced by yacc. + * it finds the indices in awkgram.tab.h, produced by bison. */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include "awk.h" -#include "ytab.h" +#include "awkgram.tab.h" struct xx { int token; @@ -118,10 +118,11 @@ int main(int argc, char *argv[]) char c; FILE *fp; char buf[200], name[200], def[200]; + enum { TOK_UNKNOWN, TOK_ENUM, TOK_DEFINE } tokentype = TOK_UNKNOWN; printf("#include <stdio.h>\n"); printf("#include \"awk.h\"\n"); - printf("#include \"ytab.h\"\n\n"); + printf("#include \"awkgram.tab.h\"\n\n"); if (argc != 2) { fprintf(stderr, "usage: maketab YTAB_H\n"); @@ -135,12 +136,28 @@ int main(int argc, char *argv[]) i = 0; while (fgets(buf, sizeof buf, fp) != NULL) { // 199 is sizeof(def) - 1 - n = sscanf(buf, "%1c %199s %199s %d", &c, def, name, &tok); - if (c != '#' || (n != 4 && strcmp(def,"define") != 0)) /* not a valid #define */ - continue; - if (strcmp(name, "YYSTYPE_IS_DECLARED") == 0) + if (tokentype != TOK_ENUM) { + n = sscanf(buf, "%1c %199s %199s %d", &c, def, name, + &tok); + if (n == 4 && c == '#' && strcmp(def, "define") == 0) { + tokentype = TOK_DEFINE; + } else if (tokentype != TOK_UNKNOWN) { + continue; + } + } + if (tokentype != TOK_DEFINE) { + /* not a valid #define, bison uses enums now */ + n = sscanf(buf, "%199s = %d,\n", name, &tok); + if (n != 2) + continue; + tokentype = TOK_ENUM; + } + if (strcmp(name, "YYSTYPE_IS_DECLARED") == 0) { + tokentype = TOK_UNKNOWN; continue; + } if (tok < FIRSTTOKEN || tok > LASTTOKEN) { + tokentype = TOK_UNKNOWN; /* fprintf(stderr, "maketab funny token %d %s ignored\n", tok, buf); */ continue; } @@ -27,13 +27,13 @@ THIS SOFTWARE. #include <string.h> #include <stdlib.h> #include "awk.h" -#include "ytab.h" +#include "awkgram.tab.h" Node *nodealloc(int n) { Node *x; - x = malloc(sizeof(*x) + (n-1) * sizeof(x)); + x = (Node *) malloc(sizeof(*x) + (n-1) * sizeof(x)); if (x == NULL) FATAL("out of space in nodealloc"); x->nnext = NULL; @@ -250,7 +250,7 @@ void defn(Cell *v, Node *vl, Node *st) /* turn on FCN bit in definition, */ for (p = vl; p; p = p->nnext) n++; v->fval = n; - dprintf( ("defining func %s (%d args)\n", v->nval, n) ); + DPRINTF("defining func %s (%d args)\n", v->nval, n); } int isarg(const char *s) /* is s in argument list for current function? */ diff --git a/proctab.c b/proctab.c deleted file mode 100644 index 5ae6786..0000000 --- a/proctab.c +++ /dev/null @@ -1,211 +0,0 @@ -#include <stdio.h> -#include "awk.h" -#include "ytab.h" - -static const char * const printname[95] = { - "FIRSTTOKEN", /* 258 */ - "PROGRAM", /* 259 */ - "PASTAT", /* 260 */ - "PASTAT2", /* 261 */ - "XBEGIN", /* 262 */ - "XEND", /* 263 */ - "NL", /* 264 */ - "ARRAY", /* 265 */ - "MATCH", /* 266 */ - "NOTMATCH", /* 267 */ - "MATCHOP", /* 268 */ - "FINAL", /* 269 */ - "DOT", /* 270 */ - "ALL", /* 271 */ - "CCL", /* 272 */ - "NCCL", /* 273 */ - "CHAR", /* 274 */ - "OR", /* 275 */ - "STAR", /* 276 */ - "QUEST", /* 277 */ - "PLUS", /* 278 */ - "EMPTYRE", /* 279 */ - "ZERO", /* 280 */ - "AND", /* 281 */ - "BOR", /* 282 */ - "APPEND", /* 283 */ - "EQ", /* 284 */ - "GE", /* 285 */ - "GT", /* 286 */ - "LE", /* 287 */ - "LT", /* 288 */ - "NE", /* 289 */ - "IN", /* 290 */ - "ARG", /* 291 */ - "BLTIN", /* 292 */ - "BREAK", /* 293 */ - "CLOSE", /* 294 */ - "CONTINUE", /* 295 */ - "DELETE", /* 296 */ - "DO", /* 297 */ - "EXIT", /* 298 */ - "FOR", /* 299 */ - "FUNC", /* 300 */ - "SUB", /* 301 */ - "GSUB", /* 302 */ - "IF", /* 303 */ - "INDEX", /* 304 */ - "LSUBSTR", /* 305 */ - "MATCHFCN", /* 306 */ - "NEXT", /* 307 */ - "NEXTFILE", /* 308 */ - "ADD", /* 309 */ - "MINUS", /* 310 */ - "MULT", /* 311 */ - "DIVIDE", /* 312 */ - "MOD", /* 313 */ - "ASSIGN", /* 314 */ - "ASGNOP", /* 315 */ - "ADDEQ", /* 316 */ - "SUBEQ", /* 317 */ - "MULTEQ", /* 318 */ - "DIVEQ", /* 319 */ - "MODEQ", /* 320 */ - "POWEQ", /* 321 */ - "PRINT", /* 322 */ - "PRINTF", /* 323 */ - "SPRINTF", /* 324 */ - "ELSE", /* 325 */ - "INTEST", /* 326 */ - "CONDEXPR", /* 327 */ - "POSTINCR", /* 328 */ - "PREINCR", /* 329 */ - "POSTDECR", /* 330 */ - "PREDECR", /* 331 */ - "VAR", /* 332 */ - "IVAR", /* 333 */ - "VARNF", /* 334 */ - "CALL", /* 335 */ - "NUMBER", /* 336 */ - "STRING", /* 337 */ - "REGEXPR", /* 338 */ - "GETLINE", /* 339 */ - "RETURN", /* 340 */ - "SPLIT", /* 341 */ - "SUBSTR", /* 342 */ - "WHILE", /* 343 */ - "CAT", /* 344 */ - "NOT", /* 345 */ - "UMINUS", /* 346 */ - "UPLUS", /* 347 */ - "POWER", /* 348 */ - "DECR", /* 349 */ - "INCR", /* 350 */ - "INDIRECT", /* 351 */ - "LASTTOKEN", /* 352 */ -}; - - -Cell *(*proctab[95])(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 */ - nullproc, /* EMPTYRE */ - nullproc, /* ZERO */ - 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 */ - awkgetline, /* GETLINE */ - jump, /* RETURN */ - split, /* SPLIT */ - substr, /* SUBSTR */ - whilestat, /* WHILE */ - cat, /* CAT */ - boolop, /* NOT */ - arith, /* UMINUS */ - arith, /* UPLUS */ - arith, /* POWER */ - nullproc, /* DECR */ - nullproc, /* INCR */ - indirect, /* INDIRECT */ - nullproc, /* LASTTOKEN */ -}; - -const char *tokname(int n) -{ - static char buf[100]; - - if (n < FIRSTTOKEN || n > LASTTOKEN) { - snprintf(buf, sizeof(buf), "token %d", n); - return buf; - } - return printname[n-FIRSTTOKEN]; -} @@ -46,7 +46,7 @@ extern void freetr(Node *); extern int hexstr(const uschar **); extern int quoted(const uschar **); extern char *cclenter(const char *); -extern void overflo(const char *) __attribute__((__noreturn__)); +extern noreturn void overflo(const char *); extern void cfoll(fa *, Node *); extern int first(Node *); extern void follow(Node *); @@ -122,7 +122,7 @@ extern void growfldtab(int n); extern void savefs(void); extern int getrec(char **, int *, bool); extern void nextfile(void); -extern int readrec(char **buf, int *bufsize, FILE *inf); +extern int readrec(char **buf, int *bufsize, FILE *inf, bool isnew); extern char *getargv(int); extern void setclvar(char *); extern void fldbld(void); @@ -133,13 +133,12 @@ extern int refldbld(const char *, const char *); extern void recbld(void); extern Cell *fieldadr(int); extern void yyerror(const char *); -extern void fpecatch(int); extern void bracecheck(void); extern void bcheck2(int, int, int); extern void SYNTAX(const char *, ...) __attribute__((__format__(__printf__, 1, 2))); -extern void FATAL(const char *, ...) - __attribute__((__format__(__printf__, 1, 2), __noreturn__)); +extern noreturn void FATAL(const char *, ...) + __attribute__((__format__(__printf__, 1, 2))); extern void WARNING(const char *, ...) __attribute__((__format__(__printf__, 1, 2))); extern void error(void); @@ -147,7 +146,9 @@ extern void eprint(void); extern void bclass(int); extern double errcheck(double, const char *); extern int isclvar(const char *); -extern int is_number(const char *); +extern bool is_valid_number(const char *s, bool trailing_stuff_ok, + bool *no_trailing, double *result); +#define is_number(s, val) is_valid_number(s, false, NULL, val) extern int adjbuf(char **pb, int *sz, int min, int q, char **pbp, const char *what); extern void run(Node *); @@ -192,7 +193,7 @@ extern Cell *bltin(Node **, int); extern Cell *printstat(Node **, int); extern Cell *nullproc(Node **, int); extern FILE *redirect(int, Node *); -extern FILE *openfile(int, const char *); +extern FILE *openfile(int, const char *, bool *); extern const char *filename(FILE *); extern Cell *closefile(Node **, int); extern void closeall(void); @@ -25,6 +25,7 @@ THIS SOFTWARE. #define DEBUG #include <stdio.h> #include <ctype.h> +#include <errno.h> #include <wchar.h> #include <wctype.h> #include <fcntl.h> @@ -37,7 +38,7 @@ THIS SOFTWARE. #include <sys/types.h> #include <sys/wait.h> #include "awk.h" -#include "ytab.h" +#include "awkgram.tab.h" static void stdinit(void); static void flush_all(void); @@ -77,23 +78,23 @@ extern Awkfloat srand_seed; Node *winner = NULL; /* root of parse tree */ Cell *tmps; /* free temporary cells for execution */ -static Cell truecell ={ OBOOL, BTRUE, 0, 0, 1.0, NUM, NULL }; +static Cell truecell ={ OBOOL, BTRUE, 0, 0, 1.0, NUM, NULL, NULL }; Cell *True = &truecell; -static Cell falsecell ={ OBOOL, BFALSE, 0, 0, 0.0, NUM, NULL }; +static Cell falsecell ={ OBOOL, BFALSE, 0, 0, 0.0, NUM, NULL, NULL }; Cell *False = &falsecell; -static Cell breakcell ={ OJUMP, JBREAK, 0, 0, 0.0, NUM, NULL }; +static Cell breakcell ={ OJUMP, JBREAK, 0, 0, 0.0, NUM, NULL, NULL }; Cell *jbreak = &breakcell; -static Cell contcell ={ OJUMP, JCONT, 0, 0, 0.0, NUM, NULL }; +static Cell contcell ={ OJUMP, JCONT, 0, 0, 0.0, NUM, NULL, NULL }; Cell *jcont = &contcell; -static Cell nextcell ={ OJUMP, JNEXT, 0, 0, 0.0, NUM, NULL }; +static Cell nextcell ={ OJUMP, JNEXT, 0, 0, 0.0, NUM, NULL, NULL }; Cell *jnext = &nextcell; -static Cell nextfilecell ={ OJUMP, JNEXTFILE, 0, 0, 0.0, NUM, NULL }; +static Cell nextfilecell ={ OJUMP, JNEXTFILE, 0, 0, 0.0, NUM, NULL, NULL }; Cell *jnextfile = &nextfilecell; -static Cell exitcell ={ OJUMP, JEXIT, 0, 0, 0.0, NUM, NULL }; +static Cell exitcell ={ OJUMP, JEXIT, 0, 0, 0.0, NUM, NULL, NULL }; Cell *jexit = &exitcell; -static Cell retcell ={ OJUMP, JRET, 0, 0, 0.0, NUM, NULL }; +static Cell retcell ={ OJUMP, JRET, 0, 0, 0.0, NUM, NULL, NULL }; Cell *jret = &retcell; -static Cell tempcell ={ OCELL, CTEMP, 0, EMPTY, 0.0, NUM|STR|DONTFREE, NULL }; +static Cell tempcell ={ OCELL, CTEMP, 0, EMPTY, 0.0, NUM|STR|DONTFREE, NULL, NULL }; Node *curnode = NULL; /* the node being executed, for debugging */ @@ -117,8 +118,8 @@ int adjbuf(char **pbuf, int *psiz, int minlen, int quantum, char **pbptr, /* round up to next multiple of quantum */ if (rminlen) minlen += quantum - rminlen; - tbuf = realloc(*pbuf, minlen); - dprintf( ("adjbuf %s: %d %d (pbuf=%p, tbuf=%p)\n", whatrtn, *psiz, minlen, *pbuf, tbuf) ); + tbuf = (char *) realloc(*pbuf, minlen); + DPRINTF("adjbuf %s: %d %d (pbuf=%p, tbuf=%p)\n", whatrtn, *psiz, minlen, (void*)*pbuf, (void*)tbuf); if (tbuf == NULL) { if (whatrtn) FATAL("out of memory in %s", whatrtn); @@ -226,7 +227,7 @@ struct Frame *frp = NULL; /* frame pointer. bottom level unused */ Cell *call(Node **a, int n) /* function call. very kludgy and fragile */ { - static const Cell newcopycell = { OCELL, CCOPY, 0, EMPTY, 0.0, NUM|STR|DONTFREE, NULL }; + static const Cell newcopycell = { OCELL, CCOPY, 0, EMPTY, 0.0, NUM|STR|DONTFREE, NULL, NULL }; int i, ncall, ndef; int freed = 0; /* handles potential double freeing when fcn & param share a tempcell */ Node *x; @@ -239,25 +240,25 @@ Cell *call(Node **a, int n) /* function call. very kludgy and fragile */ if (!isfcn(fcn)) FATAL("calling undefined function %s", s); if (frame == NULL) { - frp = frame = calloc(nframe += 100, sizeof(*frame)); + frp = frame = (struct Frame *) calloc(nframe += 100, sizeof(*frame)); if (frame == NULL) FATAL("out of space for stack frames calling %s", s); } for (ncall = 0, x = a[1]; x != NULL; x = x->nnext) /* args in call */ ncall++; ndef = (int) fcn->fval; /* args in defn */ - dprintf( ("calling %s, %d args (%d in defn), frp=%d\n", s, ncall, ndef, (int) (frp-frame)) ); + DPRINTF("calling %s, %d args (%d in defn), frp=%d\n", s, ncall, ndef, (int) (frp-frame)); if (ncall > ndef) WARNING("function %s called with %d args, uses only %d", s, ncall, ndef); if (ncall + ndef > NARGS) FATAL("function %s has %d arguments, limit %d", s, ncall+ndef, NARGS); for (i = 0, x = a[1]; x != NULL; i++, x = x->nnext) { /* get call args */ - dprintf( ("evaluate args[%d], frp=%d:\n", i, (int) (frp-frame)) ); + DPRINTF("evaluate args[%d], frp=%d:\n", i, (int) (frp-frame)); y = execute(x); oargs[i] = y; - dprintf( ("args[%d]: %s %f <%s>, t=%o\n", - i, NN(y->nval), y->fval, isarr(y) ? "(array)" : NN(y->sval), y->tval) ); + DPRINTF("args[%d]: %s %f <%s>, t=%o\n", + i, NN(y->nval), y->fval, isarr(y) ? "(array)" : NN(y->sval), y->tval); if (isfcn(y)) FATAL("can't use function %s as argument in %s", y->nval, s); if (isarr(y)) @@ -273,7 +274,7 @@ Cell *call(Node **a, int n) /* function call. very kludgy and fragile */ frp++; /* now ok to up frame */ if (frp >= frame + nframe) { int dfp = frp - frame; /* old index */ - frame = realloc(frame, (nframe += 100) * sizeof(*frame)); + frame = (struct Frame *) realloc(frame, (nframe += 100) * sizeof(*frame)); if (frame == NULL) FATAL("out of space for stack frames in %s", s); frp = frame + dfp; @@ -283,9 +284,9 @@ Cell *call(Node **a, int n) /* function call. very kludgy and fragile */ frp->nargs = ndef; /* number defined with (excess are locals) */ frp->retval = gettemp(); - dprintf( ("start exec of %s, frp=%d\n", s, (int) (frp-frame)) ); + DPRINTF("start exec of %s, frp=%d\n", s, (int) (frp-frame)); y = execute((Node *)(fcn->sval)); /* execute body */ - dprintf( ("finished exec of %s, frp=%d\n", s, (int) (frp-frame)) ); + DPRINTF("finished exec of %s, frp=%d\n", s, (int) (frp-frame)); for (i = 0; i < ndef; i++) { Cell *t = frp->args[i]; @@ -318,7 +319,7 @@ Cell *call(Node **a, int n) /* function call. very kludgy and fragile */ tempfree(y); /* don't free twice! */ } z = frp->retval; /* return value */ - dprintf( ("%s returns %g |%s| %o\n", s, getfval(z), getsval(z), z->tval) ); + DPRINTF("%s returns %g |%s| %o\n", s, getfval(z), getsval(z), z->tval); frp--; return(z); } @@ -346,7 +347,7 @@ Cell *arg(Node **a, int n) /* nth argument of a function */ { n = ptoi(a[0]); /* argument number, counting from 0 */ - dprintf( ("arg(%d), frp->nargs=%d\n", n, frp->nargs) ); + DPRINTF("arg(%d), frp->nargs=%d\n", n, frp->nargs); if (n+1 > frp->nargs) FATAL("argument #%d of function %s was not supplied", n+1, frp->fcncell->nval); @@ -405,8 +406,10 @@ Cell *awkgetline(Node **a, int n) /* get next line from specific input */ char *buf; int bufsize = recsize; int mode; + bool newflag; + double result; - if ((buf = malloc(bufsize)) == NULL) + if ((buf = (char *) malloc(bufsize)) == NULL) FATAL("out of memory in getline"); fflush(stdout); /* in case someone is waiting for a prompt */ @@ -416,26 +419,26 @@ Cell *awkgetline(Node **a, int n) /* get next line from specific input */ mode = ptoi(a[1]); if (mode == '|') /* input pipe */ mode = LE; /* arbitrary flag */ - fp = openfile(mode, getsval(x)); + fp = openfile(mode, getsval(x), &newflag); tempfree(x); if (fp == NULL) n = -1; else - n = readrec(&buf, &bufsize, fp); + n = readrec(&buf, &bufsize, fp, newflag); if (n <= 0) { ; } else if (a[0] != NULL) { /* getline var <file */ x = execute(a[0]); setsval(x, buf); - if (is_number(x->sval)) { - x->fval = atof(x->sval); + if (is_number(x->sval, & result)) { + x->fval = result; x->tval |= NUM; } tempfree(x); } else { /* getline <file */ setsval(fldtab[0], buf); - if (is_number(fldtab[0]->sval)) { - fldtab[0]->fval = atof(fldtab[0]->sval); + if (is_number(fldtab[0]->sval, & result)) { + fldtab[0]->fval = result; fldtab[0]->tval |= NUM; } } @@ -446,8 +449,8 @@ Cell *awkgetline(Node **a, int n) /* get next line from specific input */ n = getrec(&buf, &bufsize, false); x = execute(a[0]); setsval(x, buf); - if (is_number(x->sval)) { - x->fval = atof(x->sval); + if (is_number(x->sval, & result)) { + x->fval = result; x->tval |= NUM; } tempfree(x); @@ -470,19 +473,19 @@ makearraystring(Node *p, const char *func) { char *buf; int bufsz = recsize; - size_t blen, seplen; + size_t blen; - if ((buf = malloc(bufsz)) == NULL) { + if ((buf = (char *) malloc(bufsz)) == NULL) { FATAL("%s: out of memory", func); } blen = 0; buf[blen] = '\0'; - seplen = strlen(getsval(subseploc)); for (; p; p = p->nnext) { Cell *x = execute(p); /* expr */ char *s = getsval(x); + size_t seplen = strlen(getsval(subseploc)); size_t nsub = p->nnext ? seplen : 0; size_t slen = strlen(s); size_t tlen = blen + slen + nsub; @@ -510,7 +513,7 @@ Cell *array(Node **a, int n) /* a[0] is symtab, a[1] is list of subscripts */ x = execute(a[0]); /* Cell* for symbol table */ buf = makearraystring(a[1], __func__); if (!isarr(x)) { - dprintf( ("making %s into an array\n", NN(x->nval)) ); + DPRINTF("making %s into an array\n", NN(x->nval)); if (freeable(x)) xfree(x->sval); x->tval &= ~(STR|NUM|DONTFREE); @@ -556,7 +559,7 @@ Cell *intest(Node **a, int n) /* a[0] is index (list), a[1] is symtab */ ap = execute(a[1]); /* array name */ if (!isarr(ap)) { - dprintf( ("making %s into an array\n", ap->nval) ); + DPRINTF("making %s into an array\n", ap->nval); if (freeable(ap)) xfree(ap->sval); ap->tval &= ~(STR|NUM|DONTFREE); @@ -685,7 +688,7 @@ Cell *relop(Node **a, int n) /* a[0 < a[1], etc. */ void tfree(Cell *a) /* free a tempcell */ { if (freeable(a)) { - dprintf( ("freeing %s %s %o\n", NN(a->nval), NN(a->sval), a->tval) ); + DPRINTF("freeing %s %s %o\n", NN(a->nval), NN(a->sval), a->tval); xfree(a->sval); } if (a == tmps) @@ -699,7 +702,7 @@ Cell *gettemp(void) /* get a tempcell */ Cell *x; if (!tmps) { - tmps = calloc(100, sizeof(*tmps)); + tmps = (Cell *) calloc(100, sizeof(*tmps)); if (!tmps) FATAL("out of space for temporaries"); for (i = 1; i < 100; i++) @@ -724,7 +727,7 @@ Cell *indirect(Node **a, int n) /* $( a[0] ) */ if ((Awkfloat)INT_MAX < val) FATAL("trying to access out of range field %s", x->nval); m = (int) val; - if (m == 0 && !is_number(s = getsval(x))) /* suspicion! */ + if (m == 0 && !is_number(s = getsval(x), NULL)) /* suspicion! */ FATAL("illegal field $(%s), name \"%s\"", s, x->nval); /* BUG: can x->nval ever be null??? */ tempfree(x); @@ -772,7 +775,7 @@ Cell *substr(Node **a, int nnn) /* substr(a[0], a[1], a[2]) */ n = 0; else if (n > k - m) n = k - m; - dprintf( ("substr: m=%d, n=%d, s=%s\n", m, n, s) ); + DPRINTF("substr: m=%d, n=%d, s=%s\n", m, n, s); y = gettemp(); temp = s[n+m-1]; /* with thanks to John Linderman */ s[n+m-1] = '\0'; @@ -828,16 +831,16 @@ int format(char **pbuf, int *pbufsize, const char *s, Node *a) /* printf-like co static bool have_a_format = false; if (first) { - char buf[100]; + char xbuf[100]; - snprintf(buf, sizeof(buf), "%a", 42.0); - have_a_format = (strcmp(buf, "0x1.5p+5") == 0); + snprintf(xbuf, sizeof(xbuf), "%a", 42.0); + have_a_format = (strcmp(xbuf, "0x1.5p+5") == 0); first = false; } os = s; p = buf; - if ((fmt = malloc(fmtsz)) == NULL) + if ((fmt = (char *) malloc(fmtsz)) == NULL) FATAL("out of memory in format()"); while (*s) { adjbuf(&buf, &bufsize, MAXNUMSIZE+1+p-buf, recsize, &p, "format1"); @@ -980,7 +983,7 @@ Cell *awksprintf(Node **a, int n) /* sprintf(a[0]) */ char *buf; int bufsz=3*recsize; - if ((buf = malloc(bufsz)) == NULL) + if ((buf = (char *) malloc(bufsz)) == NULL) FATAL("out of memory in awksprintf"); y = a[0]->nnext; x = execute(a[0]); @@ -1003,7 +1006,7 @@ Cell *awkprintf(Node **a, int n) /* printf */ int len; int bufsz=3*recsize; - if ((buf = malloc(bufsz)) == NULL) + if ((buf = (char *) malloc(bufsz)) == NULL) FATAL("out of memory in awkprintf"); y = a[0]->nnext; x = execute(a[0]); @@ -1071,8 +1074,10 @@ Cell *arith(Node **a, int n) /* a[0] + a[1], etc. also -a[0] */ case POWER: if (j >= 0 && modf(j, &v) == 0.0) /* pos integer exponent */ i = ipow(i, (int) j); - else + else { + errno = 0; i = errcheck(pow(i, j), "pow"); + } break; default: /* can't happen */ FATAL("illegal arithmetic operator %d", n); @@ -1165,8 +1170,10 @@ Cell *assign(Node **a, int n) /* a[0] = a[1], a[0] += a[1], etc. */ case POWEQ: if (yf >= 0 && modf(yf, &v) == 0.0) /* pos integer exponent */ xf = ipow(xf, (int) yf); - else + else { + errno = 0; xf = errcheck(pow(xf, yf), "pow"); + } break; default: FATAL("illegal assignment operator %d", n); @@ -1186,12 +1193,12 @@ Cell *cat(Node **a, int q) /* a[0] cat a[1] */ x = execute(a[0]); n1 = strlen(getsval(x)); + adjbuf(&s, &ssz, n1, recsize, 0, "cat1"); + memcpy(s, x->sval, n1); y = execute(a[1]); n2 = strlen(getsval(y)); - - adjbuf(&s, &ssz, n1 + n2 + 1, recsize, 0, "cat"); - memcpy(s, x->sval, n1); + adjbuf(&s, &ssz, n1 + n2 + 1, recsize, 0, "cat2"); memcpy(s + n1, y->sval, n2); s[n1 + n2] = '\0'; @@ -1253,6 +1260,7 @@ Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */ int sep; char temp, num[50]; int n, tempstat, arg3type; + double result; y = execute(a[0]); /* source string */ origs = s = strdup(getsval(y)); @@ -1270,7 +1278,7 @@ Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */ sep = *fs; ap = execute(a[1]); /* array name */ freesymtab(ap); - dprintf( ("split: s=|%s|, a=%s, sep=|%s|\n", s, NN(ap->nval), fs) ); + DPRINTF("split: s=|%s|, a=%s, sep=|%s|\n", s, NN(ap->nval), fs); ap->tval &= ~STR; ap->tval |= ARR; ap->sval = (char *) makesymtab(NSYMTAB); @@ -1297,8 +1305,8 @@ Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */ snprintf(num, sizeof(num), "%d", n); temp = *patbeg; setptr(patbeg, '\0'); - if (is_number(s)) - setsymtab(num, s, atof(s), STR|NUM, (Array *) ap->sval); + if (is_number(s, & result)) + setsymtab(num, s, result, STR|NUM, (Array *) ap->sval); else setsymtab(num, s, 0.0, STR, (Array *) ap->sval); setptr(patbeg, temp); @@ -1316,8 +1324,8 @@ Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */ } n++; snprintf(num, sizeof(num), "%d", n); - if (is_number(s)) - setsymtab(num, s, atof(s), STR|NUM, (Array *) ap->sval); + if (is_number(s, & result)) + setsymtab(num, s, result, STR|NUM, (Array *) ap->sval); else setsymtab(num, s, 0.0, STR, (Array *) ap->sval); spdone: @@ -1337,8 +1345,8 @@ Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */ temp = *s; setptr(s, '\0'); snprintf(num, sizeof(num), "%d", n); - if (is_number(t)) - setsymtab(num, t, atof(t), STR|NUM, (Array *) ap->sval); + if (is_number(t, & result)) + setsymtab(num, t, result, STR|NUM, (Array *) ap->sval); else setsymtab(num, t, 0.0, STR, (Array *) ap->sval); setptr(s, temp); @@ -1366,8 +1374,8 @@ Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */ temp = *s; setptr(s, '\0'); snprintf(num, sizeof(num), "%d", n); - if (is_number(t)) - setsymtab(num, t, atof(t), STR|NUM, (Array *) ap->sval); + if (is_number(t, & result)) + setsymtab(num, t, result, STR|NUM, (Array *) ap->sval); else setsymtab(num, t, 0.0, STR, (Array *) ap->sval); setptr(s, temp); @@ -1515,7 +1523,6 @@ static char *nawk_convert(const char *s, int (*fun_c)(int), char *pbuf = NULL; const char *ps = NULL; size_t n = 0; - mbstate_t mbs, mbs2; wchar_t wc; size_t sz = MB_CUR_MAX; @@ -1530,17 +1537,24 @@ static char *nawk_convert(const char *s, int (*fun_c)(int), /* upper/lower character may be shorter/longer */ buf = tostringN(s, strlen(s) * sz + 1); - memset(&mbs, 0, sizeof(mbs)); - memset(&mbs2, 0, sizeof(mbs2)); + (void) mbtowc(NULL, NULL, 0); /* reset internal state */ + /* + * Reset internal state here too. + * Assign result to avoid a compiler warning. (Casting to void + * doesn't work.) + * Increment said variable to avoid a different warning. + */ + int unused = wctomb(NULL, L'\0'); + unused++; ps = s; pbuf = buf; - while (n = mbrtowc(&wc, ps, sz, &mbs), + while (n = mbtowc(&wc, ps, sz), n > 0 && n != (size_t)-1 && n != (size_t)-2) { ps += n; - n = wcrtomb(pbuf, fun_wc(wc), &mbs2); + n = wctomb(pbuf, fun_wc(wc)); if (n == (size_t)-1) FATAL("illegal wide character %s", s); @@ -1556,6 +1570,24 @@ static char *nawk_convert(const char *s, int (*fun_c)(int), } } +#ifdef __DJGPP__ +static wint_t towupper(wint_t wc) +{ + if (wc >= 0 && wc < 256) + return toupper(wc & 0xFF); + + return wc; +} + +static wint_t towlower(wint_t wc) +{ + if (wc >= 0 && wc < 256) + return tolower(wc & 0xFF); + + return wc; +} +#endif + static char *nawk_toupper(const char *s) { return nawk_convert(s, toupper, towupper); @@ -1588,13 +1620,19 @@ Cell *bltin(Node **a, int n) /* builtin functions. a[0] is type, a[1] is arg lis u = strlen(getsval(x)); break; case FLOG: - u = errcheck(log(getfval(x)), "log"); break; + errno = 0; + u = errcheck(log(getfval(x)), "log"); + break; case FINT: modf(getfval(x), &u); break; case FEXP: - u = errcheck(exp(getfval(x)), "exp"); break; + errno = 0; + u = errcheck(exp(getfval(x)), "exp"); + break; case FSQRT: - u = errcheck(sqrt(getfval(x)), "sqrt"); break; + errno = 0; + u = errcheck(sqrt(getfval(x)), "sqrt"); + break; case FSIN: u = sin(getfval(x)); break; case FCOS: @@ -1658,7 +1696,7 @@ Cell *bltin(Node **a, int n) /* builtin functions. a[0] is type, a[1] is arg lis if (isrec(x) || strlen(getsval(x)) == 0) { flush_all(); /* fflush() or fflush("") -> all */ u = 0; - } else if ((fp = openfile(FFLUSH, getsval(x))) == NULL) + } else if ((fp = openfile(FFLUSH, getsval(x), NULL)) == NULL) u = EOF; else u = fflush(fp); @@ -1718,7 +1756,7 @@ FILE *redirect(int a, Node *b) /* set up all i/o redirections */ x = execute(b); fname = getsval(x); - fp = openfile(a, fname); + fp = openfile(a, fname, NULL); if (fp == NULL) FATAL("can't open file %s", fname); tempfree(x); @@ -1736,7 +1774,7 @@ size_t nfiles; static void stdinit(void) /* in case stdin, etc., are not constants */ { nfiles = FOPEN_MAX; - files = calloc(nfiles, sizeof(*files)); + files = (struct files *) calloc(nfiles, sizeof(*files)); if (files == NULL) FATAL("can't allocate file memory for %zu files", nfiles); files[0].fp = stdin; @@ -1750,7 +1788,7 @@ static void stdinit(void) /* in case stdin, etc., are not constants */ files[2].mode = GT; } -FILE *openfile(int a, const char *us) +FILE *openfile(int a, const char *us, bool *pnewflag) { const char *s = us; size_t i; @@ -1760,11 +1798,12 @@ FILE *openfile(int a, const char *us) if (*s == '\0') FATAL("null file name in print or getline"); for (i = 0; i < nfiles; i++) - if (files[i].fname && strcmp(s, files[i].fname) == 0) { - if (a == files[i].mode || (a==APPEND && files[i].mode==GT)) - return files[i].fp; - if (a == FFLUSH) - return files[i].fp; + if (files[i].fname && strcmp(s, files[i].fname) == 0 && + (a == files[i].mode || (a==APPEND && files[i].mode==GT) || + a == FFLUSH)) { + if (pnewflag) + *pnewflag = false; + return files[i].fp; } if (a == FFLUSH) /* didn't find it, so don't create it! */ return NULL; @@ -1775,7 +1814,7 @@ FILE *openfile(int a, const char *us) if (i >= nfiles) { struct files *nf; size_t nnf = nfiles + FOPEN_MAX; - nf = realloc(files, nnf * sizeof(*nf)); + nf = (struct files *) realloc(files, nnf * sizeof(*nf)); if (nf == NULL) FATAL("cannot grow files for %s and %zu files", s, nnf); memset(&nf[nfiles], 0, FOPEN_MAX * sizeof(*nf)); @@ -1801,6 +1840,8 @@ FILE *openfile(int a, const char *us) files[i].fname = tostring(s); files[i].fp = fp; files[i].mode = m; + if (pnewflag) + *pnewflag = true; if (fp != stdin && fp != stdout && fp != stderr) (void) fcntl(fileno(fp), F_SETFD, FD_CLOEXEC); } @@ -1822,7 +1863,7 @@ const char *filename(FILE *fp) Cell *x; size_t i; bool stat; - + x = execute(a[0]); getsval(x); stat = true; @@ -1831,7 +1872,10 @@ const char *filename(FILE *fp) continue; if (ferror(files[i].fp)) FATAL("i/o error occurred on %s", files[i].fname); - if (files[i].mode == '|' || files[i].mode == LE) + if (files[i].fp == stdin || files[i].fp == stdout || + files[i].fp == stderr) + stat = freopen("/dev/null", "r+", files[i].fp) == NULL; + else if (files[i].mode == '|' || files[i].mode == LE) stat = pclose(files[i].fp) == -1; else stat = fclose(files[i].fp) == EOF; @@ -1841,6 +1885,7 @@ const char *filename(FILE *fp) xfree(files[i].fname); files[i].fname = NULL; /* watch out for ref thru this */ files[i].fp = NULL; + break; } tempfree(x); x = gettemp(); @@ -1858,8 +1903,12 @@ void closeall(void) continue; if (ferror(files[i].fp)) FATAL( "i/o error occurred on %s", files[i].fname ); + if (files[i].fp == stdin) + continue; if (files[i].mode == '|' || files[i].mode == LE) stat = pclose(files[i].fp) == -1; + else if (files[i].fp == stdout || files[i].fp == stderr) + stat = fflush(files[i].fp) == EOF; else stat = fclose(files[i].fp) == EOF; if (stat) @@ -1869,7 +1918,7 @@ void closeall(void) static void flush_all(void) { - int i; + size_t i; for (i = 0; i < nfiles; i++) if (files[i].fp) @@ -1886,7 +1935,7 @@ Cell *sub(Node **a, int nnn) /* substitute command */ fa *pfa; int bufsz = recsize; - if ((buf = malloc(bufsz)) == NULL) + if ((buf = (char *) malloc(bufsz)) == NULL) FATAL("out of memory in sub"); x = execute(a[3]); /* target string */ t = getsval(x); @@ -1948,7 +1997,7 @@ Cell *gsub(Node **a, int nnn) /* global substitute */ int mflag, tempstat, num; int bufsz = recsize; - if ((buf = malloc(bufsz)) == NULL) + if ((buf = (char *) malloc(bufsz)) == NULL) FATAL("out of memory in gsub"); mflag = 0; /* if mflag == 0, can replace empty string */ num = 0; diff --git a/testdir/T.builtin b/testdir/T.builtin index b36f6cb..ef0e3bd 100755 --- a/testdir/T.builtin +++ b/testdir/T.builtin @@ -35,6 +35,9 @@ if locale -a | grep -qsi de_DE.UTF-8; then $awk '{ printf("%s|%s|%s\n", tolower($0), toupper($0), $0)}') >foo1 echo 'dürst|DÃœRST|Dürst' >foo2 diff foo1 foo2 || echo 'BAD: T.builtin (toupper/tolower) for utf-8' + (export LC_NUMERIC=de_DE.UTF-8 && $awk 'BEGIN { print 0.01 }' /dev/null) >foo1 + echo "0.01" >foo2 + diff foo1 foo2 || echo 'BAD: T.builtin LC_NUMERIC radix (.) handling' fi $awk 'BEGIN { @@ -70,3 +73,18 @@ echo '1 3' >foo1 $awk '{ n = split($0, x); print length(x) }' <foo0 >foo2 diff foo1 foo2 || echo 'BAD: T.builtin length array' + +# Test for backslash handling +cat << \EOF >foo0 +BEGIN { + print "A\ +B"; + print "CD" +} +EOF +$awk -f foo0 /dev/null >foo1 +cat << \EOF >foo2 +AB +CD +EOF +diff foo1 foo2 || echo 'BAD: T.builtin continuation handling (backslash)' diff --git a/testdir/T.errmsg b/testdir/T.errmsg index fcaaf9b..ee2450a 100755 --- a/testdir/T.errmsg +++ b/testdir/T.errmsg @@ -155,8 +155,8 @@ BEGIN { next } illegal .*next.* from END END { next; print NR } -can.t open file /etc/passwd -BEGIN { print "abc" >"/etc/passwd" } +can.t open file ./nonexistentdir/foo +BEGIN { print "abc" >"./nonexistentdir/foo" } you can.t define function f more than once function f() { print 1 } @@ -186,7 +186,7 @@ BEGIN { foo() } this should print a BAD message BEGIN { print } -!!! +!!!! echo ' running tests in foo.sh' @@ -213,5 +213,3 @@ grep 'print | is unsafe' foo2 >/dev/null || echo 'BAD: T.errmsg print | unsafe' $awk -safe 'BEGIN {system("date")}' >foo 2>foo2 grep 'system is unsafe' foo2 >/dev/null || echo 'BAD: T.errmsg system unsafe' - -!!!! diff --git a/testdir/T.flags b/testdir/T.flags index cff8884..33d7c8d 100755 --- a/testdir/T.flags +++ b/testdir/T.flags @@ -18,4 +18,7 @@ $awk -zz 'BEGIN{}' >foo 2>&1 grep 'unknown option' foo >/dev/null || echo 'T.flags: bad unknown option' $awk -F >foo 2>&1 -grep 'field separator.*empty' foo >/dev/null || echo 'T.flags: bad null field separator' +grep 'no field separator' foo >/dev/null || echo 'T.flags: bad missing field separator' + +$awk -F '' >foo 2>&1 +grep 'field separator FS is empty' foo >/dev/null || echo 'T.flags: bad empty field separator' diff --git a/testdir/T.misc b/testdir/T.misc index 3903606..dff57db 100755 --- a/testdir/T.misc +++ b/testdir/T.misc @@ -186,6 +186,14 @@ BEGIN { RS = "" }' >foo1 $awk 'END {print NR}' foo1 | grep 4 >/dev/null || echo 'BAD: T.misc abcdef fails' +# Test for RS regex being reapplied +echo aaa1a2a | $awk 1 RS='^a' >foo1 +cat << \EOF > foo2 + +aa1a2a + +EOF +diff foo1 foo2 || echo 'BAD: T.misc ^regex reapplied fails' # The following should not produce a warning about changing a constant # nor about a curdled tempcell list @@ -29,7 +29,6 @@ THIS SOFTWARE. #include <string.h> #include <stdlib.h> #include "awk.h" -#include "ytab.h" #define FULLTAB 2 /* rehash when table gets this x full */ #define GROWTAB 4 /* grow table by this factor */ @@ -130,9 +129,11 @@ void arginit(int ac, char **av) /* set up ARGV and ARGC */ free(cp->sval); cp->sval = (char *) ARGVtab; for (i = 0; i < ac; i++) { + double result; + sprintf(temp, "%d", i); - if (is_number(*av)) - setsymtab(temp, *av, atof(*av), STR|NUM, ARGVtab); + if (is_number(*av, & result)) + setsymtab(temp, *av, result, STR|NUM, ARGVtab); else setsymtab(temp, *av, 0.0, STR, ARGVtab); av++; @@ -149,13 +150,15 @@ void envinit(char **envp) /* set up ENVIRON variable */ free(cp->sval); cp->sval = (char *) ENVtab; for ( ; *envp; envp++) { + double result; + if ((p = strchr(*envp, '=')) == NULL) continue; if( p == *envp ) /* no left hand side name in env string */ continue; *p++ = 0; /* split into two strings at = */ - if (is_number(p)) - setsymtab(*envp, p, atof(p), STR|NUM, ENVtab); + if (is_number(p, & result)) + setsymtab(*envp, p, result, STR|NUM, ENVtab); else setsymtab(*envp, p, 0.0, STR, ENVtab); p[-1] = '='; /* restore in case env is passed down to a shell */ @@ -167,8 +170,8 @@ Array *makesymtab(int n) /* make a new symbol table */ Array *ap; Cell **tp; - ap = malloc(sizeof(*ap)); - tp = calloc(n, sizeof(*tp)); + ap = (Array *) malloc(sizeof(*ap)); + tp = (Cell **) calloc(n, sizeof(*tp)); if (ap == NULL || tp == NULL) FATAL("out of space in makesymtab"); ap->nelem = 0; @@ -234,11 +237,11 @@ Cell *setsymtab(const char *n, const char *s, Awkfloat f, unsigned t, Array *tp) Cell *p; if (n != NULL && (p = lookup(n, tp)) != NULL) { - dprintf( ("setsymtab found %p: n=%s s=\"%s\" f=%g t=%o\n", - (void*)p, NN(p->nval), NN(p->sval), p->fval, p->tval) ); + DPRINTF("setsymtab found %p: n=%s s=\"%s\" f=%g t=%o\n", + (void*)p, NN(p->nval), NN(p->sval), p->fval, p->tval); return(p); } - p = malloc(sizeof(*p)); + p = (Cell *) malloc(sizeof(*p)); if (p == NULL) FATAL("out of space for symbol table at %s", n); p->nval = tostring(n); @@ -253,8 +256,8 @@ Cell *setsymtab(const char *n, const char *s, Awkfloat f, unsigned t, Array *tp) h = hash(n, tp->size); p->cnext = tp->tab[h]; tp->tab[h] = p; - dprintf( ("setsymtab set %p: n=%s s=\"%s\" f=%g t=%o\n", - (void*)p, p->nval, p->sval, p->fval, p->tval) ); + DPRINTF("setsymtab set %p: n=%s s=\"%s\" f=%g t=%o\n", + (void*)p, p->nval, p->sval, p->fval, p->tval); return(p); } @@ -273,7 +276,7 @@ void rehash(Array *tp) /* rehash items in small table into big one */ Cell *cp, *op, **np; nsz = GROWTAB * tp->size; - np = calloc(nsz, sizeof(*np)); + np = (Cell **) calloc(nsz, sizeof(*np)); if (np == NULL) /* can't do it, but can keep running. */ return; /* someone else will run out later. */ for (i = 0; i < tp->size; i++) { @@ -313,11 +316,11 @@ Awkfloat setfval(Cell *vp, Awkfloat f) /* set float val of a Cell */ fldno = atoi(vp->nval); if (fldno > *NF) newfld(fldno); - dprintf( ("setting field %d to %g\n", fldno, f) ); + DPRINTF("setting field %d to %g\n", fldno, f); } else if (&vp->fval == NF) { donerec = false; /* mark $0 invalid */ setlastfld(f); - dprintf( ("setting NF to %g\n", f) ); + DPRINTF("setting NF to %g\n", f); } else if (isrec(vp)) { donefld = false; /* mark $1... invalid */ donerec = true; @@ -333,7 +336,7 @@ Awkfloat setfval(Cell *vp, Awkfloat f) /* set float val of a Cell */ vp->tval |= NUM; /* mark number ok */ if (f == -0) /* who would have thought this possible? */ f = 0; - dprintf( ("setfval %p: %s = %g, t=%o\n", (void*)vp, NN(vp->nval), f, vp->tval) ); + DPRINTF("setfval %p: %s = %g, t=%o\n", (void*)vp, NN(vp->nval), f, vp->tval); return vp->fval = f; } @@ -353,8 +356,8 @@ char *setsval(Cell *vp, const char *s) /* set string val of a Cell */ int fldno; Awkfloat f; - dprintf( ("starting setsval %p: %s = \"%s\", t=%o, r,f=%d,%d\n", - (void*)vp, NN(vp->nval), s, vp->tval, donerec, donefld) ); + DPRINTF("starting setsval %p: %s = \"%s\", t=%o, r,f=%d,%d\n", + (void*)vp, NN(vp->nval), s, vp->tval, donerec, donefld); if ((vp->tval & (NUM | STR)) == 0) funnyvar(vp, "assign to"); if (isfld(vp)) { @@ -362,7 +365,7 @@ char *setsval(Cell *vp, const char *s) /* set string val of a Cell */ fldno = atoi(vp->nval); if (fldno > *NF) newfld(fldno); - dprintf( ("setting field %d to %s (%p)\n", fldno, s, s) ); + DPRINTF("setting field %d to %s (%p)\n", fldno, s, (const void*)s); } else if (isrec(vp)) { donefld = false; /* mark $1... invalid */ donerec = true; @@ -378,14 +381,14 @@ char *setsval(Cell *vp, const char *s) /* set string val of a Cell */ vp->tval |= STR; vp->fmt = NULL; setfree(vp); - dprintf( ("setsval %p: %s = \"%s (%p) \", t=%o r,f=%d,%d\n", - (void*)vp, NN(vp->nval), t, t, vp->tval, donerec, donefld) ); + DPRINTF("setsval %p: %s = \"%s (%p) \", t=%o r,f=%d,%d\n", + (void*)vp, NN(vp->nval), t, (void*)t, vp->tval, donerec, donefld); vp->sval = t; if (&vp->fval == NF) { donerec = false; /* mark $0 invalid */ f = getfval(vp); setlastfld(f); - dprintf( ("setting NF to %g\n", f) ); + DPRINTF("setting NF to %g\n", f); } return(vp->sval); @@ -400,19 +403,36 @@ Awkfloat getfval(Cell *vp) /* get float val of a Cell */ else if (isrec(vp) && !donerec) recbld(); if (!isnum(vp)) { /* not a number */ - vp->fval = atof(vp->sval); /* best guess */ - if (is_number(vp->sval) && !(vp->tval&CON)) - vp->tval |= NUM; /* make NUM only sparingly */ + double fval; + bool no_trailing; + + if (is_valid_number(vp->sval, true, & no_trailing, & fval)) { + vp->fval = fval; + if (no_trailing && !(vp->tval&CON)) + vp->tval |= NUM; /* make NUM only sparingly */ + } else + vp->fval = 0.0; } - dprintf( ("getfval %p: %s = %g, t=%o\n", - (void*)vp, NN(vp->nval), vp->fval, vp->tval) ); + DPRINTF("getfval %p: %s = %g, t=%o\n", + (void*)vp, NN(vp->nval), vp->fval, vp->tval); return(vp->fval); } +static const char *get_inf_nan(double d) +{ + if (isinf(d)) { + return (d < 0 ? "-inf" : "+inf"); + } else if (isnan(d)) { + return (signbit(d) != 0 ? "-nan" : "+nan"); + } else + return NULL; +} + static char *get_str_val(Cell *vp, char **fmt) /* get string val of a Cell */ { char s[256]; double dtemp; + const char *p; if ((vp->tval & (NUM | STR)) == 0) funnyvar(vp, "read value of"); @@ -449,7 +469,9 @@ static char *get_str_val(Cell *vp, char **fmt) /* get string val of a Cel { \ if (freeable(vp)) \ xfree(vp->sval); \ - if (modf(vp->fval, &dtemp) == 0) /* it's integral */ \ + if ((p = get_inf_nan(vp->fval)) != NULL) \ + strcpy(s, p); \ + else if (modf(vp->fval, &dtemp) == 0) /* it's integral */ \ snprintf(s, sizeof (s), "%.30g", vp->fval); \ else \ snprintf(s, sizeof (s), *fmt, vp->fval); \ @@ -492,8 +514,8 @@ static char *get_str_val(Cell *vp, char **fmt) /* get string val of a Cel } } done: - dprintf( ("getsval %p: %s = \"%s (%p)\", t=%o\n", - (void*)vp, NN(vp->nval), vp->sval, vp->sval, vp->tval) ); + DPRINTF("getsval %p: %s = \"%s (%p)\", t=%o\n", + (void*)vp, NN(vp->nval), vp->sval, (void*)vp->sval, vp->tval); return(vp->sval); } @@ -520,7 +542,7 @@ char *tostringN(const char *s, size_t n) /* make a copy of string s */ { char *p; - p = malloc(n); + p = (char *) malloc(n); if (p == NULL) FATAL("out of space in tostring on %s", s); strcpy(p, s); @@ -534,13 +556,13 @@ Cell *catstr(Cell *a, Cell *b) /* concatenate a and b */ char *sa = getsval(a); char *sb = getsval(b); size_t l = strlen(sa) + strlen(sb) + 1; - p = malloc(l); + p = (char *) malloc(l); if (p == NULL) FATAL("out of space concatenating %s and %s", sa, sb); snprintf(p, l, "%s%s", sa, sb); l++; // add room for ' ' - char *newbuf = malloc(l); + char *newbuf = (char *) malloc(l); if (newbuf == NULL) FATAL("out of space concatenating %s and %s", sa, sb); // See string() in lex.c; a string "xx" is stored in the symbol @@ -559,7 +581,7 @@ char *qstring(const char *is, int delim) /* collect string up to next delim */ const uschar *s = (const uschar *) is; uschar *buf, *bp; - if ((buf = malloc(strlen(is)+3)) == NULL) + if ((buf = (uschar *) malloc(strlen(is)+3)) == NULL) FATAL( "out of space in qstring(%s)", s); for (bp = buf; (c = *s) != delim; s++) { if (c == '\n') @@ -1,3693 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.4.1. */ - -/* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, - Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Undocumented macros, especially those whose name start with YY_, - are private implementation details. Do not rely on them. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "3.4.1" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - - - - -/* First part of user prologue. */ -#line 25 "awkgram.y" - -#include <stdio.h> -#include <string.h> -#include "awk.h" - -void checkdup(Node *list, Cell *item); -int yywrap(void) { return(1); } - -Node *beginloc = 0; -Node *endloc = 0; -bool infunc = false; /* = true if in arglist or body of func */ -int inloop = 0; /* >= 1 if in while, for, do; can't be bool, since loops can next */ -char *curfname = 0; /* current function name */ -Node *arglist = 0; /* list of args for current function */ - -#line 86 "y.tab.c" - -# ifndef YY_NULLPTR -# if defined __cplusplus -# if 201103L <= __cplusplus -# define YY_NULLPTR nullptr -# else -# define YY_NULLPTR 0 -# endif -# else -# define YY_NULLPTR ((void*)0) -# endif -# endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Use api.header.include to #include this header - instead of duplicating it here. */ -#ifndef YY_YY_Y_TAB_H_INCLUDED -# define YY_YY_Y_TAB_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int yydebug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - FIRSTTOKEN = 258, - PROGRAM = 259, - PASTAT = 260, - PASTAT2 = 261, - XBEGIN = 262, - XEND = 263, - NL = 264, - ARRAY = 265, - MATCH = 266, - NOTMATCH = 267, - MATCHOP = 268, - FINAL = 269, - DOT = 270, - ALL = 271, - CCL = 272, - NCCL = 273, - CHAR = 274, - OR = 275, - STAR = 276, - QUEST = 277, - PLUS = 278, - EMPTYRE = 279, - ZERO = 280, - AND = 281, - BOR = 282, - APPEND = 283, - EQ = 284, - GE = 285, - GT = 286, - LE = 287, - LT = 288, - NE = 289, - IN = 290, - ARG = 291, - BLTIN = 292, - BREAK = 293, - CLOSE = 294, - CONTINUE = 295, - DELETE = 296, - DO = 297, - EXIT = 298, - FOR = 299, - FUNC = 300, - SUB = 301, - GSUB = 302, - IF = 303, - INDEX = 304, - LSUBSTR = 305, - MATCHFCN = 306, - NEXT = 307, - NEXTFILE = 308, - ADD = 309, - MINUS = 310, - MULT = 311, - DIVIDE = 312, - MOD = 313, - ASSIGN = 314, - ASGNOP = 315, - ADDEQ = 316, - SUBEQ = 317, - MULTEQ = 318, - DIVEQ = 319, - MODEQ = 320, - POWEQ = 321, - PRINT = 322, - PRINTF = 323, - SPRINTF = 324, - ELSE = 325, - INTEST = 326, - CONDEXPR = 327, - POSTINCR = 328, - PREINCR = 329, - POSTDECR = 330, - PREDECR = 331, - VAR = 332, - IVAR = 333, - VARNF = 334, - CALL = 335, - NUMBER = 336, - STRING = 337, - REGEXPR = 338, - GETLINE = 339, - RETURN = 340, - SPLIT = 341, - SUBSTR = 342, - WHILE = 343, - CAT = 344, - NOT = 345, - UMINUS = 346, - UPLUS = 347, - POWER = 348, - DECR = 349, - INCR = 350, - INDIRECT = 351, - LASTTOKEN = 352 - }; -#endif -/* Tokens. */ -#define FIRSTTOKEN 258 -#define PROGRAM 259 -#define PASTAT 260 -#define PASTAT2 261 -#define XBEGIN 262 -#define XEND 263 -#define NL 264 -#define ARRAY 265 -#define MATCH 266 -#define NOTMATCH 267 -#define MATCHOP 268 -#define FINAL 269 -#define DOT 270 -#define ALL 271 -#define CCL 272 -#define NCCL 273 -#define CHAR 274 -#define OR 275 -#define STAR 276 -#define QUEST 277 -#define PLUS 278 -#define EMPTYRE 279 -#define ZERO 280 -#define AND 281 -#define BOR 282 -#define APPEND 283 -#define EQ 284 -#define GE 285 -#define GT 286 -#define LE 287 -#define LT 288 -#define NE 289 -#define IN 290 -#define ARG 291 -#define BLTIN 292 -#define BREAK 293 -#define CLOSE 294 -#define CONTINUE 295 -#define DELETE 296 -#define DO 297 -#define EXIT 298 -#define FOR 299 -#define FUNC 300 -#define SUB 301 -#define GSUB 302 -#define IF 303 -#define INDEX 304 -#define LSUBSTR 305 -#define MATCHFCN 306 -#define NEXT 307 -#define NEXTFILE 308 -#define ADD 309 -#define MINUS 310 -#define MULT 311 -#define DIVIDE 312 -#define MOD 313 -#define ASSIGN 314 -#define ASGNOP 315 -#define ADDEQ 316 -#define SUBEQ 317 -#define MULTEQ 318 -#define DIVEQ 319 -#define MODEQ 320 -#define POWEQ 321 -#define PRINT 322 -#define PRINTF 323 -#define SPRINTF 324 -#define ELSE 325 -#define INTEST 326 -#define CONDEXPR 327 -#define POSTINCR 328 -#define PREINCR 329 -#define POSTDECR 330 -#define PREDECR 331 -#define VAR 332 -#define IVAR 333 -#define VARNF 334 -#define CALL 335 -#define NUMBER 336 -#define STRING 337 -#define REGEXPR 338 -#define GETLINE 339 -#define RETURN 340 -#define SPLIT 341 -#define SUBSTR 342 -#define WHILE 343 -#define CAT 344 -#define NOT 345 -#define UMINUS 346 -#define UPLUS 347 -#define POWER 348 -#define DECR 349 -#define INCR 350 -#define INDIRECT 351 -#define LASTTOKEN 352 - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -union YYSTYPE -{ -#line 41 "awkgram.y" - - Node *p; - Cell *cp; - int i; - char *s; - -#line 330 "y.tab.c" - -}; -typedef union YYSTYPE YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - - -extern YYSTYPE yylval; - -int yyparse (void); - -#endif /* !YY_YY_Y_TAB_H_INCLUDED */ - - - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#else -typedef signed char yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T -# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS -# if ENABLE_NLS -# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext ("bison-runtime", Msgid) -# endif -# endif -# ifndef YY_ -# define YY_(Msgid) Msgid -# endif -#endif - -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) -# else -# define YY_ATTRIBUTE(Spec) /* empty */ -# endif -#endif - -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - -#ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) -#else -# define YYUSE(E) /* empty */ -#endif - -#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") -#else -# define YY_INITIAL_VALUE(Value) Value -#endif -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - - -#define YY_ASSERT(E) ((void) (0 && (E))) - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's 'empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined EXIT_SUCCESS \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -# define YYCOPY_NEEDED 1 - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (0) - -#endif - -#if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) -# else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ - while (0) -# endif -# endif -#endif /* !YYCOPY_NEEDED */ - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 8 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 4608 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 114 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 50 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 187 -/* YYNSTATES -- Number of states. */ -#define YYNSTATES 370 - -#define YYUNDEFTOK 2 -#define YYMAXUTOK 352 - -/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, with out-of-bounds checking. */ -#define YYTRANSLATE(YYX) \ - ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 105, 2, 2, - 12, 16, 104, 102, 10, 103, 2, 15, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 95, 14, - 2, 2, 2, 94, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 18, 2, 19, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 11, 13, 17, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 96, - 97, 98, 99, 100, 101, 106, 107, 108, 109, 110, - 111, 112, 113 -}; - -#if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 99, 99, 101, 105, 105, 109, 109, 113, 113, - 117, 117, 121, 121, 125, 125, 127, 127, 129, 129, - 134, 135, 139, 143, 143, 147, 147, 151, 152, 156, - 157, 162, 163, 167, 168, 172, 176, 177, 178, 179, - 180, 181, 183, 185, 185, 190, 191, 195, 196, 200, - 201, 203, 205, 207, 208, 213, 214, 215, 216, 217, - 221, 222, 224, 226, 228, 229, 230, 231, 232, 233, - 234, 235, 240, 241, 242, 245, 248, 249, 250, 254, - 255, 259, 260, 264, 265, 266, 270, 270, 274, 274, - 274, 274, 278, 278, 282, 284, 288, 288, 292, 292, - 296, 299, 302, 305, 306, 307, 308, 309, 313, 314, - 318, 320, 322, 322, 322, 324, 325, 326, 327, 328, - 329, 330, 333, 336, 337, 338, 339, 339, 340, 344, - 345, 349, 349, 353, 354, 358, 359, 360, 361, 362, - 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, - 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, - 384, 387, 388, 390, 395, 396, 398, 400, 402, 403, - 404, 406, 411, 413, 418, 420, 422, 426, 427, 428, - 429, 433, 434, 435, 441, 442, 443, 448 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || 0 -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "FIRSTTOKEN", "PROGRAM", "PASTAT", - "PASTAT2", "XBEGIN", "XEND", "NL", "','", "'{'", "'('", "'|'", "';'", - "'/'", "')'", "'}'", "'['", "']'", "ARRAY", "MATCH", "NOTMATCH", - "MATCHOP", "FINAL", "DOT", "ALL", "CCL", "NCCL", "CHAR", "OR", "STAR", - "QUEST", "PLUS", "EMPTYRE", "ZERO", "AND", "BOR", "APPEND", "EQ", "GE", - "GT", "LE", "LT", "NE", "IN", "ARG", "BLTIN", "BREAK", "CLOSE", - "CONTINUE", "DELETE", "DO", "EXIT", "FOR", "FUNC", "SUB", "GSUB", "IF", - "INDEX", "LSUBSTR", "MATCHFCN", "NEXT", "NEXTFILE", "ADD", "MINUS", - "MULT", "DIVIDE", "MOD", "ASSIGN", "ASGNOP", "ADDEQ", "SUBEQ", "MULTEQ", - "DIVEQ", "MODEQ", "POWEQ", "PRINT", "PRINTF", "SPRINTF", "ELSE", - "INTEST", "CONDEXPR", "POSTINCR", "PREINCR", "POSTDECR", "PREDECR", - "VAR", "IVAR", "VARNF", "CALL", "NUMBER", "STRING", "REGEXPR", "'?'", - "':'", "GETLINE", "RETURN", "SPLIT", "SUBSTR", "WHILE", "CAT", "'+'", - "'-'", "'*'", "'%'", "NOT", "UMINUS", "UPLUS", "POWER", "DECR", "INCR", - "INDIRECT", "LASTTOKEN", "$accept", "program", "and", "bor", "comma", - "do", "else", "for", "$@1", "$@2", "$@3", "funcname", "if", "lbrace", - "nl", "opt_nl", "opt_pst", "opt_simple_stmt", "pas", "pa_pat", "pa_stat", - "$@4", "pa_stats", "patlist", "ppattern", "pattern", "plist", "pplist", - "prarg", "print", "pst", "rbrace", "re", "reg_expr", "$@5", "rparen", - "simple_stmt", "st", "stmt", "$@6", "$@7", "$@8", "stmtlist", "subop", - "string", "term", "var", "varlist", "varname", "while", YY_NULLPTR -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 44, 123, 40, 124, 59, 47, 41, 125, 91, 93, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 63, 58, 339, 340, 341, 342, - 343, 344, 43, 45, 42, 37, 345, 346, 347, 348, - 349, 350, 351, 352 -}; -# endif - -#define YYPACT_NINF -316 - -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-316))) - -#define YYTABLE_NINF -32 - -#define yytable_value_is_error(Yytable_value) \ - (!!((Yytable_value) == (-32))) - - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -static const yytype_int16 yypact[] = -{ - 635, -316, -316, -316, 10, 1580, -316, 151, -316, 3, - 3, -316, 4178, -316, -316, 29, 4496, 18, -316, -316, - 40, 44, 56, -316, -316, -316, 71, -316, -316, 81, - 95, 104, 4496, 4496, 4226, 261, 261, 4496, 763, 76, - -316, 157, 3511, -316, -316, 106, -62, -3, -34, 117, - -316, -316, 763, 763, 2184, 39, 53, 4014, 4178, 4496, - -3, 32, -316, -316, 113, 4178, 4178, 4178, 4072, 4496, - 115, 4178, 4178, 65, 65, -316, 65, -316, -316, -316, - -316, -316, 166, 158, 158, -14, -316, 1733, 164, 178, - 158, 158, -316, -316, 1733, 186, 190, -316, 1386, 763, - 3511, 4284, 158, -316, 832, -316, 166, 763, 1580, 108, - 4178, -316, -316, 4178, 4178, 4178, 4178, 4178, 4178, -14, - 4178, 1791, 1849, -3, 4178, -316, 4332, 4496, 4496, 4496, - 4496, 4496, 4178, -316, -316, 4178, 901, 970, -316, -316, - 1907, 155, 1907, 192, -316, 62, 3511, 2680, 116, 2588, - 2588, 80, -316, 87, -3, 4496, 2588, 2588, -316, 196, - -316, 166, 196, -316, -316, 191, 1675, -316, 1454, 4178, - -316, -316, 1675, -316, 4178, -316, 1386, 130, 1039, 4178, - 3894, 201, 57, -316, -3, -30, -316, -316, -316, 1386, - 4178, 1108, -316, 261, 3765, -316, 3765, 3765, 3765, 3765, - 3765, 3765, -316, 2772, -316, 3684, -316, 3603, 2588, 201, - 4496, 65, 43, 43, 65, 65, 65, 3511, 27, -316, - -316, -316, 3511, -14, 3511, -316, -316, 1907, -316, 107, - 1907, 1907, -316, -316, -3, 2, 1907, -316, -316, 4178, - -316, 203, -316, -11, 2864, -316, 2864, -316, -316, 1179, - -316, 206, 128, 4400, -14, 4400, 1965, 2023, -3, 2081, - 4496, 4496, 4496, 4400, -316, 3, -316, -316, 4178, 1907, - 1907, -3, -316, -316, 3511, -316, 6, 210, 2956, 204, - 3048, 213, 143, 2287, 47, 188, -14, 210, 210, 132, - -316, -316, -316, 193, 4178, 4448, -316, -316, 3813, 4120, - 3966, 3894, -3, -3, -3, 3894, 763, 3511, 2390, 2493, - -316, -316, 3, -316, -316, -316, -316, -316, 1907, -316, - 1907, -316, 166, 4178, 217, 223, -14, 147, 4400, 1248, - -316, 33, -316, 33, 763, 3140, 220, 3232, 1522, 3327, - 210, 4178, -316, 193, 3894, -316, 226, 232, 1317, -316, - -316, -316, 217, 166, 1386, 3419, -316, -316, -316, 210, - 1522, -316, 158, 1386, 217, -316, -316, 210, 1386, -316 -}; - - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 0, 3, 88, 89, 0, 33, 2, 30, 1, 0, - 0, 23, 0, 96, 185, 147, 0, 0, 131, 132, - 0, 0, 0, 184, 179, 186, 0, 164, 133, 158, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, - 45, 29, 35, 77, 94, 0, 169, 78, 176, 177, - 90, 91, 0, 0, 0, 0, 0, 0, 0, 0, - 150, 176, 20, 21, 0, 0, 0, 0, 0, 0, - 157, 0, 0, 143, 142, 95, 144, 151, 152, 180, - 107, 24, 27, 0, 0, 0, 10, 0, 0, 0, - 0, 0, 86, 87, 0, 0, 112, 117, 0, 0, - 106, 83, 0, 129, 0, 126, 27, 0, 34, 0, - 0, 4, 6, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 76, 0, 134, 0, 0, 0, 0, - 0, 0, 0, 153, 154, 0, 0, 0, 8, 161, - 0, 0, 0, 0, 145, 0, 47, 0, 181, 0, - 0, 0, 148, 0, 156, 0, 0, 0, 25, 28, - 128, 27, 108, 110, 111, 105, 0, 116, 0, 0, - 121, 122, 0, 124, 0, 11, 0, 119, 0, 0, - 81, 84, 103, 58, 59, 176, 125, 40, 130, 0, - 0, 0, 46, 75, 71, 70, 64, 65, 66, 67, - 68, 69, 72, 0, 5, 63, 7, 62, 0, 94, - 0, 139, 136, 137, 138, 140, 141, 60, 0, 41, - 42, 9, 79, 0, 80, 97, 146, 0, 182, 0, - 0, 0, 168, 149, 155, 0, 0, 26, 109, 0, - 115, 0, 32, 177, 0, 123, 0, 113, 12, 0, - 92, 120, 0, 0, 0, 0, 0, 0, 57, 0, - 0, 0, 0, 0, 127, 38, 37, 74, 0, 0, - 0, 135, 178, 73, 48, 98, 0, 43, 0, 94, - 0, 94, 0, 0, 0, 27, 0, 22, 187, 0, - 13, 118, 93, 85, 0, 54, 53, 55, 0, 52, - 51, 82, 100, 101, 102, 49, 0, 61, 0, 0, - 183, 99, 0, 159, 160, 163, 162, 167, 0, 175, - 0, 104, 27, 0, 0, 0, 0, 0, 0, 0, - 171, 0, 170, 0, 0, 0, 94, 0, 0, 0, - 18, 0, 56, 0, 50, 39, 0, 0, 0, 165, - 166, 174, 0, 27, 0, 0, 173, 172, 44, 16, - 0, 19, 0, 0, 0, 114, 17, 14, 0, 15 -}; - - /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -316, -316, -1, 46, 5, -316, -316, -316, -316, -316, - -316, -316, -316, -4, -73, -67, 209, -315, -316, 61, - 145, -316, -316, -43, -192, 482, -175, -316, -316, -316, - -316, -316, -32, -102, -316, -215, -165, -40, 381, -316, - -316, -316, -25, -316, -316, 236, -16, -316, 103, -316 -}; - - /* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 4, 121, 122, 227, 96, 249, 97, 368, 363, - 354, 64, 98, 99, 162, 160, 5, 241, 6, 39, - 40, 312, 41, 145, 180, 100, 55, 181, 182, 101, - 7, 251, 43, 44, 56, 277, 102, 163, 103, 176, - 289, 189, 104, 45, 46, 47, 48, 229, 49, 105 -}; - - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ -static const yytype_int16 yytable[] = -{ - 61, 38, 75, 242, 252, 52, 53, 135, 195, 159, - 8, 221, 126, 70, 11, 221, 61, 61, 61, 77, - 78, 61, 209, 352, 151, 153, 61, 136, 137, 287, - 125, 288, 14, 159, 286, 107, 132, 138, 61, 190, - 263, 57, 221, 61, 164, 364, 272, 167, 14, 138, - 170, 171, 65, 61, 173, 141, 66, 138, 126, 140, - 142, 295, 186, 298, 299, 300, 321, 301, 67, 183, - 260, 305, 138, 23, 178, 25, 133, 134, 226, 14, - 133, 134, 191, 68, 61, 185, 106, 11, 159, 23, - 138, 25, 218, 310, 238, 261, 232, 138, 262, 127, - 128, 129, 130, 233, 38, 62, 131, 71, 63, 340, - 61, 61, 61, 61, 61, 61, 72, 138, 124, 327, - 23, 24, 25, 275, 69, 148, 240, 14, 279, 281, - 61, 61, 245, 61, 61, 135, 344, 359, 138, 61, - 61, 61, 133, 134, 293, 37, 143, 129, 130, 367, - 61, 296, 131, 138, 230, 231, 61, 138, 155, 317, - 50, 235, 236, 343, 61, 51, 2, 158, 23, 24, - 25, 3, 161, 242, 131, 158, 168, 267, 61, 256, - 61, 61, 61, 61, 61, 61, 259, 61, 165, 61, - 169, 61, 61, 37, 61, 242, 284, 158, 174, 175, - 223, 61, 322, 228, 193, 237, 61, 225, 61, 239, - 248, 138, 159, 269, 270, 292, 336, 285, 323, 311, - 314, 183, 202, 183, 183, 183, 257, 183, 61, 316, - 61, 183, 325, 275, 276, 341, 350, 185, 326, 185, - 185, 185, 356, 185, 61, 61, 61, 185, 357, 159, - 108, 265, 60, 192, 0, 338, 0, 142, 61, 0, - 0, 306, 61, 0, 61, 0, 0, 61, 73, 74, - 76, 243, 0, 79, 0, 0, 0, 0, 123, 61, - 159, 329, 61, 61, 61, 61, 360, 318, 320, 61, - 123, 61, 61, 61, 256, 76, 183, 256, 256, 256, - 256, 0, 0, 0, 256, 154, 0, 14, 334, 348, - 0, 0, 185, 331, 333, 346, 0, 347, 0, 61, - 0, 61, 365, 61, 0, 0, 273, 0, 61, 0, - 0, 0, 142, 0, 0, 0, 123, 184, 282, 61, - 0, 257, 0, 256, 257, 257, 257, 257, 23, 24, - 25, 257, 0, 0, 0, 0, 0, 297, 0, 0, - 0, 0, 211, 212, 213, 214, 215, 216, 0, 0, - 0, 0, 0, 37, 0, 0, 0, 0, 0, 0, - 0, 0, 123, 123, 0, 123, 123, 0, 0, 324, - 257, 234, 123, 123, 0, 0, 0, 0, 0, 0, - 0, 0, 123, 0, 0, 0, 0, 0, 123, 0, - 0, 0, 0, 0, 0, 0, 258, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 342, - 123, 0, 123, 123, 123, 123, 123, 123, 0, 123, - 0, 123, 0, 123, 123, 0, 271, 0, 0, 0, - 0, 0, 0, 123, 0, 0, 0, 0, 123, 0, - 123, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 177, - 123, 0, 123, 0, 0, 188, 0, 42, 0, 184, - 0, 184, 184, 184, 54, 184, 302, 303, 304, 184, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 123, 0, 0, 0, 123, 0, 123, 188, 188, 123, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 258, 0, 0, 258, 258, 258, 258, 0, 146, - 147, 258, 0, 123, 123, 123, 0, 149, 150, 146, - 146, 0, 0, 156, 157, 0, 0, 247, 0, 188, - 0, 0, 0, 0, 184, 0, 0, 0, 0, 166, - 264, 123, 188, 123, 0, 123, 172, 0, 0, 0, - 258, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 42, 123, 194, 0, 0, 196, 197, 198, 199, 200, - 201, 0, 203, 205, 207, 0, 208, 0, 0, 0, - 0, 0, 0, 0, 217, 0, 0, 146, 0, 0, - 0, 0, 222, 0, 224, 0, 0, 0, 0, 0, - 291, 0, 0, 0, 0, -29, 1, 0, 0, 0, - 0, 0, -29, -29, 2, 0, -29, -29, 0, 3, - -29, 244, 0, 0, 0, 0, 246, 0, 0, 0, - 0, 54, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 42, 0, 0, 0, 0, 0, 0, 0, - 0, -29, -29, 0, -29, 0, 0, 0, 0, 0, - -29, -29, -29, 0, -29, 0, -29, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 274, - 188, 0, 278, 280, -29, 0, 0, 0, 283, 0, - 0, 146, -29, -29, -29, -29, -29, -29, 0, 188, - 0, -29, 0, -29, -29, 361, 0, -29, -29, 0, - 0, -29, 0, 0, 366, -29, -29, -29, 0, 369, - 307, 308, 309, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 80, 0, 0, 0, 0, 0, - 0, 0, 81, 0, 11, 12, 54, 82, 13, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 335, 0, 337, 0, 0, 339, 0, 0, 0, 14, - 15, 83, 16, 84, 85, 86, 87, 88, 0, 18, - 19, 89, 20, 355, 21, 90, 91, 0, 0, 0, - 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, - 92, 93, 22, 11, 12, 0, 82, 13, 0, 187, - 23, 24, 25, 26, 27, 28, 0, 0, 0, 29, - 94, 30, 31, 95, 0, 32, 33, 0, 0, 34, - 0, 0, 0, 35, 36, 37, 0, 0, 14, 15, - 83, 16, 84, 85, 86, 87, 88, 0, 18, 19, - 89, 20, 0, 21, 90, 91, 0, 0, 0, 0, - 0, 0, 80, 0, 0, 0, 0, 0, 0, 92, - 93, 22, 11, 12, 0, 82, 13, 0, 219, 23, - 24, 25, 26, 27, 28, 0, 0, 0, 29, 94, - 30, 31, 95, 0, 32, 33, 0, 0, 34, 0, - 0, 0, 35, 36, 37, 0, 0, 14, 15, 83, - 16, 84, 85, 86, 87, 88, 0, 18, 19, 89, - 20, 0, 21, 90, 91, 0, 0, 0, 0, 0, - 0, 80, 0, 0, 0, 0, 0, 0, 92, 93, - 22, 11, 12, 0, 82, 13, 0, 220, 23, 24, - 25, 26, 27, 28, 0, 0, 0, 29, 94, 30, - 31, 95, 0, 32, 33, 0, 0, 34, 0, 0, - 0, 35, 36, 37, 0, 0, 14, 15, 83, 16, - 84, 85, 86, 87, 88, 0, 18, 19, 89, 20, - 0, 21, 90, 91, 0, 0, 0, 0, 0, 0, - 80, 0, 0, 0, 0, 0, 0, 92, 93, 22, - 11, 12, 0, 82, 13, 0, 250, 23, 24, 25, - 26, 27, 28, 0, 0, 0, 29, 94, 30, 31, - 95, 0, 32, 33, 0, 0, 34, 0, 0, 0, - 35, 36, 37, 0, 0, 14, 15, 83, 16, 84, - 85, 86, 87, 88, 0, 18, 19, 89, 20, 0, - 21, 90, 91, 0, 0, 0, 0, 0, 0, 80, - 0, 0, 0, 0, 0, 0, 92, 93, 22, 11, - 12, 0, 82, 13, 0, 266, 23, 24, 25, 26, - 27, 28, 0, 0, 0, 29, 94, 30, 31, 95, - 0, 32, 33, 0, 0, 34, 0, 0, 0, 35, - 36, 37, 0, 0, 14, 15, 83, 16, 84, 85, - 86, 87, 88, 0, 18, 19, 89, 20, 0, 21, - 90, 91, 0, 0, 0, 0, 0, 0, 0, 0, - 80, 0, 0, 0, 0, 92, 93, 22, 290, 0, - 11, 12, 0, 82, 13, 23, 24, 25, 26, 27, - 28, 0, 0, 0, 29, 94, 30, 31, 95, 0, - 32, 33, 0, 0, 34, 0, 0, 0, 35, 36, - 37, 0, 0, 0, 0, 14, 15, 83, 16, 84, - 85, 86, 87, 88, 0, 18, 19, 89, 20, 0, - 21, 90, 91, 0, 0, 0, 0, 0, 0, 80, - 0, 0, 0, 0, 0, 0, 92, 93, 22, 11, - 12, 0, 82, 13, 0, 345, 23, 24, 25, 26, - 27, 28, 0, 0, 0, 29, 94, 30, 31, 95, - 0, 32, 33, 0, 0, 34, 0, 0, 0, 35, - 36, 37, 0, 0, 14, 15, 83, 16, 84, 85, - 86, 87, 88, 0, 18, 19, 89, 20, 0, 21, - 90, 91, 0, 0, 0, 0, 0, 0, 80, 0, - 0, 0, 0, 0, 0, 92, 93, 22, 11, 12, - 0, 82, 13, 0, 358, 23, 24, 25, 26, 27, - 28, 0, 0, 0, 29, 94, 30, 31, 95, 0, - 32, 33, 0, 0, 34, 0, 0, 0, 35, 36, - 37, 0, 0, 14, 15, 83, 16, 84, 85, 86, - 87, 88, 0, 18, 19, 89, 20, 0, 21, 90, - 91, 0, 0, 0, 0, 0, 0, 80, 0, 0, - 0, 0, 0, 0, 92, 93, 22, 11, 12, 0, - 82, 13, 0, 0, 23, 24, 25, 26, 27, 28, - 0, 0, 0, 29, 94, 30, 31, 95, 0, 32, - 33, 0, 0, 34, 0, 0, 0, 35, 36, 37, - 0, 0, 14, 15, 83, 16, 84, 85, 86, 87, - 88, 0, 18, 19, 89, 20, 0, 21, 90, 91, - 0, 0, 0, 0, 0, 80, 0, 0, 0, 0, - 0, 0, 0, 92, 93, 22, 12, 0, -31, 13, - 0, 0, 0, 23, 24, 25, 26, 27, 28, 0, - 0, 0, 29, 94, 30, 31, 95, 0, 32, 33, - 0, 0, 34, 0, 0, 0, 35, 36, 37, 0, - 14, 15, 0, 16, 0, 85, 0, 0, 0, 0, - 18, 19, 0, 20, 0, 21, 0, 0, 0, 0, - 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, - 0, 92, 93, 22, 12, 0, 0, 13, -31, 0, - 0, 23, 24, 25, 26, 27, 28, 0, 0, 0, - 29, 0, 30, 31, 0, 0, 32, 33, 0, 0, - 34, 0, 0, 0, 35, 36, 37, 0, 14, 15, - 0, 16, 0, 85, 0, 0, 0, 0, 18, 19, - 0, 20, 0, 21, 0, 0, 0, 9, 10, 0, - 0, 11, 12, 0, 0, 13, 0, 0, 0, 92, - 93, 22, 0, 0, 0, 0, 0, 0, 0, 23, - 24, 25, 26, 27, 28, 0, 0, 0, 29, 0, - 30, 31, 0, 0, 32, 33, 14, 15, 34, 16, - 0, 0, 35, 36, 37, 17, 18, 19, 0, 20, - 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, - 0, 0, 0, 0, 0, 0, 0, 23, 24, 25, - 26, 27, 28, 0, 0, 0, 29, 0, 30, 31, - 0, 0, 32, 33, 158, 0, 34, 58, 109, 161, - 35, 36, 37, 0, 0, 0, 0, 0, 110, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 111, 112, 0, 113, 114, 115, 116, 117, 118, - 119, 14, 15, 0, 16, 0, 0, 0, 0, 0, - 0, 18, 19, 0, 20, 0, 21, 0, 0, 0, - 0, 0, 158, 0, 0, 12, 0, 161, 13, 0, - 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, - 0, 0, 23, 24, 25, 26, 27, 28, 0, 120, - 0, 29, 0, 30, 31, 0, 0, 32, 33, 14, - 15, 59, 16, 0, 0, 35, 36, 37, 0, 18, - 19, 0, 20, 0, 21, 0, 0, 0, 0, 0, - 204, 0, 0, 12, 0, 0, 13, 0, 0, 0, - 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, - 23, 24, 25, 26, 27, 28, 0, 0, 0, 29, - 0, 30, 31, 0, 0, 32, 33, 14, 15, 34, - 16, 0, 0, 35, 36, 37, 0, 18, 19, 0, - 20, 0, 21, 0, 0, 0, 0, 0, 206, 0, - 0, 12, 0, 0, 13, 0, 0, 0, 0, 0, - 22, 0, 0, 0, 0, 0, 0, 0, 23, 24, - 25, 26, 27, 28, 0, 0, 0, 29, 0, 30, - 31, 0, 0, 32, 33, 14, 15, 34, 16, 0, - 0, 35, 36, 37, 0, 18, 19, 0, 20, 0, - 21, 0, 0, 0, 0, 0, 221, 0, 0, 12, - 0, 0, 13, 0, 0, 0, 0, 0, 22, 0, - 0, 0, 0, 0, 0, 0, 23, 24, 25, 26, - 27, 28, 0, 0, 0, 29, 0, 30, 31, 0, - 0, 32, 33, 14, 15, 34, 16, 0, 0, 35, - 36, 37, 0, 18, 19, 0, 20, 0, 21, 0, - 0, 0, 0, 0, 204, 0, 0, 294, 0, 0, - 13, 0, 0, 0, 0, 0, 22, 0, 0, 0, - 0, 0, 0, 0, 23, 24, 25, 26, 27, 28, - 0, 0, 0, 29, 0, 30, 31, 0, 0, 32, - 33, 14, 15, 34, 16, 0, 0, 35, 36, 37, - 0, 18, 19, 0, 20, 0, 21, 0, 0, 0, - 0, 0, 206, 0, 0, 294, 0, 0, 13, 0, - 0, 0, 0, 0, 22, 0, 0, 0, 0, 0, - 0, 0, 23, 24, 25, 26, 27, 28, 0, 0, - 0, 29, 0, 30, 31, 0, 0, 32, 33, 14, - 15, 34, 16, 0, 0, 35, 36, 37, 0, 18, - 19, 0, 20, 0, 21, 0, 0, 0, 0, 0, - 221, 0, 0, 294, 0, 0, 13, 0, 0, 0, - 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, - 23, 24, 25, 26, 27, 28, 0, 0, 0, 29, - 0, 30, 31, 0, 0, 32, 33, 14, 15, 34, - 16, 0, 0, 35, 36, 37, 0, 18, 19, 0, - 20, 0, 21, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 22, 0, 0, 0, 0, 0, 0, 0, 23, 24, - 25, 26, 27, 28, 0, 0, 0, 29, 0, 30, - 31, 0, 0, 32, 33, 0, 0, 34, 0, 0, - 0, 35, 36, 37, 138, 0, 58, 109, 0, 0, - 139, 0, 0, 0, 0, 0, 0, 110, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 111, 112, 0, 113, 114, 115, 116, 117, 118, 119, - 14, 15, 0, 16, 0, 0, 0, 0, 0, 0, - 18, 19, 0, 20, 0, 21, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, - 0, 23, 24, 25, 26, 27, 28, 0, 120, 0, - 29, 0, 30, 31, 0, 0, 32, 33, 0, 0, - 59, 0, 0, 0, 35, 36, 37, 138, 0, 58, - 109, 0, 0, 319, 0, 0, 0, 0, 0, 0, - 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 111, 112, 0, 113, 114, 115, 116, - 117, 118, 119, 14, 15, 0, 16, 0, 0, 0, - 0, 0, 0, 18, 19, 0, 20, 0, 21, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, - 0, 0, 0, 0, 23, 24, 25, 26, 27, 28, - 0, 120, 0, 29, 0, 30, 31, 0, 0, 32, - 33, 0, 0, 59, 0, 0, 0, 35, 36, 37, - 138, 0, 58, 109, 0, 0, 330, 0, 0, 0, - 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 111, 112, 0, 113, - 114, 115, 116, 117, 118, 119, 14, 15, 0, 16, - 0, 0, 0, 0, 0, 0, 18, 19, 0, 20, - 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, - 0, 0, 0, 0, 0, 0, 0, 23, 24, 25, - 26, 27, 28, 0, 120, 0, 29, 0, 30, 31, - 0, 0, 32, 33, 0, 0, 59, 0, 0, 0, - 35, 36, 37, 138, 0, 58, 109, 0, 0, 332, - 0, 0, 0, 0, 0, 0, 110, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, - 112, 0, 113, 114, 115, 116, 117, 118, 119, 14, - 15, 0, 16, 0, 0, 0, 0, 0, 0, 18, - 19, 0, 20, 0, 21, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, - 23, 24, 25, 26, 27, 28, 0, 120, 0, 29, - 0, 30, 31, 0, 0, 32, 33, 0, 138, 59, - 58, 109, 0, 35, 36, 37, 0, 0, 0, 0, - 0, 110, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 111, 112, 0, 113, 114, 115, - 116, 117, 118, 119, 14, 15, 0, 16, 0, 0, - 0, 0, 0, 0, 18, 19, 0, 20, 0, 21, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, - 0, 0, 0, 0, 0, 23, 24, 25, 26, 27, - 28, 0, 120, 0, 29, 0, 30, 31, 0, 0, - 32, 33, 58, 109, 59, 0, 139, 0, 35, 36, - 37, 0, 0, 110, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 111, 112, 0, 113, - 114, 115, 116, 117, 118, 119, 14, 15, 0, 16, - 0, 0, 0, 0, 0, 0, 18, 19, 0, 20, - 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, - 0, 0, 0, 0, 0, 0, 0, 23, 24, 25, - 26, 27, 28, 0, 120, 0, 29, 0, 30, 31, - 0, 0, 32, 33, 58, 109, 59, 0, 0, 0, - 35, 36, 37, 0, 0, 110, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 111, 112, - 0, 113, 114, 115, 116, 117, 118, 119, 14, 15, - 0, 16, 0, 0, 0, 0, 0, 0, 18, 19, - 0, 20, 0, 21, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 22, 0, 0, 0, 0, 0, 0, 0, 23, - 24, 25, 26, 27, 28, 0, 120, 268, 29, 0, - 30, 31, 0, 0, 32, 33, 58, 109, 59, 0, - 275, 0, 35, 36, 37, 0, 0, 110, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 111, 112, 0, 113, 114, 115, 116, 117, 118, 119, - 14, 15, 0, 16, 0, 0, 0, 0, 0, 0, - 18, 19, 0, 20, 0, 21, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, - 0, 23, 24, 25, 26, 27, 28, 0, 120, 0, - 29, 0, 30, 31, 0, 0, 32, 33, 58, 109, - 59, 0, 313, 0, 35, 36, 37, 0, 0, 110, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 111, 112, 0, 113, 114, 115, 116, 117, - 118, 119, 14, 15, 0, 16, 0, 0, 0, 0, - 0, 0, 18, 19, 0, 20, 0, 21, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, - 0, 0, 0, 23, 24, 25, 26, 27, 28, 0, - 120, 0, 29, 0, 30, 31, 0, 0, 32, 33, - 58, 109, 59, 0, 315, 0, 35, 36, 37, 0, - 0, 110, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 111, 112, 0, 113, 114, 115, - 116, 117, 118, 119, 14, 15, 0, 16, 0, 0, - 0, 0, 0, 0, 18, 19, 0, 20, 0, 21, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, - 0, 0, 0, 0, 0, 23, 24, 25, 26, 27, - 28, 0, 120, 0, 29, 0, 30, 31, 0, 0, - 32, 33, 58, 109, 59, 0, 349, 0, 35, 36, - 37, 0, 0, 110, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 111, 112, 0, 113, - 114, 115, 116, 117, 118, 119, 14, 15, 0, 16, - 0, 0, 0, 0, 0, 0, 18, 19, 0, 20, - 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, - 0, 0, 0, 0, 0, 0, 0, 23, 24, 25, - 26, 27, 28, 0, 120, 0, 29, 0, 30, 31, - 0, 0, 32, 33, 58, 109, 59, 0, 351, 0, - 35, 36, 37, 0, 0, 110, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 111, 112, - 0, 113, 114, 115, 116, 117, 118, 119, 14, 15, - 0, 16, 0, 0, 0, 0, 0, 0, 18, 19, - 0, 20, 0, 21, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 22, 0, 0, 0, 0, 0, 0, 0, 23, - 24, 25, 26, 27, 28, 0, 120, 0, 29, 0, - 30, 31, 0, 0, 32, 33, 0, 0, 59, 58, - 109, 353, 35, 36, 37, 0, 0, 0, 0, 0, - 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 111, 112, 0, 113, 114, 115, 116, - 117, 118, 119, 14, 15, 0, 16, 0, 0, 0, - 0, 0, 0, 18, 19, 0, 20, 0, 21, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 22, 0, 0, 0, - 0, 0, 0, 0, 23, 24, 25, 26, 27, 28, - 0, 120, 0, 29, 0, 30, 31, 0, 0, 32, - 33, 58, 109, 59, 0, 362, 0, 35, 36, 37, - 0, 0, 110, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 111, 112, 0, 113, 114, - 115, 116, 117, 118, 119, 14, 15, 0, 16, 0, - 0, 0, 0, 0, 0, 18, 19, 0, 20, 0, - 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, - 0, 0, 0, 0, 0, 0, 23, 24, 25, 26, - 27, 28, 0, 120, 0, 29, 0, 30, 31, 0, - 0, 32, 33, 58, 109, 59, 0, 0, 0, 35, - 36, 37, 0, 0, 110, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 111, 112, 0, - 113, 114, 115, 116, 117, 118, 119, 14, 15, 0, - 16, 0, 0, 0, 0, 0, 0, 18, 19, 0, - 20, 0, 21, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 22, 0, 0, 0, 0, 0, 0, 0, 23, 24, - 25, 26, 27, 28, 0, 120, 0, 29, 0, 30, - 31, 0, 0, 32, 33, 58, 109, 59, 0, 0, - 0, 35, 36, 37, 0, 0, 110, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, - 0, 0, 113, 114, 115, 116, 117, 118, 119, 14, - 15, 0, 16, 0, 0, 0, 0, 0, 0, 18, - 19, 0, 20, 0, 21, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, - 23, 24, 25, 26, 27, 28, 58, 109, 0, 29, - 0, 30, 31, 0, 0, 32, 33, 110, 0, 59, - 0, 0, 0, 35, 36, 37, 0, 0, 0, 0, - 0, 0, 0, 113, 114, 115, 116, 117, 118, 119, - 14, 15, 0, 16, 0, 0, 0, 0, 0, 0, - 18, 19, 0, 20, 0, 21, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, - 0, 23, 24, 25, 26, 27, 28, 58, -32, 0, - 29, 0, 30, 31, 0, 0, 32, 33, -32, 0, - 59, 0, 0, 0, 35, 36, 37, 0, 0, 0, - 0, 0, 0, 0, -32, -32, -32, -32, -32, -32, - -32, 14, 15, 0, 16, 0, 0, 0, 0, 0, - 0, 18, 19, 0, 20, 58, 21, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 253, 0, 0, 0, - 0, 0, 0, 0, 22, 0, 0, 0, 0, 111, - 112, 0, 23, 24, 25, 26, 27, 28, 254, 14, - 15, 0, 16, 30, 31, 0, 0, 32, 33, 18, - 19, 59, 20, 0, 21, 35, 36, 37, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, - 23, 24, 25, 26, 27, 28, 58, 255, 328, 29, - 0, 30, 31, 0, 0, 32, 33, 253, 0, 59, - 0, 0, 0, 35, 36, 37, 0, 0, 0, 0, - 111, 112, 0, 0, 0, 0, 0, 0, 0, 254, - 14, 15, 0, 16, 0, 0, 0, 0, 0, 0, - 18, 19, 0, 20, 0, 21, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 22, 0, 0, 0, 0, 58, 0, - 0, 23, 24, 25, 26, 27, 28, 0, 255, 253, - 29, 0, 30, 31, 0, 0, 32, 33, 0, 0, - 59, 0, 111, 0, 35, 36, 37, 0, 0, 0, - 0, 254, 14, 15, 0, 16, 0, 0, 0, 0, - 0, 0, 18, 19, 0, 20, 12, 21, 0, 13, - 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, - 0, 0, 0, 23, 24, 25, 26, 27, 28, 0, - 14, 15, 29, 16, 30, 31, 0, 0, 32, 33, - 18, 19, 59, 20, 0, 21, 35, 36, 37, 0, - 0, 0, 0, 0, 12, 0, 0, 13, 152, 0, - 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, - 0, 23, 24, 25, 26, 27, 28, 0, 0, 0, - 29, 0, 30, 31, 0, 0, 32, 33, 14, 15, - 34, 16, 0, 0, 35, 36, 37, 0, 18, 19, - 0, 20, 58, 21, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 253, 0, 0, 0, 0, 0, 0, - 0, 22, 0, 0, 0, 0, 0, 0, 0, 23, - 24, 25, 26, 27, 28, 254, 14, 15, 29, 16, - 30, 31, 0, 0, 32, 33, 18, 19, 34, 20, - 0, 21, 35, 36, 37, 0, 0, 0, 0, 0, - 12, 0, 0, 13, 0, 0, 0, 0, 0, 22, - 0, 0, 0, 0, 0, 0, 0, 23, 24, 25, - 26, 27, 28, 0, 0, 0, 29, 0, 30, 31, - 0, 0, 32, 33, 14, 15, 59, 16, 0, 0, - 35, 36, 37, 0, 18, 19, 0, 20, 58, 21, - 0, 13, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, - 0, 0, 0, 0, 0, 23, 24, 25, 26, 27, - 28, 0, 14, 15, 29, 16, 30, 31, 0, 0, - 32, 33, 18, 19, 34, 20, 0, 21, 35, 36, - 37, 0, 0, 0, 0, 0, 179, 0, 0, 13, - 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, - 0, 0, 0, 23, 24, 25, 26, 27, 28, 0, - 0, 0, 29, 0, 30, 31, 0, 0, 32, 33, - 14, 15, 34, 16, 0, 0, 35, 36, 37, 0, - 18, 19, 0, 20, 58, 21, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, - 0, 23, 24, 25, 26, 27, 28, 0, 14, 15, - 29, 16, 30, 31, 0, 0, 32, 33, 18, 19, - 34, 20, 0, 21, 35, 36, 37, 0, 0, 0, - 0, 0, 210, 0, 0, 0, 0, 0, 0, 0, - 0, 22, 294, 0, 0, 13, 0, 0, 0, 23, - 24, 25, 26, 27, 28, 0, 0, 0, 29, 0, - 30, 31, 0, 0, 32, 33, 0, 0, 59, 0, - 0, 0, 35, 36, 37, 0, 14, 15, 0, 16, - 0, 0, 0, 0, 0, 0, 18, 19, 0, 20, - 58, 21, 0, 0, 0, 0, 0, 0, 0, 0, - 0, -32, 0, 0, 0, 0, 0, 0, 0, 22, - 0, 0, 0, 0, 0, 0, 0, 23, 24, 25, - 26, 27, 28, -32, 14, 15, 29, 16, 30, 31, - 0, 0, 32, 33, 18, 19, 34, 20, 58, 21, - 35, 36, 37, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, - 0, 0, 0, 0, 0, 23, 24, 25, 26, 27, - 28, 0, 14, 15, 0, 16, 30, 31, 0, 0, - 32, 33, 18, 19, 59, 20, 0, 21, 35, 36, - 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 22, 0, 0, 0, 0, - 0, 0, 0, 23, 24, 25, 26, 27, 28, 0, - 0, 0, 29, 0, 30, 31, 0, 0, 32, 33, - 0, 0, 59, 0, 0, 0, 35, 36, 37 -}; - -static const yytype_int16 yycheck[] = -{ - 16, 5, 34, 168, 179, 9, 10, 18, 110, 82, - 0, 9, 15, 29, 11, 9, 32, 33, 34, 35, - 36, 37, 124, 338, 67, 68, 42, 52, 53, 244, - 92, 246, 46, 106, 45, 39, 70, 10, 54, 106, - 70, 12, 9, 59, 84, 360, 19, 87, 46, 10, - 90, 91, 12, 69, 94, 16, 12, 10, 15, 54, - 55, 253, 102, 255, 256, 257, 19, 259, 12, 101, - 13, 263, 10, 87, 99, 89, 110, 111, 16, 46, - 110, 111, 107, 12, 100, 101, 10, 11, 161, 87, - 10, 89, 135, 87, 161, 38, 16, 10, 41, 102, - 103, 104, 105, 16, 108, 87, 109, 12, 90, 324, - 126, 127, 128, 129, 130, 131, 12, 10, 12, 294, - 87, 88, 89, 16, 43, 12, 166, 46, 230, 231, - 146, 147, 172, 149, 150, 18, 328, 352, 10, 155, - 156, 157, 110, 111, 16, 112, 93, 104, 105, 364, - 166, 253, 109, 10, 149, 150, 172, 10, 43, 16, - 9, 156, 157, 16, 180, 14, 9, 9, 87, 88, - 89, 14, 14, 338, 109, 9, 12, 193, 194, 180, - 196, 197, 198, 199, 200, 201, 181, 203, 85, 205, - 12, 207, 208, 112, 210, 360, 239, 9, 12, 9, - 45, 217, 14, 87, 96, 9, 222, 15, 224, 18, - 80, 10, 285, 208, 209, 9, 318, 14, 285, 9, - 16, 253, 119, 255, 256, 257, 180, 259, 244, 16, - 246, 263, 100, 16, 229, 12, 16, 253, 45, 255, - 256, 257, 16, 259, 260, 261, 262, 263, 16, 322, - 41, 190, 16, 108, -1, 322, -1, 252, 274, -1, - -1, 265, 278, -1, 280, -1, -1, 283, 32, 33, - 34, 168, -1, 37, -1, -1, -1, -1, 42, 295, - 353, 306, 298, 299, 300, 301, 353, 282, 283, 305, - 54, 307, 308, 309, 295, 59, 328, 298, 299, 300, - 301, -1, -1, -1, 305, 69, -1, 46, 312, 334, - -1, -1, 328, 308, 309, 331, -1, 333, -1, 335, - -1, 337, 362, 339, -1, -1, 223, -1, 344, -1, - -1, -1, 327, -1, -1, -1, 100, 101, 235, 355, - -1, 295, -1, 344, 298, 299, 300, 301, 87, 88, - 89, 305, -1, -1, -1, -1, -1, 254, -1, -1, - -1, -1, 126, 127, 128, 129, 130, 131, -1, -1, - -1, -1, -1, 112, -1, -1, -1, -1, -1, -1, - -1, -1, 146, 147, -1, 149, 150, -1, -1, 286, - 344, 155, 156, 157, -1, -1, -1, -1, -1, -1, - -1, -1, 166, -1, -1, -1, -1, -1, 172, -1, - -1, -1, -1, -1, -1, -1, 180, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 326, - 194, -1, 196, 197, 198, 199, 200, 201, -1, 203, - -1, 205, -1, 207, 208, -1, 210, -1, -1, -1, - -1, -1, -1, 217, -1, -1, -1, -1, 222, -1, - 224, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 98, - 244, -1, 246, -1, -1, 104, -1, 5, -1, 253, - -1, 255, 256, 257, 12, 259, 260, 261, 262, 263, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 274, -1, -1, -1, 278, -1, 280, 136, 137, 283, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 295, -1, -1, 298, 299, 300, 301, -1, 57, - 58, 305, -1, 307, 308, 309, -1, 65, 66, 67, - 68, -1, -1, 71, 72, -1, -1, 176, -1, 178, - -1, -1, -1, -1, 328, -1, -1, -1, -1, 87, - 189, 335, 191, 337, -1, 339, 94, -1, -1, -1, - 344, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 108, 355, 110, -1, -1, 113, 114, 115, 116, 117, - 118, -1, 120, 121, 122, -1, 124, -1, -1, -1, - -1, -1, -1, -1, 132, -1, -1, 135, -1, -1, - -1, -1, 140, -1, 142, -1, -1, -1, -1, -1, - 249, -1, -1, -1, -1, 0, 1, -1, -1, -1, - -1, -1, 7, 8, 9, -1, 11, 12, -1, 14, - 15, 169, -1, -1, -1, -1, 174, -1, -1, -1, - -1, 179, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 190, -1, -1, -1, -1, -1, -1, -1, - -1, 46, 47, -1, 49, -1, -1, -1, -1, -1, - 55, 56, 57, -1, 59, -1, 61, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 227, - 329, -1, 230, 231, 79, -1, -1, -1, 236, -1, - -1, 239, 87, 88, 89, 90, 91, 92, -1, 348, - -1, 96, -1, 98, 99, 354, -1, 102, 103, -1, - -1, 106, -1, -1, 363, 110, 111, 112, -1, 368, - 268, 269, 270, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, - -1, -1, 9, -1, 11, 12, 294, 14, 15, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 318, -1, 320, -1, -1, 323, -1, -1, -1, 46, - 47, 48, 49, 50, 51, 52, 53, 54, -1, 56, - 57, 58, 59, 341, 61, 62, 63, -1, -1, -1, - -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, - 77, 78, 79, 11, 12, -1, 14, 15, -1, 17, - 87, 88, 89, 90, 91, 92, -1, -1, -1, 96, - 97, 98, 99, 100, -1, 102, 103, -1, -1, 106, - -1, -1, -1, 110, 111, 112, -1, -1, 46, 47, - 48, 49, 50, 51, 52, 53, 54, -1, 56, 57, - 58, 59, -1, 61, 62, 63, -1, -1, -1, -1, - -1, -1, 1, -1, -1, -1, -1, -1, -1, 77, - 78, 79, 11, 12, -1, 14, 15, -1, 17, 87, - 88, 89, 90, 91, 92, -1, -1, -1, 96, 97, - 98, 99, 100, -1, 102, 103, -1, -1, 106, -1, - -1, -1, 110, 111, 112, -1, -1, 46, 47, 48, - 49, 50, 51, 52, 53, 54, -1, 56, 57, 58, - 59, -1, 61, 62, 63, -1, -1, -1, -1, -1, - -1, 1, -1, -1, -1, -1, -1, -1, 77, 78, - 79, 11, 12, -1, 14, 15, -1, 17, 87, 88, - 89, 90, 91, 92, -1, -1, -1, 96, 97, 98, - 99, 100, -1, 102, 103, -1, -1, 106, -1, -1, - -1, 110, 111, 112, -1, -1, 46, 47, 48, 49, - 50, 51, 52, 53, 54, -1, 56, 57, 58, 59, - -1, 61, 62, 63, -1, -1, -1, -1, -1, -1, - 1, -1, -1, -1, -1, -1, -1, 77, 78, 79, - 11, 12, -1, 14, 15, -1, 17, 87, 88, 89, - 90, 91, 92, -1, -1, -1, 96, 97, 98, 99, - 100, -1, 102, 103, -1, -1, 106, -1, -1, -1, - 110, 111, 112, -1, -1, 46, 47, 48, 49, 50, - 51, 52, 53, 54, -1, 56, 57, 58, 59, -1, - 61, 62, 63, -1, -1, -1, -1, -1, -1, 1, - -1, -1, -1, -1, -1, -1, 77, 78, 79, 11, - 12, -1, 14, 15, -1, 17, 87, 88, 89, 90, - 91, 92, -1, -1, -1, 96, 97, 98, 99, 100, - -1, 102, 103, -1, -1, 106, -1, -1, -1, 110, - 111, 112, -1, -1, 46, 47, 48, 49, 50, 51, - 52, 53, 54, -1, 56, 57, 58, 59, -1, 61, - 62, 63, -1, -1, -1, -1, -1, -1, -1, -1, - 1, -1, -1, -1, -1, 77, 78, 79, 9, -1, - 11, 12, -1, 14, 15, 87, 88, 89, 90, 91, - 92, -1, -1, -1, 96, 97, 98, 99, 100, -1, - 102, 103, -1, -1, 106, -1, -1, -1, 110, 111, - 112, -1, -1, -1, -1, 46, 47, 48, 49, 50, - 51, 52, 53, 54, -1, 56, 57, 58, 59, -1, - 61, 62, 63, -1, -1, -1, -1, -1, -1, 1, - -1, -1, -1, -1, -1, -1, 77, 78, 79, 11, - 12, -1, 14, 15, -1, 17, 87, 88, 89, 90, - 91, 92, -1, -1, -1, 96, 97, 98, 99, 100, - -1, 102, 103, -1, -1, 106, -1, -1, -1, 110, - 111, 112, -1, -1, 46, 47, 48, 49, 50, 51, - 52, 53, 54, -1, 56, 57, 58, 59, -1, 61, - 62, 63, -1, -1, -1, -1, -1, -1, 1, -1, - -1, -1, -1, -1, -1, 77, 78, 79, 11, 12, - -1, 14, 15, -1, 17, 87, 88, 89, 90, 91, - 92, -1, -1, -1, 96, 97, 98, 99, 100, -1, - 102, 103, -1, -1, 106, -1, -1, -1, 110, 111, - 112, -1, -1, 46, 47, 48, 49, 50, 51, 52, - 53, 54, -1, 56, 57, 58, 59, -1, 61, 62, - 63, -1, -1, -1, -1, -1, -1, 1, -1, -1, - -1, -1, -1, -1, 77, 78, 79, 11, 12, -1, - 14, 15, -1, -1, 87, 88, 89, 90, 91, 92, - -1, -1, -1, 96, 97, 98, 99, 100, -1, 102, - 103, -1, -1, 106, -1, -1, -1, 110, 111, 112, - -1, -1, 46, 47, 48, 49, 50, 51, 52, 53, - 54, -1, 56, 57, 58, 59, -1, 61, 62, 63, - -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, - -1, -1, -1, 77, 78, 79, 12, -1, 14, 15, - -1, -1, -1, 87, 88, 89, 90, 91, 92, -1, - -1, -1, 96, 97, 98, 99, 100, -1, 102, 103, - -1, -1, 106, -1, -1, -1, 110, 111, 112, -1, - 46, 47, -1, 49, -1, 51, -1, -1, -1, -1, - 56, 57, -1, 59, -1, 61, -1, -1, -1, -1, - -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, - -1, 77, 78, 79, 12, -1, -1, 15, 16, -1, - -1, 87, 88, 89, 90, 91, 92, -1, -1, -1, - 96, -1, 98, 99, -1, -1, 102, 103, -1, -1, - 106, -1, -1, -1, 110, 111, 112, -1, 46, 47, - -1, 49, -1, 51, -1, -1, -1, -1, 56, 57, - -1, 59, -1, 61, -1, -1, -1, 7, 8, -1, - -1, 11, 12, -1, -1, 15, -1, -1, -1, 77, - 78, 79, -1, -1, -1, -1, -1, -1, -1, 87, - 88, 89, 90, 91, 92, -1, -1, -1, 96, -1, - 98, 99, -1, -1, 102, 103, 46, 47, 106, 49, - -1, -1, 110, 111, 112, 55, 56, 57, -1, 59, - -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 79, - -1, -1, -1, -1, -1, -1, -1, 87, 88, 89, - 90, 91, 92, -1, -1, -1, 96, -1, 98, 99, - -1, -1, 102, 103, 9, -1, 106, 12, 13, 14, - 110, 111, 112, -1, -1, -1, -1, -1, 23, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 36, 37, -1, 39, 40, 41, 42, 43, 44, - 45, 46, 47, -1, 49, -1, -1, -1, -1, -1, - -1, 56, 57, -1, 59, -1, 61, -1, -1, -1, - -1, -1, 9, -1, -1, 12, -1, 14, 15, -1, - -1, -1, -1, -1, 79, -1, -1, -1, -1, -1, - -1, -1, 87, 88, 89, 90, 91, 92, -1, 94, - -1, 96, -1, 98, 99, -1, -1, 102, 103, 46, - 47, 106, 49, -1, -1, 110, 111, 112, -1, 56, - 57, -1, 59, -1, 61, -1, -1, -1, -1, -1, - 9, -1, -1, 12, -1, -1, 15, -1, -1, -1, - -1, -1, 79, -1, -1, -1, -1, -1, -1, -1, - 87, 88, 89, 90, 91, 92, -1, -1, -1, 96, - -1, 98, 99, -1, -1, 102, 103, 46, 47, 106, - 49, -1, -1, 110, 111, 112, -1, 56, 57, -1, - 59, -1, 61, -1, -1, -1, -1, -1, 9, -1, - -1, 12, -1, -1, 15, -1, -1, -1, -1, -1, - 79, -1, -1, -1, -1, -1, -1, -1, 87, 88, - 89, 90, 91, 92, -1, -1, -1, 96, -1, 98, - 99, -1, -1, 102, 103, 46, 47, 106, 49, -1, - -1, 110, 111, 112, -1, 56, 57, -1, 59, -1, - 61, -1, -1, -1, -1, -1, 9, -1, -1, 12, - -1, -1, 15, -1, -1, -1, -1, -1, 79, -1, - -1, -1, -1, -1, -1, -1, 87, 88, 89, 90, - 91, 92, -1, -1, -1, 96, -1, 98, 99, -1, - -1, 102, 103, 46, 47, 106, 49, -1, -1, 110, - 111, 112, -1, 56, 57, -1, 59, -1, 61, -1, - -1, -1, -1, -1, 9, -1, -1, 12, -1, -1, - 15, -1, -1, -1, -1, -1, 79, -1, -1, -1, - -1, -1, -1, -1, 87, 88, 89, 90, 91, 92, - -1, -1, -1, 96, -1, 98, 99, -1, -1, 102, - 103, 46, 47, 106, 49, -1, -1, 110, 111, 112, - -1, 56, 57, -1, 59, -1, 61, -1, -1, -1, - -1, -1, 9, -1, -1, 12, -1, -1, 15, -1, - -1, -1, -1, -1, 79, -1, -1, -1, -1, -1, - -1, -1, 87, 88, 89, 90, 91, 92, -1, -1, - -1, 96, -1, 98, 99, -1, -1, 102, 103, 46, - 47, 106, 49, -1, -1, 110, 111, 112, -1, 56, - 57, -1, 59, -1, 61, -1, -1, -1, -1, -1, - 9, -1, -1, 12, -1, -1, 15, -1, -1, -1, - -1, -1, 79, -1, -1, -1, -1, -1, -1, -1, - 87, 88, 89, 90, 91, 92, -1, -1, -1, 96, - -1, 98, 99, -1, -1, 102, 103, 46, 47, 106, - 49, -1, -1, 110, 111, 112, -1, 56, 57, -1, - 59, -1, 61, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 79, -1, -1, -1, -1, -1, -1, -1, 87, 88, - 89, 90, 91, 92, -1, -1, -1, 96, -1, 98, - 99, -1, -1, 102, 103, -1, -1, 106, -1, -1, - -1, 110, 111, 112, 10, -1, 12, 13, -1, -1, - 16, -1, -1, -1, -1, -1, -1, 23, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 36, 37, -1, 39, 40, 41, 42, 43, 44, 45, - 46, 47, -1, 49, -1, -1, -1, -1, -1, -1, - 56, 57, -1, 59, -1, 61, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, - -1, 87, 88, 89, 90, 91, 92, -1, 94, -1, - 96, -1, 98, 99, -1, -1, 102, 103, -1, -1, - 106, -1, -1, -1, 110, 111, 112, 10, -1, 12, - 13, -1, -1, 16, -1, -1, -1, -1, -1, -1, - 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 36, 37, -1, 39, 40, 41, 42, - 43, 44, 45, 46, 47, -1, 49, -1, -1, -1, - -1, -1, -1, 56, 57, -1, 59, -1, 61, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 79, -1, -1, -1, - -1, -1, -1, -1, 87, 88, 89, 90, 91, 92, - -1, 94, -1, 96, -1, 98, 99, -1, -1, 102, - 103, -1, -1, 106, -1, -1, -1, 110, 111, 112, - 10, -1, 12, 13, -1, -1, 16, -1, -1, -1, - -1, -1, -1, 23, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 36, 37, -1, 39, - 40, 41, 42, 43, 44, 45, 46, 47, -1, 49, - -1, -1, -1, -1, -1, -1, 56, 57, -1, 59, - -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 79, - -1, -1, -1, -1, -1, -1, -1, 87, 88, 89, - 90, 91, 92, -1, 94, -1, 96, -1, 98, 99, - -1, -1, 102, 103, -1, -1, 106, -1, -1, -1, - 110, 111, 112, 10, -1, 12, 13, -1, -1, 16, - -1, -1, -1, -1, -1, -1, 23, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 36, - 37, -1, 39, 40, 41, 42, 43, 44, 45, 46, - 47, -1, 49, -1, -1, -1, -1, -1, -1, 56, - 57, -1, 59, -1, 61, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 79, -1, -1, -1, -1, -1, -1, -1, - 87, 88, 89, 90, 91, 92, -1, 94, -1, 96, - -1, 98, 99, -1, -1, 102, 103, -1, 10, 106, - 12, 13, -1, 110, 111, 112, -1, -1, -1, -1, - -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 36, 37, -1, 39, 40, 41, - 42, 43, 44, 45, 46, 47, -1, 49, -1, -1, - -1, -1, -1, -1, 56, 57, -1, 59, -1, 61, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 79, -1, -1, - -1, -1, -1, -1, -1, 87, 88, 89, 90, 91, - 92, -1, 94, -1, 96, -1, 98, 99, -1, -1, - 102, 103, 12, 13, 106, -1, 16, -1, 110, 111, - 112, -1, -1, 23, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 36, 37, -1, 39, - 40, 41, 42, 43, 44, 45, 46, 47, -1, 49, - -1, -1, -1, -1, -1, -1, 56, 57, -1, 59, - -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 79, - -1, -1, -1, -1, -1, -1, -1, 87, 88, 89, - 90, 91, 92, -1, 94, -1, 96, -1, 98, 99, - -1, -1, 102, 103, 12, 13, 106, -1, -1, -1, - 110, 111, 112, -1, -1, 23, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 36, 37, - -1, 39, 40, 41, 42, 43, 44, 45, 46, 47, - -1, 49, -1, -1, -1, -1, -1, -1, 56, 57, - -1, 59, -1, 61, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 79, -1, -1, -1, -1, -1, -1, -1, 87, - 88, 89, 90, 91, 92, -1, 94, 95, 96, -1, - 98, 99, -1, -1, 102, 103, 12, 13, 106, -1, - 16, -1, 110, 111, 112, -1, -1, 23, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 36, 37, -1, 39, 40, 41, 42, 43, 44, 45, - 46, 47, -1, 49, -1, -1, -1, -1, -1, -1, - 56, 57, -1, 59, -1, 61, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, - -1, 87, 88, 89, 90, 91, 92, -1, 94, -1, - 96, -1, 98, 99, -1, -1, 102, 103, 12, 13, - 106, -1, 16, -1, 110, 111, 112, -1, -1, 23, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 36, 37, -1, 39, 40, 41, 42, 43, - 44, 45, 46, 47, -1, 49, -1, -1, -1, -1, - -1, -1, 56, 57, -1, 59, -1, 61, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 79, -1, -1, -1, -1, - -1, -1, -1, 87, 88, 89, 90, 91, 92, -1, - 94, -1, 96, -1, 98, 99, -1, -1, 102, 103, - 12, 13, 106, -1, 16, -1, 110, 111, 112, -1, - -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 36, 37, -1, 39, 40, 41, - 42, 43, 44, 45, 46, 47, -1, 49, -1, -1, - -1, -1, -1, -1, 56, 57, -1, 59, -1, 61, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 79, -1, -1, - -1, -1, -1, -1, -1, 87, 88, 89, 90, 91, - 92, -1, 94, -1, 96, -1, 98, 99, -1, -1, - 102, 103, 12, 13, 106, -1, 16, -1, 110, 111, - 112, -1, -1, 23, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 36, 37, -1, 39, - 40, 41, 42, 43, 44, 45, 46, 47, -1, 49, - -1, -1, -1, -1, -1, -1, 56, 57, -1, 59, - -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 79, - -1, -1, -1, -1, -1, -1, -1, 87, 88, 89, - 90, 91, 92, -1, 94, -1, 96, -1, 98, 99, - -1, -1, 102, 103, 12, 13, 106, -1, 16, -1, - 110, 111, 112, -1, -1, 23, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 36, 37, - -1, 39, 40, 41, 42, 43, 44, 45, 46, 47, - -1, 49, -1, -1, -1, -1, -1, -1, 56, 57, - -1, 59, -1, 61, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 79, -1, -1, -1, -1, -1, -1, -1, 87, - 88, 89, 90, 91, 92, -1, 94, -1, 96, -1, - 98, 99, -1, -1, 102, 103, -1, -1, 106, 12, - 13, 14, 110, 111, 112, -1, -1, -1, -1, -1, - 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 36, 37, -1, 39, 40, 41, 42, - 43, 44, 45, 46, 47, -1, 49, -1, -1, -1, - -1, -1, -1, 56, 57, -1, 59, -1, 61, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 79, -1, -1, -1, - -1, -1, -1, -1, 87, 88, 89, 90, 91, 92, - -1, 94, -1, 96, -1, 98, 99, -1, -1, 102, - 103, 12, 13, 106, -1, 16, -1, 110, 111, 112, - -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 36, 37, -1, 39, 40, - 41, 42, 43, 44, 45, 46, 47, -1, 49, -1, - -1, -1, -1, -1, -1, 56, 57, -1, 59, -1, - 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 79, -1, - -1, -1, -1, -1, -1, -1, 87, 88, 89, 90, - 91, 92, -1, 94, -1, 96, -1, 98, 99, -1, - -1, 102, 103, 12, 13, 106, -1, -1, -1, 110, - 111, 112, -1, -1, 23, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 36, 37, -1, - 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, - 49, -1, -1, -1, -1, -1, -1, 56, 57, -1, - 59, -1, 61, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 79, -1, -1, -1, -1, -1, -1, -1, 87, 88, - 89, 90, 91, 92, -1, 94, -1, 96, -1, 98, - 99, -1, -1, 102, 103, 12, 13, 106, -1, -1, - -1, 110, 111, 112, -1, -1, 23, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 36, - -1, -1, 39, 40, 41, 42, 43, 44, 45, 46, - 47, -1, 49, -1, -1, -1, -1, -1, -1, 56, - 57, -1, 59, -1, 61, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 79, -1, -1, -1, -1, -1, -1, -1, - 87, 88, 89, 90, 91, 92, 12, 13, -1, 96, - -1, 98, 99, -1, -1, 102, 103, 23, -1, 106, - -1, -1, -1, 110, 111, 112, -1, -1, -1, -1, - -1, -1, -1, 39, 40, 41, 42, 43, 44, 45, - 46, 47, -1, 49, -1, -1, -1, -1, -1, -1, - 56, 57, -1, 59, -1, 61, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, - -1, 87, 88, 89, 90, 91, 92, 12, 13, -1, - 96, -1, 98, 99, -1, -1, 102, 103, 23, -1, - 106, -1, -1, -1, 110, 111, 112, -1, -1, -1, - -1, -1, -1, -1, 39, 40, 41, 42, 43, 44, - 45, 46, 47, -1, 49, -1, -1, -1, -1, -1, - -1, 56, 57, -1, 59, 12, 61, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 23, -1, -1, -1, - -1, -1, -1, -1, 79, -1, -1, -1, -1, 36, - 37, -1, 87, 88, 89, 90, 91, 92, 45, 46, - 47, -1, 49, 98, 99, -1, -1, 102, 103, 56, - 57, 106, 59, -1, 61, 110, 111, 112, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 79, -1, -1, -1, -1, -1, -1, -1, - 87, 88, 89, 90, 91, 92, 12, 94, 95, 96, - -1, 98, 99, -1, -1, 102, 103, 23, -1, 106, - -1, -1, -1, 110, 111, 112, -1, -1, -1, -1, - 36, 37, -1, -1, -1, -1, -1, -1, -1, 45, - 46, 47, -1, 49, -1, -1, -1, -1, -1, -1, - 56, 57, -1, 59, -1, 61, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 79, -1, -1, -1, -1, 12, -1, - -1, 87, 88, 89, 90, 91, 92, -1, 94, 23, - 96, -1, 98, 99, -1, -1, 102, 103, -1, -1, - 106, -1, 36, -1, 110, 111, 112, -1, -1, -1, - -1, 45, 46, 47, -1, 49, -1, -1, -1, -1, - -1, -1, 56, 57, -1, 59, 12, 61, -1, 15, - 16, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 79, -1, -1, -1, -1, - -1, -1, -1, 87, 88, 89, 90, 91, 92, -1, - 46, 47, 96, 49, 98, 99, -1, -1, 102, 103, - 56, 57, 106, 59, -1, 61, 110, 111, 112, -1, - -1, -1, -1, -1, 12, -1, -1, 15, 16, -1, - -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, - -1, 87, 88, 89, 90, 91, 92, -1, -1, -1, - 96, -1, 98, 99, -1, -1, 102, 103, 46, 47, - 106, 49, -1, -1, 110, 111, 112, -1, 56, 57, - -1, 59, 12, 61, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 23, -1, -1, -1, -1, -1, -1, - -1, 79, -1, -1, -1, -1, -1, -1, -1, 87, - 88, 89, 90, 91, 92, 45, 46, 47, 96, 49, - 98, 99, -1, -1, 102, 103, 56, 57, 106, 59, - -1, 61, 110, 111, 112, -1, -1, -1, -1, -1, - 12, -1, -1, 15, -1, -1, -1, -1, -1, 79, - -1, -1, -1, -1, -1, -1, -1, 87, 88, 89, - 90, 91, 92, -1, -1, -1, 96, -1, 98, 99, - -1, -1, 102, 103, 46, 47, 106, 49, -1, -1, - 110, 111, 112, -1, 56, 57, -1, 59, 12, 61, - -1, 15, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 79, -1, -1, - -1, -1, -1, -1, -1, 87, 88, 89, 90, 91, - 92, -1, 46, 47, 96, 49, 98, 99, -1, -1, - 102, 103, 56, 57, 106, 59, -1, 61, 110, 111, - 112, -1, -1, -1, -1, -1, 12, -1, -1, 15, - -1, -1, -1, -1, -1, 79, -1, -1, -1, -1, - -1, -1, -1, 87, 88, 89, 90, 91, 92, -1, - -1, -1, 96, -1, 98, 99, -1, -1, 102, 103, - 46, 47, 106, 49, -1, -1, 110, 111, 112, -1, - 56, 57, -1, 59, 12, 61, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, - -1, 87, 88, 89, 90, 91, 92, -1, 46, 47, - 96, 49, 98, 99, -1, -1, 102, 103, 56, 57, - 106, 59, -1, 61, 110, 111, 112, -1, -1, -1, - -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, - -1, 79, 12, -1, -1, 15, -1, -1, -1, 87, - 88, 89, 90, 91, 92, -1, -1, -1, 96, -1, - 98, 99, -1, -1, 102, 103, -1, -1, 106, -1, - -1, -1, 110, 111, 112, -1, 46, 47, -1, 49, - -1, -1, -1, -1, -1, -1, 56, 57, -1, 59, - 12, 61, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 23, -1, -1, -1, -1, -1, -1, -1, 79, - -1, -1, -1, -1, -1, -1, -1, 87, 88, 89, - 90, 91, 92, 45, 46, 47, 96, 49, 98, 99, - -1, -1, 102, 103, 56, 57, 106, 59, 12, 61, - 110, 111, 112, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 79, -1, -1, - -1, -1, -1, -1, -1, 87, 88, 89, 90, 91, - 92, -1, 46, 47, -1, 49, 98, 99, -1, -1, - 102, 103, 56, 57, 106, 59, -1, 61, 110, 111, - 112, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 79, -1, -1, -1, -1, - -1, -1, -1, 87, 88, 89, 90, 91, 92, -1, - -1, -1, 96, -1, 98, 99, -1, -1, 102, 103, - -1, -1, 106, -1, -1, -1, 110, 111, 112 -}; - - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 1, 9, 14, 115, 130, 132, 144, 0, 7, - 8, 11, 12, 15, 46, 47, 49, 55, 56, 57, - 59, 61, 79, 87, 88, 89, 90, 91, 92, 96, - 98, 99, 102, 103, 106, 110, 111, 112, 127, 133, - 134, 136, 139, 146, 147, 157, 158, 159, 160, 162, - 9, 14, 127, 127, 139, 140, 148, 12, 12, 106, - 159, 160, 87, 90, 125, 12, 12, 12, 12, 43, - 160, 12, 12, 159, 159, 146, 159, 160, 160, 159, - 1, 9, 14, 48, 50, 51, 52, 53, 54, 58, - 62, 63, 77, 78, 97, 100, 119, 121, 126, 127, - 139, 143, 150, 152, 156, 163, 10, 127, 130, 13, - 23, 36, 37, 39, 40, 41, 42, 43, 44, 45, - 94, 116, 117, 159, 12, 92, 15, 102, 103, 104, - 105, 109, 70, 110, 111, 18, 156, 156, 10, 16, - 118, 16, 118, 93, 16, 137, 139, 139, 12, 139, - 139, 137, 16, 137, 159, 43, 139, 139, 9, 128, - 129, 14, 128, 151, 151, 162, 139, 151, 12, 12, - 151, 151, 139, 151, 12, 9, 153, 152, 156, 12, - 138, 141, 142, 146, 159, 160, 151, 17, 152, 155, - 129, 156, 134, 96, 139, 147, 139, 139, 139, 139, - 139, 139, 162, 139, 9, 139, 9, 139, 139, 147, - 70, 159, 159, 159, 159, 159, 159, 139, 137, 17, - 17, 9, 139, 45, 139, 15, 16, 118, 87, 161, - 118, 118, 16, 16, 159, 118, 118, 9, 129, 18, - 151, 131, 150, 162, 139, 151, 139, 152, 80, 120, - 17, 145, 140, 23, 45, 94, 116, 117, 159, 118, - 13, 38, 41, 70, 152, 133, 17, 160, 95, 118, - 118, 159, 19, 162, 139, 16, 118, 149, 139, 147, - 139, 147, 162, 139, 137, 14, 45, 149, 149, 154, - 9, 152, 9, 16, 12, 138, 147, 162, 138, 138, - 138, 138, 159, 159, 159, 138, 127, 139, 139, 139, - 87, 9, 135, 16, 16, 16, 16, 16, 118, 16, - 118, 19, 14, 129, 162, 100, 45, 140, 95, 156, - 16, 118, 16, 118, 127, 139, 147, 139, 129, 139, - 149, 12, 162, 16, 138, 17, 160, 160, 156, 16, - 16, 16, 131, 14, 124, 139, 16, 16, 17, 149, - 129, 152, 16, 123, 131, 151, 152, 149, 122, 152 -}; - - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 114, 115, 115, 116, 116, 117, 117, 118, 118, - 119, 119, 120, 120, 122, 121, 123, 121, 124, 121, - 125, 125, 126, 127, 127, 128, 128, 129, 129, 130, - 130, 131, 131, 132, 132, 133, 134, 134, 134, 134, - 134, 134, 134, 135, 134, 136, 136, 137, 137, 138, - 138, 138, 138, 138, 138, 138, 138, 138, 138, 138, - 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, - 139, 139, 139, 139, 139, 139, 139, 139, 139, 140, - 140, 141, 141, 142, 142, 142, 143, 143, 144, 144, - 144, 144, 145, 145, 146, 146, 148, 147, 149, 149, - 150, 150, 150, 150, 150, 150, 150, 150, 151, 151, - 152, 152, 153, 154, 152, 152, 152, 152, 152, 152, - 152, 152, 152, 152, 152, 152, 155, 152, 152, 156, - 156, 157, 157, 158, 158, 159, 159, 159, 159, 159, - 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, - 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, - 159, 159, 159, 159, 159, 159, 159, 159, 159, 159, - 159, 159, 159, 159, 159, 159, 159, 160, 160, 160, - 160, 161, 161, 161, 162, 162, 162, 163 -}; - - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 1, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 0, 12, 0, 10, 0, 8, - 1, 1, 4, 1, 2, 1, 2, 0, 1, 0, - 1, 0, 1, 1, 3, 1, 1, 4, 4, 7, - 3, 4, 4, 0, 9, 1, 3, 1, 3, 3, - 5, 3, 3, 3, 3, 3, 5, 2, 1, 1, - 3, 5, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 5, 4, 3, 2, 1, 1, 3, - 3, 1, 3, 0, 1, 3, 1, 1, 1, 1, - 2, 2, 1, 2, 1, 2, 0, 4, 1, 2, - 4, 4, 4, 2, 5, 2, 1, 1, 1, 2, - 2, 2, 0, 0, 9, 3, 2, 1, 4, 2, - 3, 2, 2, 3, 2, 2, 0, 3, 2, 1, - 2, 1, 1, 1, 2, 4, 3, 3, 3, 3, - 3, 3, 2, 2, 2, 3, 4, 1, 3, 4, - 2, 2, 2, 2, 2, 4, 3, 2, 1, 6, - 6, 3, 6, 6, 1, 8, 8, 6, 4, 1, - 6, 6, 8, 8, 8, 6, 1, 1, 4, 1, - 2, 0, 1, 3, 1, 1, 1, 4 -}; - - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ - do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ - while (0) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - - - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) - -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif - - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) - - -/*-----------------------------------. -| Print this symbol's value on YYO. | -`-----------------------------------*/ - -static void -yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) -{ - FILE *yyoutput = yyo; - YYUSE (yyoutput); - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyo, yytoknum[yytype], *yyvaluep); -# endif - YYUSE (yytype); -} - - -/*---------------------------. -| Print this symbol on YYO. | -`---------------------------*/ - -static void -yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep) -{ - YYFPRINTF (yyo, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - - yy_symbol_value_print (yyo, yytype, yyvaluep); - YYFPRINTF (yyo, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -{ - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (0) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) -{ - unsigned long yylno = yyrline[yyrule]; - int yynrhs = yyr2[yyrule]; - int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &yyvsp[(yyi + 1) - (yynrhs)] - ); - YYFPRINTF (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyssp, yyvsp, Rule); \ -} while (0) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -static YYSIZE_T -yystrlen (const char *yystr) -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -yystpcpy (char *yydest, const char *yysrc) -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - else - goto append; - - append: - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres); -} -# endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) -{ - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; - - /* There are many possibilities here to consider: - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) - yysize = yysize1; - else - return 2; - } - } - } - } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - default: /* Avoid compiler warnings. */ - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM) - yysize = yysize1; - else - return 2; - } - - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; -} -#endif /* YYERROR_VERBOSE */ - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -{ - YYUSE (yyvaluep); - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - YYUSE (yytype); - YY_IGNORE_MAYBE_UNINITIALIZED_END -} - - - - -/* The lookahead symbol. */ -int yychar; - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; - - -/*----------. -| yyparse. | -`----------*/ - -int -yyparse (void) -{ - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values. - - Refer to the stacks through separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - goto yysetstate; - - -/*------------------------------------------------------------. -| yynewstate -- push a new state, which is found in yystate. | -`------------------------------------------------------------*/ -yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - -/*--------------------------------------------------------------------. -| yynewstate -- set current state (the top of the stack) to yystate. | -`--------------------------------------------------------------------*/ -yysetstate: - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - YY_ASSERT (0 <= yystate && yystate < YYNSTATES); - *yyssp = (yytype_int16) yystate; - - if (yyss + yystacksize - 1 <= yyssp) -#if !defined yyoverflow && !defined YYSTACK_RELOCATE - goto yyexhaustedlab; -#else - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1); - -# if defined yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - yyss = yyss1; - yyvs = yyvs1; - } -# else /* defined YYSTACK_RELOCATE */ - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } -#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ - - if (yystate == YYFINAL) - YYACCEPT; - - goto yybackup; - - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yypact_value_is_default (yyn)) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = yylex (); - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yytable_value_is_error (yyn)) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the lookahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - - yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - '$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 2: -#line 99 "awkgram.y" - { if (errorflag==0) - winner = (Node *)stat3(PROGRAM, beginloc, (yyvsp[0].p), endloc); } -#line 2542 "y.tab.c" - break; - - case 3: -#line 101 "awkgram.y" - { yyclearin; bracecheck(); SYNTAX("bailing out"); } -#line 2548 "y.tab.c" - break; - - case 14: -#line 125 "awkgram.y" - {inloop++;} -#line 2554 "y.tab.c" - break; - - case 15: -#line 126 "awkgram.y" - { --inloop; (yyval.p) = stat4(FOR, (yyvsp[-9].p), notnull((yyvsp[-6].p)), (yyvsp[-3].p), (yyvsp[0].p)); } -#line 2560 "y.tab.c" - break; - - case 16: -#line 127 "awkgram.y" - {inloop++;} -#line 2566 "y.tab.c" - break; - - case 17: -#line 128 "awkgram.y" - { --inloop; (yyval.p) = stat4(FOR, (yyvsp[-7].p), NIL, (yyvsp[-3].p), (yyvsp[0].p)); } -#line 2572 "y.tab.c" - break; - - case 18: -#line 129 "awkgram.y" - {inloop++;} -#line 2578 "y.tab.c" - break; - - case 19: -#line 130 "awkgram.y" - { --inloop; (yyval.p) = stat3(IN, (yyvsp[-5].p), makearr((yyvsp[-3].p)), (yyvsp[0].p)); } -#line 2584 "y.tab.c" - break; - - case 20: -#line 134 "awkgram.y" - { setfname((yyvsp[0].cp)); } -#line 2590 "y.tab.c" - break; - - case 21: -#line 135 "awkgram.y" - { setfname((yyvsp[0].cp)); } -#line 2596 "y.tab.c" - break; - - case 22: -#line 139 "awkgram.y" - { (yyval.p) = notnull((yyvsp[-1].p)); } -#line 2602 "y.tab.c" - break; - - case 27: -#line 151 "awkgram.y" - { (yyval.i) = 0; } -#line 2608 "y.tab.c" - break; - - case 29: -#line 156 "awkgram.y" - { (yyval.i) = 0; } -#line 2614 "y.tab.c" - break; - - case 31: -#line 162 "awkgram.y" - { (yyval.p) = 0; } -#line 2620 "y.tab.c" - break; - - case 33: -#line 167 "awkgram.y" - { (yyval.p) = 0; } -#line 2626 "y.tab.c" - break; - - case 34: -#line 168 "awkgram.y" - { (yyval.p) = (yyvsp[-1].p); } -#line 2632 "y.tab.c" - break; - - case 35: -#line 172 "awkgram.y" - { (yyval.p) = notnull((yyvsp[0].p)); } -#line 2638 "y.tab.c" - break; - - case 36: -#line 176 "awkgram.y" - { (yyval.p) = stat2(PASTAT, (yyvsp[0].p), stat2(PRINT, rectonode(), NIL)); } -#line 2644 "y.tab.c" - break; - - case 37: -#line 177 "awkgram.y" - { (yyval.p) = stat2(PASTAT, (yyvsp[-3].p), (yyvsp[-1].p)); } -#line 2650 "y.tab.c" - break; - - case 38: -#line 178 "awkgram.y" - { (yyval.p) = pa2stat((yyvsp[-3].p), (yyvsp[0].p), stat2(PRINT, rectonode(), NIL)); } -#line 2656 "y.tab.c" - break; - - case 39: -#line 179 "awkgram.y" - { (yyval.p) = pa2stat((yyvsp[-6].p), (yyvsp[-3].p), (yyvsp[-1].p)); } -#line 2662 "y.tab.c" - break; - - case 40: -#line 180 "awkgram.y" - { (yyval.p) = stat2(PASTAT, NIL, (yyvsp[-1].p)); } -#line 2668 "y.tab.c" - break; - - case 41: -#line 182 "awkgram.y" - { beginloc = linkum(beginloc, (yyvsp[-1].p)); (yyval.p) = 0; } -#line 2674 "y.tab.c" - break; - - case 42: -#line 184 "awkgram.y" - { endloc = linkum(endloc, (yyvsp[-1].p)); (yyval.p) = 0; } -#line 2680 "y.tab.c" - break; - - case 43: -#line 185 "awkgram.y" - {infunc = true;} -#line 2686 "y.tab.c" - break; - - case 44: -#line 186 "awkgram.y" - { infunc = false; curfname=0; defn((Cell *)(yyvsp[-7].p), (yyvsp[-5].p), (yyvsp[-1].p)); (yyval.p) = 0; } -#line 2692 "y.tab.c" - break; - - case 46: -#line 191 "awkgram.y" - { (yyval.p) = linkum((yyvsp[-2].p), (yyvsp[0].p)); } -#line 2698 "y.tab.c" - break; - - case 48: -#line 196 "awkgram.y" - { (yyval.p) = linkum((yyvsp[-2].p), (yyvsp[0].p)); } -#line 2704 "y.tab.c" - break; - - case 49: -#line 200 "awkgram.y" - { (yyval.p) = op2((yyvsp[-1].i), (yyvsp[-2].p), (yyvsp[0].p)); } -#line 2710 "y.tab.c" - break; - - case 50: -#line 202 "awkgram.y" - { (yyval.p) = op3(CONDEXPR, notnull((yyvsp[-4].p)), (yyvsp[-2].p), (yyvsp[0].p)); } -#line 2716 "y.tab.c" - break; - - case 51: -#line 204 "awkgram.y" - { (yyval.p) = op2(BOR, notnull((yyvsp[-2].p)), notnull((yyvsp[0].p))); } -#line 2722 "y.tab.c" - break; - - case 52: -#line 206 "awkgram.y" - { (yyval.p) = op2(AND, notnull((yyvsp[-2].p)), notnull((yyvsp[0].p))); } -#line 2728 "y.tab.c" - break; - - case 53: -#line 207 "awkgram.y" - { (yyval.p) = op3((yyvsp[-1].i), NIL, (yyvsp[-2].p), (Node*)makedfa((yyvsp[0].s), 0)); } -#line 2734 "y.tab.c" - break; - - case 54: -#line 209 "awkgram.y" - { if (constnode((yyvsp[0].p))) - (yyval.p) = op3((yyvsp[-1].i), NIL, (yyvsp[-2].p), (Node*)makedfa(strnode((yyvsp[0].p)), 0)); - else - (yyval.p) = op3((yyvsp[-1].i), (Node *)1, (yyvsp[-2].p), (yyvsp[0].p)); } -#line 2743 "y.tab.c" - break; - - case 55: -#line 213 "awkgram.y" - { (yyval.p) = op2(INTEST, (yyvsp[-2].p), makearr((yyvsp[0].p))); } -#line 2749 "y.tab.c" - break; - - case 56: -#line 214 "awkgram.y" - { (yyval.p) = op2(INTEST, (yyvsp[-3].p), makearr((yyvsp[0].p))); } -#line 2755 "y.tab.c" - break; - - case 57: -#line 215 "awkgram.y" - { (yyval.p) = op2(CAT, (yyvsp[-1].p), (yyvsp[0].p)); } -#line 2761 "y.tab.c" - break; - - case 60: -#line 221 "awkgram.y" - { (yyval.p) = op2((yyvsp[-1].i), (yyvsp[-2].p), (yyvsp[0].p)); } -#line 2767 "y.tab.c" - break; - - case 61: -#line 223 "awkgram.y" - { (yyval.p) = op3(CONDEXPR, notnull((yyvsp[-4].p)), (yyvsp[-2].p), (yyvsp[0].p)); } -#line 2773 "y.tab.c" - break; - - case 62: -#line 225 "awkgram.y" - { (yyval.p) = op2(BOR, notnull((yyvsp[-2].p)), notnull((yyvsp[0].p))); } -#line 2779 "y.tab.c" - break; - - case 63: -#line 227 "awkgram.y" - { (yyval.p) = op2(AND, notnull((yyvsp[-2].p)), notnull((yyvsp[0].p))); } -#line 2785 "y.tab.c" - break; - - case 64: -#line 228 "awkgram.y" - { (yyval.p) = op2((yyvsp[-1].i), (yyvsp[-2].p), (yyvsp[0].p)); } -#line 2791 "y.tab.c" - break; - - case 65: -#line 229 "awkgram.y" - { (yyval.p) = op2((yyvsp[-1].i), (yyvsp[-2].p), (yyvsp[0].p)); } -#line 2797 "y.tab.c" - break; - - case 66: -#line 230 "awkgram.y" - { (yyval.p) = op2((yyvsp[-1].i), (yyvsp[-2].p), (yyvsp[0].p)); } -#line 2803 "y.tab.c" - break; - - case 67: -#line 231 "awkgram.y" - { (yyval.p) = op2((yyvsp[-1].i), (yyvsp[-2].p), (yyvsp[0].p)); } -#line 2809 "y.tab.c" - break; - - case 68: -#line 232 "awkgram.y" - { (yyval.p) = op2((yyvsp[-1].i), (yyvsp[-2].p), (yyvsp[0].p)); } -#line 2815 "y.tab.c" - break; - - case 69: -#line 233 "awkgram.y" - { (yyval.p) = op2((yyvsp[-1].i), (yyvsp[-2].p), (yyvsp[0].p)); } -#line 2821 "y.tab.c" - break; - - case 70: -#line 234 "awkgram.y" - { (yyval.p) = op3((yyvsp[-1].i), NIL, (yyvsp[-2].p), (Node*)makedfa((yyvsp[0].s), 0)); } -#line 2827 "y.tab.c" - break; - - case 71: -#line 236 "awkgram.y" - { if (constnode((yyvsp[0].p))) - (yyval.p) = op3((yyvsp[-1].i), NIL, (yyvsp[-2].p), (Node*)makedfa(strnode((yyvsp[0].p)), 0)); - else - (yyval.p) = op3((yyvsp[-1].i), (Node *)1, (yyvsp[-2].p), (yyvsp[0].p)); } -#line 2836 "y.tab.c" - break; - - case 72: -#line 240 "awkgram.y" - { (yyval.p) = op2(INTEST, (yyvsp[-2].p), makearr((yyvsp[0].p))); } -#line 2842 "y.tab.c" - break; - - case 73: -#line 241 "awkgram.y" - { (yyval.p) = op2(INTEST, (yyvsp[-3].p), makearr((yyvsp[0].p))); } -#line 2848 "y.tab.c" - break; - - case 74: -#line 242 "awkgram.y" - { - if (safe) SYNTAX("cmd | getline is unsafe"); - else (yyval.p) = op3(GETLINE, (yyvsp[0].p), itonp((yyvsp[-2].i)), (yyvsp[-3].p)); } -#line 2856 "y.tab.c" - break; - - case 75: -#line 245 "awkgram.y" - { - if (safe) SYNTAX("cmd | getline is unsafe"); - else (yyval.p) = op3(GETLINE, (Node*)0, itonp((yyvsp[-1].i)), (yyvsp[-2].p)); } -#line 2864 "y.tab.c" - break; - - case 76: -#line 248 "awkgram.y" - { (yyval.p) = op2(CAT, (yyvsp[-1].p), (yyvsp[0].p)); } -#line 2870 "y.tab.c" - break; - - case 79: -#line 254 "awkgram.y" - { (yyval.p) = linkum((yyvsp[-2].p), (yyvsp[0].p)); } -#line 2876 "y.tab.c" - break; - - case 80: -#line 255 "awkgram.y" - { (yyval.p) = linkum((yyvsp[-2].p), (yyvsp[0].p)); } -#line 2882 "y.tab.c" - break; - - case 82: -#line 260 "awkgram.y" - { (yyval.p) = linkum((yyvsp[-2].p), (yyvsp[0].p)); } -#line 2888 "y.tab.c" - break; - - case 83: -#line 264 "awkgram.y" - { (yyval.p) = rectonode(); } -#line 2894 "y.tab.c" - break; - - case 85: -#line 266 "awkgram.y" - { (yyval.p) = (yyvsp[-1].p); } -#line 2900 "y.tab.c" - break; - - case 94: -#line 283 "awkgram.y" - { (yyval.p) = op3(MATCH, NIL, rectonode(), (Node*)makedfa((yyvsp[0].s), 0)); } -#line 2906 "y.tab.c" - break; - - case 95: -#line 284 "awkgram.y" - { (yyval.p) = op1(NOT, notnull((yyvsp[0].p))); } -#line 2912 "y.tab.c" - break; - - case 96: -#line 288 "awkgram.y" - {startreg();} -#line 2918 "y.tab.c" - break; - - case 97: -#line 288 "awkgram.y" - { (yyval.s) = (yyvsp[-1].s); } -#line 2924 "y.tab.c" - break; - - case 100: -#line 296 "awkgram.y" - { - if (safe) SYNTAX("print | is unsafe"); - else (yyval.p) = stat3((yyvsp[-3].i), (yyvsp[-2].p), itonp((yyvsp[-1].i)), (yyvsp[0].p)); } -#line 2932 "y.tab.c" - break; - - case 101: -#line 299 "awkgram.y" - { - if (safe) SYNTAX("print >> is unsafe"); - else (yyval.p) = stat3((yyvsp[-3].i), (yyvsp[-2].p), itonp((yyvsp[-1].i)), (yyvsp[0].p)); } -#line 2940 "y.tab.c" - break; - - case 102: -#line 302 "awkgram.y" - { - if (safe) SYNTAX("print > is unsafe"); - else (yyval.p) = stat3((yyvsp[-3].i), (yyvsp[-2].p), itonp((yyvsp[-1].i)), (yyvsp[0].p)); } -#line 2948 "y.tab.c" - break; - - case 103: -#line 305 "awkgram.y" - { (yyval.p) = stat3((yyvsp[-1].i), (yyvsp[0].p), NIL, NIL); } -#line 2954 "y.tab.c" - break; - - case 104: -#line 306 "awkgram.y" - { (yyval.p) = stat2(DELETE, makearr((yyvsp[-3].p)), (yyvsp[-1].p)); } -#line 2960 "y.tab.c" - break; - - case 105: -#line 307 "awkgram.y" - { (yyval.p) = stat2(DELETE, makearr((yyvsp[0].p)), 0); } -#line 2966 "y.tab.c" - break; - - case 106: -#line 308 "awkgram.y" - { (yyval.p) = exptostat((yyvsp[0].p)); } -#line 2972 "y.tab.c" - break; - - case 107: -#line 309 "awkgram.y" - { yyclearin; SYNTAX("illegal statement"); } -#line 2978 "y.tab.c" - break; - - case 110: -#line 318 "awkgram.y" - { if (!inloop) SYNTAX("break illegal outside of loops"); - (yyval.p) = stat1(BREAK, NIL); } -#line 2985 "y.tab.c" - break; - - case 111: -#line 320 "awkgram.y" - { if (!inloop) SYNTAX("continue illegal outside of loops"); - (yyval.p) = stat1(CONTINUE, NIL); } -#line 2992 "y.tab.c" - break; - - case 112: -#line 322 "awkgram.y" - {inloop++;} -#line 2998 "y.tab.c" - break; - - case 113: -#line 322 "awkgram.y" - {--inloop;} -#line 3004 "y.tab.c" - break; - - case 114: -#line 323 "awkgram.y" - { (yyval.p) = stat2(DO, (yyvsp[-6].p), notnull((yyvsp[-2].p))); } -#line 3010 "y.tab.c" - break; - - case 115: -#line 324 "awkgram.y" - { (yyval.p) = stat1(EXIT, (yyvsp[-1].p)); } -#line 3016 "y.tab.c" - break; - - case 116: -#line 325 "awkgram.y" - { (yyval.p) = stat1(EXIT, NIL); } -#line 3022 "y.tab.c" - break; - - case 118: -#line 327 "awkgram.y" - { (yyval.p) = stat3(IF, (yyvsp[-3].p), (yyvsp[-2].p), (yyvsp[0].p)); } -#line 3028 "y.tab.c" - break; - - case 119: -#line 328 "awkgram.y" - { (yyval.p) = stat3(IF, (yyvsp[-1].p), (yyvsp[0].p), NIL); } -#line 3034 "y.tab.c" - break; - - case 120: -#line 329 "awkgram.y" - { (yyval.p) = (yyvsp[-1].p); } -#line 3040 "y.tab.c" - break; - - case 121: -#line 330 "awkgram.y" - { if (infunc) - SYNTAX("next is illegal inside a function"); - (yyval.p) = stat1(NEXT, NIL); } -#line 3048 "y.tab.c" - break; - - case 122: -#line 333 "awkgram.y" - { if (infunc) - SYNTAX("nextfile is illegal inside a function"); - (yyval.p) = stat1(NEXTFILE, NIL); } -#line 3056 "y.tab.c" - break; - - case 123: -#line 336 "awkgram.y" - { (yyval.p) = stat1(RETURN, (yyvsp[-1].p)); } -#line 3062 "y.tab.c" - break; - - case 124: -#line 337 "awkgram.y" - { (yyval.p) = stat1(RETURN, NIL); } -#line 3068 "y.tab.c" - break; - - case 126: -#line 339 "awkgram.y" - {inloop++;} -#line 3074 "y.tab.c" - break; - - case 127: -#line 339 "awkgram.y" - { --inloop; (yyval.p) = stat2(WHILE, (yyvsp[-2].p), (yyvsp[0].p)); } -#line 3080 "y.tab.c" - break; - - case 128: -#line 340 "awkgram.y" - { (yyval.p) = 0; } -#line 3086 "y.tab.c" - break; - - case 130: -#line 345 "awkgram.y" - { (yyval.p) = linkum((yyvsp[-1].p), (yyvsp[0].p)); } -#line 3092 "y.tab.c" - break; - - case 134: -#line 354 "awkgram.y" - { (yyval.cp) = catstr((yyvsp[-1].cp), (yyvsp[0].cp)); } -#line 3098 "y.tab.c" - break; - - case 135: -#line 358 "awkgram.y" - { (yyval.p) = op2(DIVEQ, (yyvsp[-3].p), (yyvsp[0].p)); } -#line 3104 "y.tab.c" - break; - - case 136: -#line 359 "awkgram.y" - { (yyval.p) = op2(ADD, (yyvsp[-2].p), (yyvsp[0].p)); } -#line 3110 "y.tab.c" - break; - - case 137: -#line 360 "awkgram.y" - { (yyval.p) = op2(MINUS, (yyvsp[-2].p), (yyvsp[0].p)); } -#line 3116 "y.tab.c" - break; - - case 138: -#line 361 "awkgram.y" - { (yyval.p) = op2(MULT, (yyvsp[-2].p), (yyvsp[0].p)); } -#line 3122 "y.tab.c" - break; - - case 139: -#line 362 "awkgram.y" - { (yyval.p) = op2(DIVIDE, (yyvsp[-2].p), (yyvsp[0].p)); } -#line 3128 "y.tab.c" - break; - - case 140: -#line 363 "awkgram.y" - { (yyval.p) = op2(MOD, (yyvsp[-2].p), (yyvsp[0].p)); } -#line 3134 "y.tab.c" - break; - - case 141: -#line 364 "awkgram.y" - { (yyval.p) = op2(POWER, (yyvsp[-2].p), (yyvsp[0].p)); } -#line 3140 "y.tab.c" - break; - - case 142: -#line 365 "awkgram.y" - { (yyval.p) = op1(UMINUS, (yyvsp[0].p)); } -#line 3146 "y.tab.c" - break; - - case 143: -#line 366 "awkgram.y" - { (yyval.p) = op1(UPLUS, (yyvsp[0].p)); } -#line 3152 "y.tab.c" - break; - - case 144: -#line 367 "awkgram.y" - { (yyval.p) = op1(NOT, notnull((yyvsp[0].p))); } -#line 3158 "y.tab.c" - break; - - case 145: -#line 368 "awkgram.y" - { (yyval.p) = op2(BLTIN, itonp((yyvsp[-2].i)), rectonode()); } -#line 3164 "y.tab.c" - break; - - case 146: -#line 369 "awkgram.y" - { (yyval.p) = op2(BLTIN, itonp((yyvsp[-3].i)), (yyvsp[-1].p)); } -#line 3170 "y.tab.c" - break; - - case 147: -#line 370 "awkgram.y" - { (yyval.p) = op2(BLTIN, itonp((yyvsp[0].i)), rectonode()); } -#line 3176 "y.tab.c" - break; - - case 148: -#line 371 "awkgram.y" - { (yyval.p) = op2(CALL, celltonode((yyvsp[-2].cp),CVAR), NIL); } -#line 3182 "y.tab.c" - break; - - case 149: -#line 372 "awkgram.y" - { (yyval.p) = op2(CALL, celltonode((yyvsp[-3].cp),CVAR), (yyvsp[-1].p)); } -#line 3188 "y.tab.c" - break; - - case 150: -#line 373 "awkgram.y" - { (yyval.p) = op1(CLOSE, (yyvsp[0].p)); } -#line 3194 "y.tab.c" - break; - - case 151: -#line 374 "awkgram.y" - { (yyval.p) = op1(PREDECR, (yyvsp[0].p)); } -#line 3200 "y.tab.c" - break; - - case 152: -#line 375 "awkgram.y" - { (yyval.p) = op1(PREINCR, (yyvsp[0].p)); } -#line 3206 "y.tab.c" - break; - - case 153: -#line 376 "awkgram.y" - { (yyval.p) = op1(POSTDECR, (yyvsp[-1].p)); } -#line 3212 "y.tab.c" - break; - - case 154: -#line 377 "awkgram.y" - { (yyval.p) = op1(POSTINCR, (yyvsp[-1].p)); } -#line 3218 "y.tab.c" - break; - - case 155: -#line 378 "awkgram.y" - { (yyval.p) = op3(GETLINE, (yyvsp[-2].p), itonp((yyvsp[-1].i)), (yyvsp[0].p)); } -#line 3224 "y.tab.c" - break; - - case 156: -#line 379 "awkgram.y" - { (yyval.p) = op3(GETLINE, NIL, itonp((yyvsp[-1].i)), (yyvsp[0].p)); } -#line 3230 "y.tab.c" - break; - - case 157: -#line 380 "awkgram.y" - { (yyval.p) = op3(GETLINE, (yyvsp[0].p), NIL, NIL); } -#line 3236 "y.tab.c" - break; - - case 158: -#line 381 "awkgram.y" - { (yyval.p) = op3(GETLINE, NIL, NIL, NIL); } -#line 3242 "y.tab.c" - break; - - case 159: -#line 383 "awkgram.y" - { (yyval.p) = op2(INDEX, (yyvsp[-3].p), (yyvsp[-1].p)); } -#line 3248 "y.tab.c" - break; - - case 160: -#line 385 "awkgram.y" - { SYNTAX("index() doesn't permit regular expressions"); - (yyval.p) = op2(INDEX, (yyvsp[-3].p), (Node*)(yyvsp[-1].s)); } -#line 3255 "y.tab.c" - break; - - case 161: -#line 387 "awkgram.y" - { (yyval.p) = (yyvsp[-1].p); } -#line 3261 "y.tab.c" - break; - - case 162: -#line 389 "awkgram.y" - { (yyval.p) = op3(MATCHFCN, NIL, (yyvsp[-3].p), (Node*)makedfa((yyvsp[-1].s), 1)); } -#line 3267 "y.tab.c" - break; - - case 163: -#line 391 "awkgram.y" - { if (constnode((yyvsp[-1].p))) - (yyval.p) = op3(MATCHFCN, NIL, (yyvsp[-3].p), (Node*)makedfa(strnode((yyvsp[-1].p)), 1)); - else - (yyval.p) = op3(MATCHFCN, (Node *)1, (yyvsp[-3].p), (yyvsp[-1].p)); } -#line 3276 "y.tab.c" - break; - - case 164: -#line 395 "awkgram.y" - { (yyval.p) = celltonode((yyvsp[0].cp), CCON); } -#line 3282 "y.tab.c" - break; - - case 165: -#line 397 "awkgram.y" - { (yyval.p) = op4(SPLIT, (yyvsp[-5].p), makearr((yyvsp[-3].p)), (yyvsp[-1].p), (Node*)STRING); } -#line 3288 "y.tab.c" - break; - - case 166: -#line 399 "awkgram.y" - { (yyval.p) = op4(SPLIT, (yyvsp[-5].p), makearr((yyvsp[-3].p)), (Node*)makedfa((yyvsp[-1].s), 1), (Node *)REGEXPR); } -#line 3294 "y.tab.c" - break; - - case 167: -#line 401 "awkgram.y" - { (yyval.p) = op4(SPLIT, (yyvsp[-3].p), makearr((yyvsp[-1].p)), NIL, (Node*)STRING); } -#line 3300 "y.tab.c" - break; - - case 168: -#line 402 "awkgram.y" - { (yyval.p) = op1((yyvsp[-3].i), (yyvsp[-1].p)); } -#line 3306 "y.tab.c" - break; - - case 169: -#line 403 "awkgram.y" - { (yyval.p) = celltonode((yyvsp[0].cp), CCON); } -#line 3312 "y.tab.c" - break; - - case 170: -#line 405 "awkgram.y" - { (yyval.p) = op4((yyvsp[-5].i), NIL, (Node*)makedfa((yyvsp[-3].s), 1), (yyvsp[-1].p), rectonode()); } -#line 3318 "y.tab.c" - break; - - case 171: -#line 407 "awkgram.y" - { if (constnode((yyvsp[-3].p))) - (yyval.p) = op4((yyvsp[-5].i), NIL, (Node*)makedfa(strnode((yyvsp[-3].p)), 1), (yyvsp[-1].p), rectonode()); - else - (yyval.p) = op4((yyvsp[-5].i), (Node *)1, (yyvsp[-3].p), (yyvsp[-1].p), rectonode()); } -#line 3327 "y.tab.c" - break; - - case 172: -#line 412 "awkgram.y" - { (yyval.p) = op4((yyvsp[-7].i), NIL, (Node*)makedfa((yyvsp[-5].s), 1), (yyvsp[-3].p), (yyvsp[-1].p)); } -#line 3333 "y.tab.c" - break; - - case 173: -#line 414 "awkgram.y" - { if (constnode((yyvsp[-5].p))) - (yyval.p) = op4((yyvsp[-7].i), NIL, (Node*)makedfa(strnode((yyvsp[-5].p)), 1), (yyvsp[-3].p), (yyvsp[-1].p)); - else - (yyval.p) = op4((yyvsp[-7].i), (Node *)1, (yyvsp[-5].p), (yyvsp[-3].p), (yyvsp[-1].p)); } -#line 3342 "y.tab.c" - break; - - case 174: -#line 419 "awkgram.y" - { (yyval.p) = op3(SUBSTR, (yyvsp[-5].p), (yyvsp[-3].p), (yyvsp[-1].p)); } -#line 3348 "y.tab.c" - break; - - case 175: -#line 421 "awkgram.y" - { (yyval.p) = op3(SUBSTR, (yyvsp[-3].p), (yyvsp[-1].p), NIL); } -#line 3354 "y.tab.c" - break; - - case 178: -#line 427 "awkgram.y" - { (yyval.p) = op2(ARRAY, makearr((yyvsp[-3].p)), (yyvsp[-1].p)); } -#line 3360 "y.tab.c" - break; - - case 179: -#line 428 "awkgram.y" - { (yyval.p) = op1(INDIRECT, celltonode((yyvsp[0].cp), CVAR)); } -#line 3366 "y.tab.c" - break; - - case 180: -#line 429 "awkgram.y" - { (yyval.p) = op1(INDIRECT, (yyvsp[0].p)); } -#line 3372 "y.tab.c" - break; - - case 181: -#line 433 "awkgram.y" - { arglist = (yyval.p) = 0; } -#line 3378 "y.tab.c" - break; - - case 182: -#line 434 "awkgram.y" - { arglist = (yyval.p) = celltonode((yyvsp[0].cp),CVAR); } -#line 3384 "y.tab.c" - break; - - case 183: -#line 435 "awkgram.y" - { - checkdup((yyvsp[-2].p), (yyvsp[0].cp)); - arglist = (yyval.p) = linkum((yyvsp[-2].p),celltonode((yyvsp[0].cp),CVAR)); } -#line 3392 "y.tab.c" - break; - - case 184: -#line 441 "awkgram.y" - { (yyval.p) = celltonode((yyvsp[0].cp), CVAR); } -#line 3398 "y.tab.c" - break; - - case 185: -#line 442 "awkgram.y" - { (yyval.p) = op1(ARG, itonp((yyvsp[0].i))); } -#line 3404 "y.tab.c" - break; - - case 186: -#line 443 "awkgram.y" - { (yyval.p) = op1(VARNF, (Node *) (yyvsp[0].cp)); } -#line 3410 "y.tab.c" - break; - - case 187: -#line 448 "awkgram.y" - { (yyval.p) = notnull((yyvsp[-1].p)); } -#line 3416 "y.tab.c" - break; - - -#line 3420 "y.tab.c" - - default: break; - } - /* User semantic actions sometimes alter yychar, and that requires - that yytoken be updated with the new translation. We take the - approach of translating immediately before every use of yytoken. - One alternative is translating here after every semantic action, - but that translation would be missed if the semantic action invokes - YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or - if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an - incorrect destructor might then be invoked immediately. In the - case of YYERROR or YYBACKUP, subsequent parser actions might lead - to an incorrect destructor call or verbose syntax error message - before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - /* Now 'shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - { - const int yylhs = yyr1[yyn] - YYNTOKENS; - const int yyi = yypgoto[yylhs] + *yyssp; - yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp - ? yytable[yyi] - : yydefgoto[yylhs]); - } - - goto yynewstate; - - -/*--------------------------------------. -| yyerrlab -- here on detecting error. | -`--------------------------------------*/ -yyerrlab: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) - { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#endif - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - /* Pacify compilers when the user code never invokes YYERROR and the - label yyerrorlab therefore never appears in user code. */ - if (0) - YYERROR; - - /* Do not reclaim the symbols of the rule whose action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - - -#if !defined yyoverflow || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - - -/*-----------------------------------------------------. -| yyreturn -- parsing is finished, return the result. | -`-----------------------------------------------------*/ -yyreturn: - if (yychar != YYEMPTY) - { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE (yychar); - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - } - /* Do not reclaim the symbols of the rule whose action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - return yyresult; -} -#line 451 "awkgram.y" - - -void setfname(Cell *p) -{ - if (isarr(p)) - SYNTAX("%s is an array, not a function", p->nval); - else if (isfcn(p)) - SYNTAX("you can't define function %s more than once", p->nval); - curfname = p->nval; -} - -int constnode(Node *p) -{ - return isvalue(p) && ((Cell *) (p->narg[0]))->csub == CCON; -} - -char *strnode(Node *p) -{ - return ((Cell *)(p->narg[0]))->sval; -} - -Node *notnull(Node *n) -{ - switch (n->nobj) { - case LE: case LT: case EQ: case NE: case GT: case GE: - case BOR: case AND: case NOT: - return n; - default: - return op2(NE, n, nullnode); - } -} - -void checkdup(Node *vl, Cell *cp) /* check if name already in list */ -{ - char *s = cp->nval; - for ( ; vl; vl = vl->nnext) { - if (strcmp(s, ((Cell *)(vl->narg[0]))->nval) == 0) { - SYNTAX("duplicate argument %s", s); - break; - } - } -} @@ -1,270 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.4.1. */ - -/* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation, - Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* Undocumented macros, especially those whose name start with YY_, - are private implementation details. Do not rely on them. */ - -#ifndef YY_YY_Y_TAB_H_INCLUDED -# define YY_YY_Y_TAB_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int yydebug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - FIRSTTOKEN = 258, - PROGRAM = 259, - PASTAT = 260, - PASTAT2 = 261, - XBEGIN = 262, - XEND = 263, - NL = 264, - ARRAY = 265, - MATCH = 266, - NOTMATCH = 267, - MATCHOP = 268, - FINAL = 269, - DOT = 270, - ALL = 271, - CCL = 272, - NCCL = 273, - CHAR = 274, - OR = 275, - STAR = 276, - QUEST = 277, - PLUS = 278, - EMPTYRE = 279, - ZERO = 280, - AND = 281, - BOR = 282, - APPEND = 283, - EQ = 284, - GE = 285, - GT = 286, - LE = 287, - LT = 288, - NE = 289, - IN = 290, - ARG = 291, - BLTIN = 292, - BREAK = 293, - CLOSE = 294, - CONTINUE = 295, - DELETE = 296, - DO = 297, - EXIT = 298, - FOR = 299, - FUNC = 300, - SUB = 301, - GSUB = 302, - IF = 303, - INDEX = 304, - LSUBSTR = 305, - MATCHFCN = 306, - NEXT = 307, - NEXTFILE = 308, - ADD = 309, - MINUS = 310, - MULT = 311, - DIVIDE = 312, - MOD = 313, - ASSIGN = 314, - ASGNOP = 315, - ADDEQ = 316, - SUBEQ = 317, - MULTEQ = 318, - DIVEQ = 319, - MODEQ = 320, - POWEQ = 321, - PRINT = 322, - PRINTF = 323, - SPRINTF = 324, - ELSE = 325, - INTEST = 326, - CONDEXPR = 327, - POSTINCR = 328, - PREINCR = 329, - POSTDECR = 330, - PREDECR = 331, - VAR = 332, - IVAR = 333, - VARNF = 334, - CALL = 335, - NUMBER = 336, - STRING = 337, - REGEXPR = 338, - GETLINE = 339, - RETURN = 340, - SPLIT = 341, - SUBSTR = 342, - WHILE = 343, - CAT = 344, - NOT = 345, - UMINUS = 346, - UPLUS = 347, - POWER = 348, - DECR = 349, - INCR = 350, - INDIRECT = 351, - LASTTOKEN = 352 - }; -#endif -/* Tokens. */ -#define FIRSTTOKEN 258 -#define PROGRAM 259 -#define PASTAT 260 -#define PASTAT2 261 -#define XBEGIN 262 -#define XEND 263 -#define NL 264 -#define ARRAY 265 -#define MATCH 266 -#define NOTMATCH 267 -#define MATCHOP 268 -#define FINAL 269 -#define DOT 270 -#define ALL 271 -#define CCL 272 -#define NCCL 273 -#define CHAR 274 -#define OR 275 -#define STAR 276 -#define QUEST 277 -#define PLUS 278 -#define EMPTYRE 279 -#define ZERO 280 -#define AND 281 -#define BOR 282 -#define APPEND 283 -#define EQ 284 -#define GE 285 -#define GT 286 -#define LE 287 -#define LT 288 -#define NE 289 -#define IN 290 -#define ARG 291 -#define BLTIN 292 -#define BREAK 293 -#define CLOSE 294 -#define CONTINUE 295 -#define DELETE 296 -#define DO 297 -#define EXIT 298 -#define FOR 299 -#define FUNC 300 -#define SUB 301 -#define GSUB 302 -#define IF 303 -#define INDEX 304 -#define LSUBSTR 305 -#define MATCHFCN 306 -#define NEXT 307 -#define NEXTFILE 308 -#define ADD 309 -#define MINUS 310 -#define MULT 311 -#define DIVIDE 312 -#define MOD 313 -#define ASSIGN 314 -#define ASGNOP 315 -#define ADDEQ 316 -#define SUBEQ 317 -#define MULTEQ 318 -#define DIVEQ 319 -#define MODEQ 320 -#define POWEQ 321 -#define PRINT 322 -#define PRINTF 323 -#define SPRINTF 324 -#define ELSE 325 -#define INTEST 326 -#define CONDEXPR 327 -#define POSTINCR 328 -#define PREINCR 329 -#define POSTDECR 330 -#define PREDECR 331 -#define VAR 332 -#define IVAR 333 -#define VARNF 334 -#define CALL 335 -#define NUMBER 336 -#define STRING 337 -#define REGEXPR 338 -#define GETLINE 339 -#define RETURN 340 -#define SPLIT 341 -#define SUBSTR 342 -#define WHILE 343 -#define CAT 344 -#define NOT 345 -#define UMINUS 346 -#define UPLUS 347 -#define POWER 348 -#define DECR 349 -#define INCR 350 -#define INDIRECT 351 -#define LASTTOKEN 352 - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -union YYSTYPE -{ -#line 41 "awkgram.y" - - Node *p; - Cell *cp; - int i; - char *s; - -#line 258 "y.tab.h" - -}; -typedef union YYSTYPE YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - - -extern YYSTYPE yylval; - -int yyparse (void); - -#endif /* !YY_YY_Y_TAB_H_INCLUDED */ |