home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / MPW / gawk 2.11.1r3 / Sources / awk.tab.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-02  |  93.9 KB  |  3,046 lines  |  [TEXT/MPS ]

  1.  
  2. /*  A Bison parser, made from awk.y  */
  3.  
  4. #define    FUNC_CALL    258
  5. #define    NAME    259
  6. #define    REGEXP    260
  7. #define    ERROR    261
  8. #define    NUMBER    262
  9. #define    YSTRING    263
  10. #define    RELOP    264
  11. #define    APPEND_OP    265
  12. #define    ASSIGNOP    266
  13. #define    MATCHOP    267
  14. #define    NEWLINE    268
  15. #define    CONCAT_OP    269
  16. #define    LEX_BEGIN    270
  17. #define    LEX_END    271
  18. #define    LEX_IF    272
  19. #define    LEX_ELSE    273
  20. #define    LEX_RETURN    274
  21. #define    LEX_DELETE    275
  22. #define    LEX_WHILE    276
  23. #define    LEX_DO    277
  24. #define    LEX_FOR    278
  25. #define    LEX_BREAK    279
  26. #define    LEX_CONTINUE    280
  27. #define    LEX_PRINT    281
  28. #define    LEX_PRINTF    282
  29. #define    LEX_NEXT    283
  30. #define    LEX_EXIT    284
  31. #define    LEX_FUNCTION    285
  32. #define    LEX_GETLINE    286
  33. #define    LEX_IN    287
  34. #define    LEX_AND    288
  35. #define    LEX_OR    289
  36. #define    INCREMENT    290
  37. #define    DECREMENT    291
  38. #define    LEX_BUILTIN    292
  39. #define    LEX_LENGTH    293
  40. #define    UNARY    294
  41.  
  42. #line 28 "awk.y"
  43.  
  44. #ifdef DEBUG
  45. #define YYDEBUG 12
  46. #endif
  47.  
  48. #include "awk.h"
  49. #ifdef macintosh
  50. #include "StdLib.h"
  51. #endif
  52.  
  53. /*
  54.  * This line is necessary since the Bison parser skeleton uses bcopy.
  55.  * Systems without memcpy should use -DMEMCPY_MISSING, per the Makefile.
  56.  * It should not hurt anything if Yacc is being used instead of Bison.
  57.  */
  58. #define bcopy(s,d,n)    memcpy((d),(s),(n))
  59.  
  60. extern void msg();
  61. extern struct re_pattern_buffer *mk_re_parse();
  62.  
  63. NODE *node();
  64. NODE *lookup();
  65. NODE *install();
  66.  
  67. static NODE *snode();
  68. static NODE *mkrangenode();
  69. static FILE *pathopen();
  70. static NODE *make_for_loop();
  71. static NODE *append_right();
  72. static void func_install();
  73. static NODE *make_param();
  74. static int hashf();
  75. static void pop_params();
  76. static void pop_var();
  77. static int yylex ();
  78. #ifndef macintosh
  79. static void yyerror();
  80. #else
  81. static void yyerror(char *, ...);
  82. #endif
  83.  
  84. static int want_regexp;        /* lexical scanning kludge */
  85. static int want_assign;        /* lexical scanning kludge */
  86. static int can_return;        /* lexical scanning kludge */
  87. static int io_allowed = 1;    /* lexical scanning kludge */
  88. static int lineno = 1;        /* for error msgs */
  89. static char *lexptr;        /* pointer to next char during parsing */
  90. static char *lexptr_begin;    /* keep track of where we were for error msgs */
  91. static int curinfile = -1;    /* index into sourcefiles[] */
  92. static int param_counter;
  93.  
  94. NODE *variables[HASHSIZE];
  95.  
  96. extern int errcount;
  97. extern NODE *begin_block;
  98. extern NODE *end_block;
  99.  
  100. #line 86 "awk.y"
  101. typedef union {
  102.     long lval;
  103.     AWKNUM fval;
  104.     NODE *nodeval;
  105.     NODETYPE nodetypeval;
  106.     char *sval;
  107.     NODE *(*ptrval)();
  108. } YYSTYPE;
  109.  
  110. #ifndef YYLTYPE
  111. typedef
  112.   struct yyltype
  113.     {
  114.       int timestamp;
  115.       int first_line;
  116.       int first_column;
  117.       int last_line;
  118.       int last_column;
  119.       char *text;
  120.    }
  121.   yyltype;
  122.  
  123. #define YYLTYPE yyltype
  124. #endif
  125.  
  126. #define    YYACCEPT    return(0)
  127. #define    YYABORT    return(1)
  128. #define    YYERROR    return(1)
  129. #include <stdio.h>
  130.  
  131. #ifndef __STDC__
  132. #define const
  133. #endif
  134.  
  135.  
  136.  
  137. #define    YYFINAL        298
  138. #define    YYFLAG        -32768
  139. #define    YYNTBASE    61
  140.  
  141. #define YYTRANSLATE(x) ((unsigned)(x) <= 294 ? yytranslate[x] : 105)
  142.  
  143. static const char yytranslate[] = {     0,
  144.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  145.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  146.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  147.      2,     2,    49,     2,     2,    52,    48,     2,     2,    53,
  148.     54,    46,    44,    60,    45,     2,    47,     2,     2,     2,
  149.      2,     2,     2,     2,     2,     2,     2,    40,    59,    41,
  150.      2,    42,    39,     2,     2,     2,     2,     2,     2,     2,
  151.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  152.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  153.     55,     2,    56,    51,     2,     2,     2,     2,     2,     2,
  154.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  155.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  156.      2,     2,    57,    43,    58,     2,     2,     2,     2,     2,
  157.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  158.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  159.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  160.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  161.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  162.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  163.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  164.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  165.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  166.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  167.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  168.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  169.      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
  170.      6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
  171.     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
  172.     26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
  173.     36,    37,    38,    50
  174. };
  175.  
  176. static const short yyrline[] = {     0,
  177.    145,   150,   158,   174,   175,   179,   181,   196,   198,   212,
  178.    218,   224,   226,   228,   230,   239,   241,   246,   250,   258,
  179.    267,   269,   278,   280,   291,   296,   301,   303,   311,   313,
  180.    318,   320,   326,   328,   330,   332,   334,   336,   338,   343,
  181.    347,   352,   355,   358,   360,   362,   365,   366,   368,   370,
  182.    372,   374,   379,   381,   386,   391,   398,   400,   405,   407,
  183.    412,   414,   419,   421,   423,   425,   430,   432,   437,   439,
  184.    441,   443,   445,   451,   453,   458,   460,   465,   467,   473,
  185.    475,   477,   479,   484,   486,   491,   493,   499,   501,   503,
  186.    505,   510,   513,   514,   516,   521,   530,   532,   534,   536,
  187.    538,   540,   542,   544,   546,   548,   550,   552,   557,   560,
  188.    561,   563,   565,   574,   576,   578,   580,   582,   584,   586,
  189.    588,   593,   595,   597,   599,   601,   603,   607,   609,   611,
  190.    613,   615,   617,   619,   623,   625,   627,   629,   631,   633,
  191.    635,   637,   642,   644,   649,   651,   653,   658,   662,   666,
  192.    670,   671,   675,   678
  193. };
  194.  
  195. static const char * const yytname[] = {     0,
  196. "error","$illegal.","FUNC_CALL","NAME","REGEXP","ERROR","NUMBER","YSTRING","RELOP","APPEND_OP",
  197. "ASSIGNOP","MATCHOP","NEWLINE","CONCAT_OP","LEX_BEGIN","LEX_END","LEX_IF","LEX_ELSE","LEX_RETURN","LEX_DELETE",
  198. "LEX_WHILE","LEX_DO","LEX_FOR","LEX_BREAK","LEX_CONTINUE","LEX_PRINT","LEX_PRINTF","LEX_NEXT","LEX_EXIT","LEX_FUNCTION",
  199. "LEX_GETLINE","LEX_IN","LEX_AND","LEX_OR","INCREMENT","DECREMENT","LEX_BUILTIN","LEX_LENGTH","'?'","':'",
  200. "'<'","'>'","'|'","'+'","'-'","'*'","'/'","'%'","'!'","UNARY",
  201. "'^'","'$'","'('","')'","'['","']'","'{'","'}'","';'","','",
  202. "start"
  203. };
  204.  
  205. static const short yyr1[] = {     0,
  206.     61,    62,    62,    62,    62,    64,    63,    65,    63,    63,
  207.     63,    63,    63,    63,    63,    66,    66,    68,    67,    69,
  208.     70,    70,    72,    71,    73,    73,    74,    74,    74,    74,
  209.     75,    75,    76,    76,    76,    76,    76,    76,    76,    76,
  210.     76,    76,    76,    76,    76,    77,    76,    76,    78,    76,
  211.     76,    76,    79,    79,    80,    80,    81,    81,    82,    82,
  212.     83,    83,    84,    84,    84,    84,    85,    85,    86,    86,
  213.     86,    86,    86,    87,    87,    88,    88,    89,    89,    89,
  214.     89,    89,    89,    90,    90,    91,    91,    91,    91,    91,
  215.     91,    93,    92,    92,    92,    92,    92,    92,    92,    92,
  216.     92,    92,    92,    92,    92,    92,    92,    92,    95,    94,
  217.     94,    94,    94,    94,    94,    94,    94,    94,    94,    94,
  218.     94,    96,    96,    96,    96,    96,    96,    96,    96,    96,
  219.     96,    96,    96,    96,    96,    96,    96,    96,    96,    96,
  220.     96,    96,    97,    97,    98,    98,    98,    99,   100,   101,
  221.    102,   102,   103,   104
  222. };
  223.  
  224. static const short yyr2[] = {     0,
  225.      3,     1,     2,     1,     2,     0,     3,     0,     3,     2,
  226.      2,     2,     1,     2,     2,     1,     1,     0,     7,     3,
  227.      1,     3,     0,     4,     3,     4,     1,     2,     1,     2,
  228.      1,     2,     2,     2,     3,     1,     6,     8,     8,    10,
  229.      9,     2,     2,     6,     4,     0,     3,     3,     0,     4,
  230.      6,     2,     1,     1,     6,     9,     1,     2,     0,     1,
  231.      0,     2,     0,     2,     2,     2,     0,     1,     1,     3,
  232.      1,     2,     3,     0,     1,     0,     1,     1,     3,     1,
  233.      2,     3,     3,     0,     1,     1,     3,     1,     2,     3,
  234.      3,     0,     4,     5,     4,     3,     3,     3,     3,     1,
  235.      2,     3,     3,     3,     3,     5,     1,     2,     0,     4,
  236.      3,     3,     3,     1,     2,     3,     3,     3,     5,     1,
  237.      2,     2,     3,     4,     4,     1,     4,     2,     2,     2,
  238.      2,     1,     1,     1,     3,     3,     3,     3,     3,     3,
  239.      2,     2,     0,     1,     1,     4,     2,     2,     2,     1,
  240.      0,     1,     1,     2
  241. };
  242.  
  243. static const short yydefact[] = {    59,
  244.     57,    60,     0,    58,     4,     0,   145,   133,   134,     6,
  245.      8,    18,   143,     0,     0,     0,   126,     0,     0,    23,
  246.      0,     0,     0,    59,     0,     2,     0,     0,   100,    13,
  247.     21,   107,   132,     0,     0,     0,   153,     0,    10,    31,
  248.     59,     0,    11,     0,    61,   144,   128,   129,     0,     0,
  249.      0,     0,   142,   132,   141,     0,   101,   122,   147,    88,
  250.      0,    86,   148,     5,     3,     1,    15,     0,    12,    14,
  251.      0,     0,     0,     0,     0,     0,     0,     0,     0,    59,
  252.    108,     0,     0,     0,     0,     0,     0,     0,    92,   130,
  253.    131,    29,     0,    49,     0,     0,    59,     0,     0,     0,
  254.     53,    54,    46,    74,    59,     0,    27,     0,    36,     0,
  255.      0,   151,    59,     0,     0,    86,     0,     7,    32,     9,
  256.     17,    16,     0,     0,    96,     0,     0,     0,     0,    89,
  257.    150,     0,     0,   123,     0,   103,    99,   102,    97,    98,
  258.      0,   104,   105,   143,   154,    22,   139,   140,   136,   137,
  259.    138,   135,     0,     0,    74,     0,     0,     0,    74,    42,
  260.     43,     0,     0,    75,   149,    30,    28,   151,    80,   143,
  261.      0,     0,   114,    63,     0,    78,   120,   132,    52,     0,
  262.     34,    25,   152,    33,   127,   146,     0,    62,   124,   125,
  263.     24,    90,     0,    91,    87,    20,     0,    95,    93,     0,
  264.      0,     0,     0,     0,   145,     0,    47,    48,    26,    61,
  265.    115,     0,     0,     0,     0,     0,    81,     0,     0,     0,
  266.      0,     0,     0,     0,   121,   109,    35,    71,    69,     0,
  267.      0,    94,   106,    59,    50,     0,    59,     0,     0,     0,
  268.    113,    63,    65,    64,    66,    45,    82,    83,    79,   118,
  269.    116,   117,   111,   112,     0,     0,    59,    72,     0,     0,
  270.      0,     0,     0,     0,     0,    74,     0,     0,   110,    19,
  271.     73,    70,    55,    51,    37,     0,    59,    74,     0,    44,
  272.    119,    59,    59,     0,     0,    59,     0,    38,    39,    59,
  273.      0,    56,     0,    41,    40,     0,     0,     0
  274. };
  275.  
  276. static const short yydefgoto[] = {   296,
  277.     25,    26,    38,    42,   123,    27,    44,    67,    28,    29,
  278.     56,    30,   106,    39,   107,   162,   155,   108,   109,     2,
  279.      3,   125,   216,   230,   231,   163,   174,   175,   114,   115,
  280.     81,   153,   225,   256,    32,    45,    33,   111,   112,   134,
  281.    182,   113,   133
  282. };
  283.  
  284. static const short yypact[] = {    21,
  285. -32768,    37,  1020,-32768,-32768,   -32,     1,-32768,-32768,    17,
  286.     17,-32768,    11,    11,    11,    31,    45,  1757,  1757,-32768,
  287.   1738,  1757,  1112,    21,   540,-32768,    13,    40,-32768,-32768,
  288.    816,   142,    55,   612,  1092,  1112,-32768,    13,-32768,    37,
  289.     21,    13,-32768,    51,    59,-32768,-32768,-32768,  1092,  1092,
  290.   1757,  1625,    27,    -7,    27,    97,-32768,    27,-32768,-32768,
  291.      4,  1225,-32768,-32768,-32768,-32768,-32768,   706,-32768,-32768,
  292.   1625,  1625,   100,  1625,  1625,  1625,  1625,  1625,    76,    21,
  293.    300,  1625,  1757,  1757,  1757,  1757,  1757,  1757,-32768,-32768,
  294. -32768,-32768,    52,-32768,   109,    62,    21,    64,    17,    17,
  295. -32768,-32768,-32768,  1625,    21,   659,-32768,   763,-32768,   920,
  296.    612,    65,    21,    67,     7,  1324,    25,-32768,-32768,-32768,
  297. -32768,-32768,    70,  1757,-32768,    67,    67,  1225,    84,  1625,
  298. -32768,   101,  1159,-32768,   659,   300,  1796,-32768,  1465,  1371,
  299.   1277,   300,   300,    11,-32768,  1324,   -10,   -10,    27,    27,
  300.     27,    27,  1625,  1625,  1625,    87,  1625,   863,  1672,-32768,
  301. -32768,    17,    17,  1324,-32768,-32768,-32768,    65,-32768,    11,
  302.   1738,  1112,-32768,     9,     0,  1512,   142,    83,-32768,   659,
  303. -32768,-32768,-32768,-32768,-32768,-32768,     8,   142,-32768,-32768,
  304. -32768,  1324,   134,-32768,  1324,-32768,  1625,-32768,  1324,  1225,
  305.     17,  1112,  1225,   122,   -16,    65,-32768,-32768,-32768,    59,
  306. -32768,     4,  1625,  1625,  1625,    17,  1691,  1178,  1691,  1691,
  307.    140,  1691,  1691,  1691,   939,-32768,-32768,-32768,-32768,    67,
  308.     23,-32768,  1324,    21,-32768,    26,    21,    94,   144,  1045,
  309. -32768,     9,  1324,  1324,  1324,-32768,  1512,-32768,  1512,   939,
  310.    782,-32768,  1606,  1559,  1418,  1691,    21,-32768,    44,   863,
  311.     17,   863,  1625,    67,   973,  1625,    17,  1691,  1512,-32768,
  312. -32768,-32768,   131,-32768,-32768,  1225,    21,  1625,    67,-32768,
  313.   1512,    21,    21,   863,    67,    21,   863,-32768,-32768,    21,
  314.    863,-32768,   863,-32768,-32768,   163,   166,-32768
  315. };
  316.  
  317. static const short yypgoto[] = {-32768,
  318. -32768,   145,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   201,
  319. -32768,    78,   -54,    12,   225,-32768,-32768,-32768,-32768,   363,
  320.    104,   -39,   -70,-32768,-32768,  -152,-32768,-32768,    60,   -19,
  321.     -3,-32768,   -83,-32768,   146,  -126,    74,   178,  -100,   319,
  322.     10,   329,   -29
  323. };
  324.  
  325.  
  326. #define    YYLAST        1849
  327.  
  328.  
  329. static const short yytable[] = {    31,
  330.    217,    82,   201,    61,   130,   168,   206,   130,   228,   -77,
  331.    181,   229,   -77,   135,     7,   239,   117,   198,   213,    62,
  332.     35,    31,    43,   258,   176,   130,   130,    90,    91,     1,
  333.    110,   116,   116,     1,   196,    85,    86,    87,    36,    70,
  334.     88,   -77,   -77,   210,   271,   116,   116,   272,   128,     4,
  335.    214,   215,     1,   121,   122,    36,   180,   131,   -77,    80,
  336.    -85,   -67,    22,    80,   110,    89,    80,   136,   137,    24,
  337.    139,   140,   141,   142,   143,    37,   -68,    88,   146,   227,
  338.    186,   261,    80,    49,    80,    80,    46,    47,    48,    90,
  339.     91,    54,    54,   226,    54,    54,    24,    50,    37,   124,
  340.    164,   129,   110,   138,   154,    69,   144,   110,   126,   127,
  341.    160,   161,   156,   279,   157,   118,   159,    90,    91,   120,
  342.    131,   179,   187,    37,    54,   285,   192,    63,    66,   195,
  343.    191,   110,   193,   247,   249,   250,   251,   232,   253,   254,
  344.    255,   202,   238,   252,   119,   218,   263,   264,   282,   199,
  345.    200,   164,   212,   203,   110,   164,    54,    54,    54,    54,
  346.     54,    54,   297,    53,    55,   298,    58,    59,    62,    65,
  347.    241,   267,   269,   207,   208,     0,   110,   209,     0,     0,
  348.     34,   178,   236,   145,   281,    83,    84,    85,    86,    87,
  349.      0,     0,    88,   233,     0,     0,    58,    54,   116,     0,
  350.    158,   259,    34,     0,    68,    34,     0,     0,   165,   243,
  351.    244,   245,   235,     0,     0,    34,   184,    46,     0,    34,
  352.      0,    57,     0,     0,     0,     0,     0,   246,   147,   148,
  353.    149,   150,   151,   152,     0,     0,   265,     0,     0,     0,
  354.      0,     0,     0,    46,    54,     0,     0,     0,     0,   178,
  355.      0,     0,     0,   177,     0,     0,   110,     0,   110,   276,
  356.      0,     0,   164,     0,     0,     0,     0,     0,     0,   188,
  357.      0,     0,   274,     0,   164,     0,     0,     0,   280,     0,
  358.    110,     0,     0,   110,     0,     0,     0,   110,     0,   110,
  359.    178,   178,   178,   178,     0,   178,   178,   178,   178,     0,
  360.      0,     0,     0,     7,     0,     0,     8,     9,   173,     0,
  361.      0,     0,     0,     0,     0,     0,    58,     0,     0,     0,
  362.    178,   177,   178,   178,   178,     0,   178,   178,   178,   178,
  363.    167,     0,     0,     0,    14,    15,     0,   260,    41,    41,
  364.    262,   178,   178,    18,    19,     0,    20,     0,    21,     0,
  365.      0,    22,    23,     0,   178,     0,    41,     0,     0,   167,
  366.    270,     0,   177,   177,   177,   177,     0,   177,   177,   177,
  367.    177,   211,    40,    40,     0,     0,   173,     0,     0,   132,
  368.    284,     0,   204,     0,     0,   287,   288,     0,     0,   291,
  369.     40,     0,   177,   293,   177,   177,   177,     0,   177,   177,
  370.    177,   177,     0,     0,   167,     0,     0,     0,     0,     0,
  371.      0,     0,     0,   177,   177,     0,     0,   173,   173,   173,
  372.    173,     0,   173,   173,   173,   173,   177,    41,    41,     0,
  373.      0,     0,   185,     0,     0,     0,     0,     0,    41,     0,
  374.    183,     0,     0,     0,   189,   190,     0,   173,     0,   173,
  375.    173,   173,     0,   173,   173,   173,   173,     0,     0,     0,
  376.      0,    40,    40,     0,     0,     0,     0,     0,   173,   173,
  377.      0,     0,    40,     0,     0,     0,     0,     0,     0,     0,
  378.      0,   173,     0,     0,   273,     0,   275,     0,     0,     0,
  379.     41,    41,     0,     0,     0,     0,   183,     0,     0,     0,
  380.      0,     0,     0,     0,     0,     0,     0,     0,   289,     0,
  381.      0,   292,     0,     0,     0,   294,     0,   295,   234,     0,
  382.      0,   237,     0,     0,    40,    40,     0,     0,     0,    41,
  383.    242,     0,     0,     0,   240,     0,     0,     0,     0,   -59,
  384.     64,     0,     6,     7,    41,     0,     8,     9,   257,     0,
  385.      0,     0,     1,     0,    10,    11,     0,     0,     0,     0,
  386.      0,     0,     0,    40,     0,     0,     0,     0,   266,    12,
  387.     13,     0,     0,     0,    14,    15,    16,    17,    40,     0,
  388.      0,     0,   277,    18,    19,     0,    20,     0,    21,    41,
  389.      0,    22,    23,   278,   283,    41,    24,   286,     0,     0,
  390.      0,     0,     0,   290,     0,     0,     0,     0,     0,     0,
  391.      0,     0,    92,     0,     6,     7,     0,     0,     8,     9,
  392.      0,     0,     0,    40,     0,     0,     0,     0,    93,    40,
  393.     94,    95,    96,    97,    98,    99,   100,   101,   102,   103,
  394.    104,     0,    13,     0,     0,     0,    14,    15,    16,    17,
  395.      0,     0,     0,     0,     0,    18,    19,     0,    20,   166,
  396.     21,     6,     7,    22,    23,     8,     9,     0,    24,   105,
  397.     37,     0,     0,     0,     0,    93,     0,    94,    95,    96,
  398.     97,    98,    99,   100,   101,   102,   103,   104,     0,    13,
  399.      0,     0,     0,    14,    15,    16,    17,     0,     0,     0,
  400.      0,     0,    18,    19,     0,    20,    92,    21,     6,     7,
  401.     22,    23,     8,     9,     0,    24,   105,    37,     0,     0,
  402.      0,     0,    93,     0,    94,    95,    96,    97,    98,    99,
  403.    100,   101,   102,   103,   104,     0,    13,     0,     0,     0,
  404.     14,    15,    16,    17,     0,     0,     0,     0,     0,    18,
  405.     19,     0,    20,     0,    21,     0,     0,    22,    23,     0,
  406.      0,     0,    24,   169,    37,     6,     7,     0,     0,     8,
  407.      9,     0,   -76,     0,     0,   -76,     0,     0,     0,     0,
  408.      0,     0,     0,     0,     0,     7,     0,     0,     8,     9,
  409.    219,     0,     0,   170,     0,     0,     0,    14,    15,    16,
  410.     17,     0,     0,     0,   -76,   -76,    18,    19,     0,    20,
  411.      0,   171,     0,     0,    22,   172,    14,    15,     6,     7,
  412.      0,   -76,     8,     9,    71,    18,    19,    72,    20,     0,
  413.    171,     0,     0,    22,    52,     0,     0,     0,     0,     0,
  414.      0,     0,     0,     0,     0,     0,    13,    73,    74,    75,
  415.     14,    15,    16,    17,    76,     0,    77,    78,    79,    18,
  416.     19,     0,    20,     0,    21,     6,     7,    22,    23,     8,
  417.      9,     0,     0,     0,     0,    80,     0,     0,     0,    93,
  418.      0,    94,    95,    96,    97,    98,    99,   100,   101,   102,
  419.    103,   104,     0,    13,     0,     0,     0,    14,    15,    16,
  420.     17,     0,     0,     0,     0,     0,    18,    19,     0,    20,
  421.      0,    21,     0,     0,    22,    23,     0,     0,     0,    24,
  422.      0,    37,     6,     7,     0,     0,     8,     9,    71,     0,
  423.      0,    72,     1,     0,     0,     0,     0,     0,     0,     0,
  424.      0,     0,     7,     0,     0,     8,     9,     0,     0,     0,
  425.     13,    73,    74,    75,    14,    15,    16,    17,    76,     0,
  426.     77,    78,    79,    18,    19,     0,    20,     0,    21,     0,
  427.      0,    22,    23,    14,    15,     6,     7,     0,    37,     8,
  428.      9,    71,    18,    19,    72,    20,     0,   171,     0,     0,
  429.     22,    52,     0,     0,     0,     0,     0,     0,     0,     0,
  430.      0,     0,     0,    13,    73,    74,    75,    14,    15,    16,
  431.     17,    76,     0,    77,    78,    79,    18,    19,     0,    20,
  432.      5,    21,     6,     7,    22,    23,     8,     9,     0,     0,
  433.      0,    37,     0,     0,    10,    11,     0,     0,     0,     0,
  434.      0,     0,     0,     0,     0,     0,     0,     6,     7,    12,
  435.     13,     8,     9,     0,    14,    15,    16,    17,     0,     0,
  436.      0,     0,     0,    18,    19,     0,    20,     0,    21,     0,
  437.      0,    22,    23,     0,     0,    13,    24,     0,     0,    14,
  438.     15,    16,    17,     0,     0,     0,     0,     0,    18,    19,
  439.      0,    20,    60,    21,     6,     7,    22,    23,     8,     9,
  440.      0,     0,     0,    37,     0,     0,     0,     0,     0,     0,
  441.      0,     0,    60,     0,     6,     7,     0,     0,     8,     9,
  442.      0,     0,    13,     0,     0,     0,    14,    15,    16,    17,
  443.      0,     0,     0,     0,     0,    18,    19,     0,    20,     0,
  444.     21,     0,    13,    22,    23,   -84,    14,    15,    16,    17,
  445.      0,     0,     0,     0,     0,    18,    19,     0,    20,   194,
  446.     21,     6,     7,    22,    23,     8,     9,     0,     0,     0,
  447.      0,     0,     0,     0,     0,     0,     0,     0,   248,     0,
  448.      6,     7,     0,     0,     8,     9,     0,     0,     0,    13,
  449.      0,     0,     0,    14,    15,    16,    17,     0,     0,     0,
  450.      0,     0,    18,    19,     0,    20,     0,    21,   170,     0,
  451.     22,    23,    14,    15,    16,    17,     0,     0,     0,     0,
  452.      0,    18,    19,     0,    20,     0,   171,     6,     7,    22,
  453.     52,     8,     9,    71,     0,     0,    72,     0,     0,     0,
  454.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  455.      0,     0,     0,     0,     0,    13,    73,    74,    75,    14,
  456.     15,    16,    17,    76,     0,    77,    78,    79,    18,    19,
  457.      0,    20,     0,    21,     0,     0,    22,    23,   131,     6,
  458.      7,     0,     0,     8,     9,    71,     0,     0,    72,     0,
  459.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  460.      0,     0,     0,     0,     0,     0,     0,    13,    73,    74,
  461.     75,    14,    15,    16,    17,    76,   197,    77,    78,    79,
  462.     18,    19,     0,    20,     0,    21,     6,     7,    22,    23,
  463.      8,     9,    71,     0,     0,    72,     0,     0,     0,     0,
  464.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  465.      0,     0,     0,     0,    13,    73,    74,    75,    14,    15,
  466.     16,    17,    76,     0,    77,    78,    79,    18,    19,     0,
  467.     20,     0,    21,     6,     7,    22,    23,     8,     9,    71,
  468.      0,     0,    72,     0,     0,     0,     0,     0,     0,     0,
  469.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  470.      0,    13,    73,    74,     0,    14,    15,    16,    17,     0,
  471.      0,    77,    78,    79,    18,    19,     0,    20,     0,    21,
  472.      6,     7,    22,    23,     8,     9,   219,     0,     0,   220,
  473.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  474.      0,     0,     0,     0,     0,     0,     0,     0,   170,   221,
  475.    222,   223,    14,    15,    16,    17,   224,   268,     0,     0,
  476.      0,    18,    19,     0,    20,     0,   171,     6,     7,    22,
  477.     52,     8,     9,    71,     0,     0,    72,     0,     0,     0,
  478.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  479.      0,     0,     0,     0,     0,    13,    73,     0,     0,    14,
  480.     15,    16,    17,     0,     0,    77,    78,    79,    18,    19,
  481.      0,    20,     0,    21,     6,     7,    22,    23,     8,     9,
  482.    219,     0,     0,   220,     0,     0,     0,     0,     0,     0,
  483.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  484.      0,     0,   170,   221,   222,   223,    14,    15,    16,    17,
  485.    224,     0,     0,     0,     0,    18,    19,     0,    20,     0,
  486.    171,     6,     7,    22,    52,     8,     9,   219,     0,     0,
  487.    220,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  488.      0,     0,     0,     0,     0,     0,     0,     0,     0,   170,
  489.    221,   222,     0,    14,    15,    16,    17,     0,     0,     0,
  490.      0,     0,    18,    19,     0,    20,     0,   171,     6,     7,
  491.     22,    52,     8,     9,   219,     0,     0,   220,     0,     0,
  492.      0,     0,     0,     0,     0,     0,     0,     6,     7,     0,
  493.      0,     8,     9,     0,     0,     0,   170,   221,     0,     0,
  494.     14,    15,    16,    17,     0,     0,     0,     0,     0,    18,
  495.     19,     0,    20,     0,   171,    13,     0,    22,    52,    14,
  496.     15,    16,    17,     0,     0,     0,     0,     0,    18,    19,
  497.      0,    20,     0,    21,     6,   205,    22,    23,     8,     9,
  498.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  499.      0,     0,     0,     6,     7,     0,     0,     8,     9,     0,
  500.      0,     0,    13,     0,     0,     0,    14,    15,    16,    17,
  501.      0,     0,     0,     0,     0,    18,    19,     0,    20,     0,
  502.     21,   170,     0,    22,    23,    14,    15,    16,    17,     0,
  503.      0,     0,     0,     0,    18,    19,     0,    20,     0,   171,
  504.      6,     7,    22,    52,     8,     9,     0,     0,     0,     0,
  505.      0,     0,     0,     0,     0,     0,     0,     0,     0,     6,
  506.      7,     0,     0,     8,     9,     0,     0,     0,     0,     0,
  507.      0,     0,    14,    15,    16,    17,     0,     0,     0,     0,
  508.      0,    18,    19,     0,    20,     0,    51,     0,     0,    22,
  509.     52,    14,    15,    16,    17,     0,     0,     0,     0,     7,
  510.     18,    19,     8,     9,    71,    51,     0,     0,    22,    52,
  511.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  512.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  513.     14,    15,     0,     0,     0,     0,    77,    78,    79,    18,
  514.     19,     0,    20,     0,    21,     0,     0,    22,    23
  515. };
  516.  
  517. static const short yycheck[] = {     3,
  518.      1,    31,   155,    23,     1,   106,   159,     1,     1,    10,
  519.    111,     4,    13,    68,     4,    32,    36,   144,    10,    23,
  520.     53,    25,    11,     1,   108,     1,     1,    35,    36,    13,
  521.     34,    35,    36,    13,   135,    46,    47,    48,    55,    28,
  522.     51,    42,    43,   170,     1,    49,    50,     4,    52,    13,
  523.     42,    43,    13,     3,     4,    55,   111,    54,    59,    60,
  524.     54,    54,    52,    60,    68,    11,    60,    71,    72,    57,
  525.     74,    75,    76,    77,    78,    59,    54,    51,    82,   180,
  526.     56,    56,    60,    53,    60,    60,    13,    14,    15,    35,
  527.     36,    18,    19,    11,    21,    22,    57,    53,    59,    41,
  528.    104,     5,   106,     4,    53,    28,    31,   111,    49,    50,
  529.     99,   100,     4,   266,    53,    38,    53,    35,    36,    42,
  530.     54,   110,    53,    59,    51,   278,   130,    24,    25,   133,
  531.     47,   135,    32,   217,   218,   219,   220,     4,   222,   223,
  532.    224,    55,    21,     4,    41,   175,    53,     4,    18,   153,
  533.    154,   155,   172,   157,   158,   159,    83,    84,    85,    86,
  534.     87,    88,     0,    18,    19,     0,    21,    22,   172,    25,
  535.    210,   242,   256,   162,   163,    -1,   180,   168,    -1,    -1,
  536.      3,   108,   202,    80,   268,    44,    45,    46,    47,    48,
  537.     -1,    -1,    51,   197,    -1,    -1,    51,   124,   202,    -1,
  538.     97,   231,    25,    -1,    27,    28,    -1,    -1,   105,   213,
  539.    214,   215,   201,    -1,    -1,    38,   113,   144,    -1,    42,
  540.     -1,    21,    -1,    -1,    -1,    -1,    -1,   216,    83,    84,
  541.     85,    86,    87,    88,    -1,    -1,   240,    -1,    -1,    -1,
  542.     -1,    -1,    -1,   170,   171,    -1,    -1,    -1,    -1,   176,
  543.     -1,    -1,    -1,   108,    -1,    -1,   260,    -1,   262,   263,
  544.     -1,    -1,   266,    -1,    -1,    -1,    -1,    -1,    -1,   124,
  545.     -1,    -1,   261,    -1,   278,    -1,    -1,    -1,   267,    -1,
  546.    284,    -1,    -1,   287,    -1,    -1,    -1,   291,    -1,   293,
  547.    217,   218,   219,   220,    -1,   222,   223,   224,   225,    -1,
  548.     -1,    -1,    -1,     4,    -1,    -1,     7,     8,   108,    -1,
  549.     -1,    -1,    -1,    -1,    -1,    -1,   171,    -1,    -1,    -1,
  550.    247,   176,   249,   250,   251,    -1,   253,   254,   255,   256,
  551.    106,    -1,    -1,    -1,    35,    36,    -1,   234,    10,    11,
  552.    237,   268,   269,    44,    45,    -1,    47,    -1,    49,    -1,
  553.     -1,    52,    53,    -1,   281,    -1,    28,    -1,    -1,   135,
  554.    257,    -1,   217,   218,   219,   220,    -1,   222,   223,   224,
  555.    225,   171,    10,    11,    -1,    -1,   176,    -1,    -1,    61,
  556.    277,    -1,   158,    -1,    -1,   282,   283,    -1,    -1,   286,
  557.     28,    -1,   247,   290,   249,   250,   251,    -1,   253,   254,
  558.    255,   256,    -1,    -1,   180,    -1,    -1,    -1,    -1,    -1,
  559.     -1,    -1,    -1,   268,   269,    -1,    -1,   217,   218,   219,
  560.    220,    -1,   222,   223,   224,   225,   281,    99,   100,    -1,
  561.     -1,    -1,   114,    -1,    -1,    -1,    -1,    -1,   110,    -1,
  562.    112,    -1,    -1,    -1,   126,   127,    -1,   247,    -1,   249,
  563.    250,   251,    -1,   253,   254,   255,   256,    -1,    -1,    -1,
  564.     -1,    99,   100,    -1,    -1,    -1,    -1,    -1,   268,   269,
  565.     -1,    -1,   110,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  566.     -1,   281,    -1,    -1,   260,    -1,   262,    -1,    -1,    -1,
  567.    162,   163,    -1,    -1,    -1,    -1,   168,    -1,    -1,    -1,
  568.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   284,    -1,
  569.     -1,   287,    -1,    -1,    -1,   291,    -1,   293,   200,    -1,
  570.     -1,   203,    -1,    -1,   162,   163,    -1,    -1,    -1,   201,
  571.    212,    -1,    -1,    -1,   206,    -1,    -1,    -1,    -1,     0,
  572.      1,    -1,     3,     4,   216,    -1,     7,     8,   230,    -1,
  573.     -1,    -1,    13,    -1,    15,    16,    -1,    -1,    -1,    -1,
  574.     -1,    -1,    -1,   201,    -1,    -1,    -1,    -1,   240,    30,
  575.     31,    -1,    -1,    -1,    35,    36,    37,    38,   216,    -1,
  576.     -1,    -1,   264,    44,    45,    -1,    47,    -1,    49,   261,
  577.     -1,    52,    53,   265,   276,   267,    57,   279,    -1,    -1,
  578.     -1,    -1,    -1,   285,    -1,    -1,    -1,    -1,    -1,    -1,
  579.     -1,    -1,     1,    -1,     3,     4,    -1,    -1,     7,     8,
  580.     -1,    -1,    -1,   261,    -1,    -1,    -1,    -1,    17,   267,
  581.     19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
  582.     29,    -1,    31,    -1,    -1,    -1,    35,    36,    37,    38,
  583.     -1,    -1,    -1,    -1,    -1,    44,    45,    -1,    47,     1,
  584.     49,     3,     4,    52,    53,     7,     8,    -1,    57,    58,
  585.     59,    -1,    -1,    -1,    -1,    17,    -1,    19,    20,    21,
  586.     22,    23,    24,    25,    26,    27,    28,    29,    -1,    31,
  587.     -1,    -1,    -1,    35,    36,    37,    38,    -1,    -1,    -1,
  588.     -1,    -1,    44,    45,    -1,    47,     1,    49,     3,     4,
  589.     52,    53,     7,     8,    -1,    57,    58,    59,    -1,    -1,
  590.     -1,    -1,    17,    -1,    19,    20,    21,    22,    23,    24,
  591.     25,    26,    27,    28,    29,    -1,    31,    -1,    -1,    -1,
  592.     35,    36,    37,    38,    -1,    -1,    -1,    -1,    -1,    44,
  593.     45,    -1,    47,    -1,    49,    -1,    -1,    52,    53,    -1,
  594.     -1,    -1,    57,     1,    59,     3,     4,    -1,    -1,     7,
  595.      8,    -1,    10,    -1,    -1,    13,    -1,    -1,    -1,    -1,
  596.     -1,    -1,    -1,    -1,    -1,     4,    -1,    -1,     7,     8,
  597.      9,    -1,    -1,    31,    -1,    -1,    -1,    35,    36,    37,
  598.     38,    -1,    -1,    -1,    42,    43,    44,    45,    -1,    47,
  599.     -1,    49,    -1,    -1,    52,    53,    35,    36,     3,     4,
  600.     -1,    59,     7,     8,     9,    44,    45,    12,    47,    -1,
  601.     49,    -1,    -1,    52,    53,    -1,    -1,    -1,    -1,    -1,
  602.     -1,    -1,    -1,    -1,    -1,    -1,    31,    32,    33,    34,
  603.     35,    36,    37,    38,    39,    -1,    41,    42,    43,    44,
  604.     45,    -1,    47,    -1,    49,     3,     4,    52,    53,     7,
  605.      8,    -1,    -1,    -1,    -1,    60,    -1,    -1,    -1,    17,
  606.     -1,    19,    20,    21,    22,    23,    24,    25,    26,    27,
  607.     28,    29,    -1,    31,    -1,    -1,    -1,    35,    36,    37,
  608.     38,    -1,    -1,    -1,    -1,    -1,    44,    45,    -1,    47,
  609.     -1,    49,    -1,    -1,    52,    53,    -1,    -1,    -1,    57,
  610.     -1,    59,     3,     4,    -1,    -1,     7,     8,     9,    -1,
  611.     -1,    12,    13,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  612.     -1,    -1,     4,    -1,    -1,     7,     8,    -1,    -1,    -1,
  613.     31,    32,    33,    34,    35,    36,    37,    38,    39,    -1,
  614.     41,    42,    43,    44,    45,    -1,    47,    -1,    49,    -1,
  615.     -1,    52,    53,    35,    36,     3,     4,    -1,    59,     7,
  616.      8,     9,    44,    45,    12,    47,    -1,    49,    -1,    -1,
  617.     52,    53,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  618.     -1,    -1,    -1,    31,    32,    33,    34,    35,    36,    37,
  619.     38,    39,    -1,    41,    42,    43,    44,    45,    -1,    47,
  620.      1,    49,     3,     4,    52,    53,     7,     8,    -1,    -1,
  621.     -1,    59,    -1,    -1,    15,    16,    -1,    -1,    -1,    -1,
  622.     -1,    -1,    -1,    -1,    -1,    -1,    -1,     3,     4,    30,
  623.     31,     7,     8,    -1,    35,    36,    37,    38,    -1,    -1,
  624.     -1,    -1,    -1,    44,    45,    -1,    47,    -1,    49,    -1,
  625.     -1,    52,    53,    -1,    -1,    31,    57,    -1,    -1,    35,
  626.     36,    37,    38,    -1,    -1,    -1,    -1,    -1,    44,    45,
  627.     -1,    47,     1,    49,     3,     4,    52,    53,     7,     8,
  628.     -1,    -1,    -1,    59,    -1,    -1,    -1,    -1,    -1,    -1,
  629.     -1,    -1,     1,    -1,     3,     4,    -1,    -1,     7,     8,
  630.     -1,    -1,    31,    -1,    -1,    -1,    35,    36,    37,    38,
  631.     -1,    -1,    -1,    -1,    -1,    44,    45,    -1,    47,    -1,
  632.     49,    -1,    31,    52,    53,    54,    35,    36,    37,    38,
  633.     -1,    -1,    -1,    -1,    -1,    44,    45,    -1,    47,     1,
  634.     49,     3,     4,    52,    53,     7,     8,    -1,    -1,    -1,
  635.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     1,    -1,
  636.      3,     4,    -1,    -1,     7,     8,    -1,    -1,    -1,    31,
  637.     -1,    -1,    -1,    35,    36,    37,    38,    -1,    -1,    -1,
  638.     -1,    -1,    44,    45,    -1,    47,    -1,    49,    31,    -1,
  639.     52,    53,    35,    36,    37,    38,    -1,    -1,    -1,    -1,
  640.     -1,    44,    45,    -1,    47,    -1,    49,     3,     4,    52,
  641.     53,     7,     8,     9,    -1,    -1,    12,    -1,    -1,    -1,
  642.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  643.     -1,    -1,    -1,    -1,    -1,    31,    32,    33,    34,    35,
  644.     36,    37,    38,    39,    -1,    41,    42,    43,    44,    45,
  645.     -1,    47,    -1,    49,    -1,    -1,    52,    53,    54,     3,
  646.      4,    -1,    -1,     7,     8,     9,    -1,    -1,    12,    -1,
  647.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  648.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    31,    32,    33,
  649.     34,    35,    36,    37,    38,    39,    40,    41,    42,    43,
  650.     44,    45,    -1,    47,    -1,    49,     3,     4,    52,    53,
  651.      7,     8,     9,    -1,    -1,    12,    -1,    -1,    -1,    -1,
  652.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  653.     -1,    -1,    -1,    -1,    31,    32,    33,    34,    35,    36,
  654.     37,    38,    39,    -1,    41,    42,    43,    44,    45,    -1,
  655.     47,    -1,    49,     3,     4,    52,    53,     7,     8,     9,
  656.     -1,    -1,    12,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  657.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  658.     -1,    31,    32,    33,    -1,    35,    36,    37,    38,    -1,
  659.     -1,    41,    42,    43,    44,    45,    -1,    47,    -1,    49,
  660.      3,     4,    52,    53,     7,     8,     9,    -1,    -1,    12,
  661.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  662.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    31,    32,
  663.     33,    34,    35,    36,    37,    38,    39,    40,    -1,    -1,
  664.     -1,    44,    45,    -1,    47,    -1,    49,     3,     4,    52,
  665.     53,     7,     8,     9,    -1,    -1,    12,    -1,    -1,    -1,
  666.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  667.     -1,    -1,    -1,    -1,    -1,    31,    32,    -1,    -1,    35,
  668.     36,    37,    38,    -1,    -1,    41,    42,    43,    44,    45,
  669.     -1,    47,    -1,    49,     3,     4,    52,    53,     7,     8,
  670.      9,    -1,    -1,    12,    -1,    -1,    -1,    -1,    -1,    -1,
  671.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  672.     -1,    -1,    31,    32,    33,    34,    35,    36,    37,    38,
  673.     39,    -1,    -1,    -1,    -1,    44,    45,    -1,    47,    -1,
  674.     49,     3,     4,    52,    53,     7,     8,     9,    -1,    -1,
  675.     12,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  676.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    31,
  677.     32,    33,    -1,    35,    36,    37,    38,    -1,    -1,    -1,
  678.     -1,    -1,    44,    45,    -1,    47,    -1,    49,     3,     4,
  679.     52,    53,     7,     8,     9,    -1,    -1,    12,    -1,    -1,
  680.     -1,    -1,    -1,    -1,    -1,    -1,    -1,     3,     4,    -1,
  681.     -1,     7,     8,    -1,    -1,    -1,    31,    32,    -1,    -1,
  682.     35,    36,    37,    38,    -1,    -1,    -1,    -1,    -1,    44,
  683.     45,    -1,    47,    -1,    49,    31,    -1,    52,    53,    35,
  684.     36,    37,    38,    -1,    -1,    -1,    -1,    -1,    44,    45,
  685.     -1,    47,    -1,    49,     3,     4,    52,    53,     7,     8,
  686.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  687.     -1,    -1,    -1,     3,     4,    -1,    -1,     7,     8,    -1,
  688.     -1,    -1,    31,    -1,    -1,    -1,    35,    36,    37,    38,
  689.     -1,    -1,    -1,    -1,    -1,    44,    45,    -1,    47,    -1,
  690.     49,    31,    -1,    52,    53,    35,    36,    37,    38,    -1,
  691.     -1,    -1,    -1,    -1,    44,    45,    -1,    47,    -1,    49,
  692.      3,     4,    52,    53,     7,     8,    -1,    -1,    -1,    -1,
  693.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     3,
  694.      4,    -1,    -1,     7,     8,    -1,    -1,    -1,    -1,    -1,
  695.     -1,    -1,    35,    36,    37,    38,    -1,    -1,    -1,    -1,
  696.     -1,    44,    45,    -1,    47,    -1,    49,    -1,    -1,    52,
  697.     53,    35,    36,    37,    38,    -1,    -1,    -1,    -1,     4,
  698.     44,    45,     7,     8,     9,    49,    -1,    -1,    52,    53,
  699.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  700.     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  701.     35,    36,    -1,    -1,    -1,    -1,    41,    42,    43,    44,
  702.     45,    -1,    47,    -1,    49,    -1,    -1,    52,    53
  703. };
  704. #define YYPURE 1
  705.  
  706. #line 2 "bison.simple"
  707.  
  708. /* Skeleton output parser for bison,
  709.    copyright (C) 1984 Bob Corbett and Richard Stallman
  710.  
  711.                NO WARRANTY
  712.  
  713.   BECAUSE THIS PROGRAM IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
  714. NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT
  715. WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC,
  716. RICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE THIS PROGRAM "AS IS"
  717. WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
  718. BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  719. FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY
  720. AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE
  721. DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
  722. CORRECTION.
  723.  
  724.  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M.
  725. STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., AND/OR ANY OTHER PARTY
  726. WHO MAY MODIFY AND REDISTRIBUTE THIS PROGRAM AS PERMITTED BELOW, BE
  727. LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR
  728. OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
  729. USE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
  730. DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR
  731. A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) THIS
  732. PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
  733. DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
  734.  
  735.         GENERAL PUBLIC LICENSE TO COPY
  736.  
  737.   1. You may copy and distribute verbatim copies of this source file
  738. as you receive it, in any medium, provided that you conspicuously and
  739. appropriately publish on each copy a valid copyright notice "Copyright
  740. (C) 1985 Free Software Foundation, Inc."; and include following the
  741. copyright notice a verbatim copy of the above disclaimer of warranty
  742. and of this License.  You may charge a distribution fee for the
  743. physical act of transferring a copy.
  744.  
  745.   2. You may modify your copy or copies of this source file or
  746. any portion of it, and copy and distribute such modifications under
  747. the terms of Paragraph 1 above, provided that you also do the following:
  748.  
  749.     a) cause the modified files to carry prominent notices stating
  750.     that you changed the files and the date of any change; and
  751.  
  752.     b) cause the whole of any work that you distribute or publish,
  753.     that in whole or in part contains or is a derivative of this
  754.     program or any part thereof, to be licensed at no charge to all
  755.     third parties on terms identical to those contained in this
  756.     License Agreement (except that you may choose to grant more extensive
  757.     warranty protection to some or all third parties, at your option).
  758.  
  759.     c) You may charge a distribution fee for the physical act of
  760.     transferring a copy, and you may at your option offer warranty
  761.     protection in exchange for a fee.
  762.  
  763. Mere aggregation of another unrelated program with this program (or its
  764. derivative) on a volume of a storage or distribution medium does not bring
  765. the other program under the scope of these terms.
  766.  
  767.   3. You may copy and distribute this program (or a portion or derivative
  768. of it, under Paragraph 2) in object code or executable form under the terms
  769. of Paragraphs 1 and 2 above provided that you also do one of the following:
  770.  
  771.     a) accompany it with the complete corresponding machine-readable
  772.     source code, which must be distributed under the terms of
  773.     Paragraphs 1 and 2 above; or,
  774.  
  775.     b) accompany it with a written offer, valid for at least three
  776.     years, to give any third party free (except for a nominal
  777.     shipping charge) a complete machine-readable copy of the
  778.     corresponding source code, to be distributed under the terms of
  779.     Paragraphs 1 and 2 above; or,
  780.  
  781.     c) accompany it with the information you received as to where the
  782.     corresponding source code may be obtained.  (This alternative is
  783.     allowed only for noncommercial distribution and only if you
  784.     received the program in object code or executable form alone.)
  785.  
  786. For an executable file, complete source code means all the source code for
  787. all modules it contains; but, as a special exception, it need not include
  788. source code for modules which are standard libraries that accompany the
  789. operating system on which the executable file runs.
  790.  
  791.   4. You may not copy, sublicense, distribute or transfer this program
  792. except as expressly provided under this License Agreement.  Any attempt
  793. otherwise to copy, sublicense, distribute or transfer this program is void and
  794. your rights to use the program under this License agreement shall be
  795. automatically terminated.  However, parties who have received computer
  796. software programs from you with this License Agreement will not have
  797. their licenses terminated so long as such parties remain in full compliance.
  798.  
  799.   5. If you wish to incorporate parts of this program into other free
  800. programs whose distribution conditions are different, write to the Free
  801. Software Foundation at 675 Mass Ave, Cambridge, MA 02139.  We have not yet
  802. worked out a simple rule that can be stated here, but we will often permit
  803. this.  We will be guided by the two goals of preserving the free status of
  804. all derivatives of our free software and of promoting the sharing and reuse of
  805. software.
  806.  
  807.  
  808. In other words, you are welcome to use, share and improve this program.
  809. You are forbidden to forbid anyone else to use, share and improve
  810. what you give them.   Help stamp out software-hoarding!  */
  811.  
  812. /* This is the parser code that is written into each bison parser
  813.   when the %semantic_parser declaration is not specified in the grammar.
  814.   It was written by Richard Stallman by simplifying the hairy parser
  815.   used when %semantic_parser is specified.  */
  816.  
  817. /* Note: there must be only one dollar sign in this file.
  818.    It is replaced by the list of actions, each action
  819.    as one case of the switch.  */
  820.  
  821. #define yyerrok        (yyerrstatus = 0)
  822. #define yyclearin    (yychar = YYEMPTY)
  823. #define YYEMPTY        -2
  824. #define YYEOF        0
  825. #define YYFAIL        goto yyerrlab;
  826.  
  827. #define YYTERROR    1
  828.  
  829. #ifndef YYIMPURE
  830. #define YYLEX        yylex()
  831. #endif
  832.  
  833. #ifndef YYPURE
  834. #define YYLEX        yylex(&yylval, &yylloc)
  835. #endif
  836.  
  837. /* If nonreentrant, generate the variables here */
  838.  
  839. #ifndef YYIMPURE
  840.  
  841. int    yychar;            /*  the lookahead symbol        */
  842. YYSTYPE    yylval;            /*  the semantic value of the        */
  843.                 /*  lookahead symbol            */
  844.  
  845. YYLTYPE yylloc;            /*  location data for the lookahead    */
  846.                 /*  symbol                */
  847.  
  848. #ifdef YYDEBUG
  849. int yydebug = 0;        /*  nonzero means print parse trace    */
  850. #endif
  851.  
  852. #endif  /* YYIMPURE */
  853.  
  854.  
  855. /*  YYMAXDEPTH indicates the initial size of the parser's stacks    */
  856.  
  857. #ifndef    YYMAXDEPTH
  858. #define YYMAXDEPTH 200
  859. #endif
  860.  
  861. /*  YYMAXLIMIT is the maximum size the stacks can grow to
  862.     (effective only if the built-in stack extension method is used).  */
  863.  
  864. #ifndef YYMAXLIMIT
  865. #define YYMAXLIMIT 10000
  866. #endif
  867.  
  868.  
  869. #line 87 "bison.simple"
  870. int
  871. yyparse()
  872. {
  873.   register int yystate;
  874.   register int yyn;
  875.   register short *yyssp;
  876.   register YYSTYPE *yyvsp;
  877.   YYLTYPE *yylsp;
  878.   int yyerrstatus;    /*  number of tokens to shift before error messages enabled */
  879.   int yychar1;        /*  lookahead token as an internal (translated) token number */
  880.  
  881.   short    yyssa[YYMAXDEPTH];    /*  the state stack            */
  882.   YYSTYPE yyvsa[YYMAXDEPTH];    /*  the semantic value stack        */
  883.   YYLTYPE yylsa[YYMAXDEPTH];    /*  the location stack            */
  884.  
  885.   short *yyss = yyssa;        /*  refer to the stacks thru separate pointers */
  886.   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
  887.   YYLTYPE *yyls = yylsa;
  888.  
  889.   int yymaxdepth = YYMAXDEPTH;
  890.  
  891. #ifndef YYPURE
  892.  
  893.   int yychar;
  894.   YYSTYPE yylval;
  895.   YYLTYPE yylloc;
  896.  
  897. #ifdef YYDEBUG
  898.   extern int yydebug;
  899. #endif
  900.  
  901. #endif
  902.  
  903.  
  904.   YYSTYPE yyval;        /*  the variable used to return        */
  905.                 /*  semantic values from the action    */
  906.                 /*  routines                */
  907.  
  908.   int yylen;
  909.  
  910. #ifdef YYDEBUG
  911.   if (yydebug)
  912.     fprintf(stderr, "Starting parse\n");
  913. #endif
  914.  
  915.   yystate = 0;
  916.   yyerrstatus = 0;
  917.   yychar = YYEMPTY;        /* Cause a token to be read.  */
  918.  
  919.   /* Initialize stack pointers.
  920.      Waste one element of value and location stack
  921.      so that they stay on the same level as the state stack.  */
  922.  
  923.   yyssp = yyss - 1;
  924.   yyvsp = yyvs;
  925.   yylsp = yyls;
  926.  
  927. /* Push a new state, which is found in  yystate  .  */
  928. /* In all cases, when you get here, the value and location stacks
  929.    have just been pushed. so pushing a state here evens the stacks.  */
  930. yynewstate:
  931.  
  932.   *++yyssp = yystate;
  933.  
  934.   if (yyssp >= yyss + yymaxdepth - 1)
  935.     {
  936.       /* Give user a chance to reallocate the stack */
  937.       /* Use copies of these so that the &'s don't force the real ones into memory. */
  938.       YYSTYPE *yyvs1 = yyvs;
  939.       YYLTYPE *yyls1 = yyls;
  940.       short *yyss1 = yyss;
  941.  
  942.       /* Get the current used size of the three stacks, in elements.  */
  943.       int size = yyssp - yyss + 1;
  944.  
  945. #ifdef yyoverflow
  946.       /* Each stack pointer address is followed by the size of
  947.      the data in use in that stack, in bytes.  */
  948.       yyoverflow("parser stack overflow",
  949.          &yyss1, size * sizeof (*yyssp),
  950.          &yyvs1, size * sizeof (*yyvsp),
  951.          &yyls1, size * sizeof (*yylsp),
  952.          &yymaxdepth);
  953.  
  954.       yyss = yyss1; yyvs = yyvs1; yyls = yyls1;
  955. #else /* no yyoverflow */
  956.       /* Extend the stack our own way.  */
  957.       if (yymaxdepth >= YYMAXLIMIT)
  958.     yyerror("parser stack overflow");
  959.       yymaxdepth *= 2;
  960.       if (yymaxdepth > YYMAXLIMIT)
  961.     yymaxdepth = YYMAXLIMIT;
  962.       yyss = (short *) alloca (yymaxdepth * sizeof (*yyssp));
  963.       bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
  964.       yyls = (YYLTYPE *) alloca (yymaxdepth * sizeof (*yylsp));
  965.       bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
  966.       yyvs = (YYSTYPE *) alloca (yymaxdepth * sizeof (*yyvsp));
  967.       bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
  968. #endif /* no yyoverflow */
  969.  
  970.       yyssp = yyss + size - 1;
  971.       yylsp = yyls + size - 1;
  972.       yyvsp = yyvs + size - 1;
  973.  
  974. #ifdef YYDEBUG
  975.       if (yydebug)
  976.     fprintf(stderr, "Stack size increased to %d\n", yymaxdepth);
  977. #endif
  978.  
  979.       if (yyssp >= yyss + yymaxdepth - 1)
  980.     YYERROR;
  981.     }
  982.  
  983. #ifdef YYDEBUG
  984.   if (yydebug)
  985.     fprintf(stderr, "Entering state %d\n", yystate);
  986. #endif
  987.  
  988. /* Do appropriate processing given the current state.  */
  989. /* Read a lookahead token if we need one and don't already have one.  */
  990. yyresume:
  991.  
  992.   /* First try to decide what to do without reference to lookahead token.  */
  993.  
  994.   yyn = yypact[yystate];
  995.   if (yyn == YYFLAG)
  996.     goto yydefault;
  997.  
  998.   /* Not known => get a lookahead token if don't already have one.  */
  999.  
  1000.   /* yychar is either YYEMPTY or YYEOF
  1001.      or a valid token in external form.  */
  1002.  
  1003.   if (yychar == YYEMPTY)
  1004.     {
  1005. #ifdef YYDEBUG
  1006.       if (yydebug)
  1007.     fprintf(stderr, "Reading a token: ");
  1008. #endif
  1009.       yychar = YYLEX;
  1010.     }
  1011.  
  1012.   /* Convert token to internal form (in yychar1) for indexing tables with */
  1013.  
  1014.   if (yychar <= 0)        /* This means end of input. */
  1015.     {
  1016.       yychar1 = 0;
  1017.       yychar = YYEOF;        /* Don't call YYLEX any more */
  1018.  
  1019. #ifdef YYDEBUG
  1020.       if (yydebug)
  1021.     fprintf(stderr, "Now at end of input.\n");
  1022. #endif
  1023.     }
  1024.   else
  1025.     {
  1026.       yychar1 = YYTRANSLATE(yychar);
  1027.  
  1028. #ifdef YYDEBUG
  1029.       if (yydebug)
  1030.     fprintf(stderr, "Next token is %d (%s)\n", yychar, yytname[yychar1]);
  1031. #endif
  1032.     }
  1033.  
  1034.   yyn += yychar1;
  1035.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  1036.     goto yydefault;
  1037.  
  1038.   yyn = yytable[yyn];
  1039.  
  1040.   /* yyn is what to do for this token type in this state.
  1041.      Negative => reduce, -yyn is rule number.
  1042.      Positive => shift, yyn is new state.
  1043.        New state is final state => don't bother to shift,
  1044.        just return success.
  1045.      0, or most negative number => error.  */
  1046.  
  1047.   if (yyn < 0)
  1048.     {
  1049.       if (yyn == YYFLAG)
  1050.     goto yyerrlab;
  1051.       yyn = -yyn;
  1052.       goto yyreduce;
  1053.     }
  1054.   else if (yyn == 0)
  1055.     goto yyerrlab;
  1056.  
  1057.   if (yyn == YYFINAL)
  1058.     YYACCEPT;
  1059.  
  1060.   /* Shift the lookahead token.  */
  1061.  
  1062. #ifdef YYDEBUG
  1063.   if (yydebug)
  1064.     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  1065. #endif
  1066.  
  1067.   /* Discard the token being shifted unless it is eof.  */
  1068.   if (yychar != YYEOF)
  1069.     yychar = YYEMPTY;
  1070.  
  1071.   *++yyvsp = yylval;
  1072.   *++yylsp = yylloc;
  1073.  
  1074.   /* count tokens shifted since error; after three, turn off error status.  */
  1075.   if (yyerrstatus) yyerrstatus--;
  1076.  
  1077.   yystate = yyn;
  1078.   goto yynewstate;
  1079.  
  1080. /* Do the default action for the current state.  */
  1081. yydefault:
  1082.  
  1083.   yyn = yydefact[yystate];
  1084.   if (yyn == 0)
  1085.     goto yyerrlab;
  1086.  
  1087. /* Do a reduction.  yyn is the number of a rule to reduce with.  */
  1088. yyreduce:
  1089.   yylen = yyr2[yyn];
  1090.   yyval = yyvsp[1-yylen]; /* implement default value of the action */
  1091.  
  1092. #ifdef YYDEBUG
  1093.   if (yydebug)
  1094.     {
  1095.       if (yylen == 1)
  1096.     fprintf (stderr, "Reducing 1 value via line %d, ",
  1097.          yyrline[yyn]);
  1098.       else
  1099.     fprintf (stderr, "Reducing %d values via line %d, ",
  1100.          yylen, yyrline[yyn]);
  1101.     }
  1102. #endif
  1103.  
  1104.  
  1105.   switch (yyn) {
  1106.  
  1107. case 1:
  1108. #line 146 "awk.y"
  1109. { expression_value = yyvsp[-1].nodeval; ;
  1110.     break;}
  1111. case 2:
  1112. #line 151 "awk.y"
  1113.             if (yyvsp[0].nodeval != NULL)
  1114.                 yyval.nodeval = yyvsp[0].nodeval;
  1115.             else
  1116.                 yyval.nodeval = NULL;
  1117.             yyerrok;
  1118.         ;
  1119.     break;}
  1120. case 3:
  1121. #line 160 "awk.y"
  1122. {
  1123.             if (yyvsp[0].nodeval == NULL)
  1124.                 yyval.nodeval = yyvsp[-1].nodeval;
  1125.             else if (yyvsp[-1].nodeval == NULL)
  1126.                 yyval.nodeval = yyvsp[0].nodeval;
  1127.             else {
  1128.                 if (yyvsp[-1].nodeval->type != Node_rule_list)
  1129.                     yyvsp[-1].nodeval = node(yyvsp[-1].nodeval, Node_rule_list,
  1130.                         (NODE*)NULL);
  1131.                 yyval.nodeval = append_right (yyvsp[-1].nodeval,
  1132.                    node(yyvsp[0].nodeval, Node_rule_list,(NODE *) NULL));
  1133.             }
  1134.             yyerrok;
  1135.         ;
  1136.     break;}
  1137. case 4:
  1138. #line 174 "awk.y"
  1139. { yyval.nodeval = NULL; ;
  1140.     break;}
  1141. case 5:
  1142. #line 175 "awk.y"
  1143. { yyval.nodeval = NULL; ;
  1144.     break;}
  1145. case 6:
  1146. #line 179 "awk.y"
  1147. { io_allowed = 0; ;
  1148.     break;}
  1149. case 7:
  1150. #line 181 "awk.y"
  1151. {
  1152.         if (begin_block) {
  1153.             if (begin_block->type != Node_rule_list)
  1154.                 begin_block = node(begin_block, Node_rule_list,
  1155.                     (NODE *)NULL);
  1156.             append_right (begin_block, node(
  1157.                 node((NODE *)NULL, Node_rule_node, yyvsp[0].nodeval),
  1158.                 Node_rule_list, (NODE *)NULL) );
  1159.         } else
  1160.             begin_block = node((NODE *)NULL, Node_rule_node, yyvsp[0].nodeval);
  1161.         yyval.nodeval = NULL;
  1162.         io_allowed = 1;
  1163.         yyerrok;
  1164.         SpinMacCursor(-1);
  1165.       ;
  1166.     break;}
  1167. case 8:
  1168. #line 196 "awk.y"
  1169. { io_allowed = 0; ;
  1170.     break;}
  1171. case 9:
  1172. #line 198 "awk.y"
  1173. {
  1174.         if (end_block) {
  1175.             if (end_block->type != Node_rule_list)
  1176.                 end_block = node(end_block, Node_rule_list,
  1177.                     (NODE *)NULL);
  1178.             append_right (end_block, node(
  1179.                 node((NODE *)NULL, Node_rule_node, yyvsp[0].nodeval),
  1180.                 Node_rule_list, (NODE *)NULL));
  1181.         } else
  1182.             end_block = node((NODE *)NULL, Node_rule_node, yyvsp[0].nodeval);
  1183.         yyval.nodeval = NULL;
  1184.         io_allowed = 1;
  1185.         yyerrok;
  1186.       ;
  1187.     break;}
  1188. case 10:
  1189. #line 213 "awk.y"
  1190. {
  1191.         msg ("error near line %d: BEGIN blocks must have an action part", lineno);
  1192.         errcount++;
  1193.         yyerrok;
  1194.       ;
  1195.     break;}
  1196. case 11:
  1197. #line 219 "awk.y"
  1198. {
  1199.         msg ("error near line %d: END blocks must have an action part", lineno);
  1200.         errcount++;
  1201.         yyerrok;
  1202.       ;
  1203.     break;}
  1204. case 12:
  1205. #line 225 "awk.y"
  1206. { yyval.nodeval = node (yyvsp[-1].nodeval, Node_rule_node, yyvsp[0].nodeval); yyerrok; ;
  1207.     break;}
  1208. case 13:
  1209. #line 227 "awk.y"
  1210. { yyval.nodeval = node ((NODE *)NULL, Node_rule_node, yyvsp[0].nodeval); yyerrok; ;
  1211.     break;}
  1212. case 14:
  1213. #line 229 "awk.y"
  1214. { if(yyvsp[-1].nodeval) yyval.nodeval = node (yyvsp[-1].nodeval, Node_rule_node, (NODE *)NULL); yyerrok; ;
  1215.     break;}
  1216. case 15:
  1217. #line 231 "awk.y"
  1218. {
  1219.             func_install(yyvsp[-1].nodeval, yyvsp[0].nodeval);
  1220.             yyval.nodeval = NULL;
  1221.             yyerrok;
  1222.         ;
  1223.     break;}
  1224. case 16:
  1225. #line 240 "awk.y"
  1226. { yyval.sval = yyvsp[0].sval; ;
  1227.     break;}
  1228. case 17:
  1229. #line 242 "awk.y"
  1230. { yyval.sval = yyvsp[0].sval; ;
  1231.     break;}
  1232. case 18:
  1233. #line 247 "awk.y"
  1234. {
  1235.             param_counter = 0;
  1236.         ;
  1237.     break;}
  1238. case 19:
  1239. #line 251 "awk.y"
  1240. {
  1241.             yyval.nodeval = append_right(make_param(yyvsp[-4].sval), yyvsp[-2].nodeval);
  1242.             can_return = 1;
  1243.         ;
  1244.     break;}
  1245. case 20:
  1246. #line 259 "awk.y"
  1247. {
  1248.         yyval.nodeval = yyvsp[-1].nodeval;
  1249.         can_return = 0;
  1250.       ;
  1251.     break;}
  1252. case 21:
  1253. #line 268 "awk.y"
  1254. { yyval.nodeval = yyvsp[0].nodeval; ;
  1255.     break;}
  1256. case 22:
  1257. #line 270 "awk.y"
  1258. { yyval.nodeval = mkrangenode ( node(yyvsp[-2].nodeval, Node_cond_pair, yyvsp[0].nodeval) ); ;
  1259.     break;}
  1260. case 23:
  1261. #line 279 "awk.y"
  1262. { ++want_regexp; ;
  1263.     break;}
  1264. case 24:
  1265. #line 281 "awk.y"
  1266. {
  1267.           want_regexp = 0;
  1268.           yyval.nodeval = node((NODE *)NULL,Node_regex,(NODE *)mk_re_parse(yyvsp[-1].sval, 0));
  1269.           yyval.nodeval -> re_case = 0;
  1270.           emalloc (yyval.nodeval -> re_text, char *, strlen(yyvsp[-1].sval)+1, "regexp");
  1271.           strcpy (yyval.nodeval -> re_text, yyvsp[-1].sval);
  1272.         ;
  1273.     break;}
  1274. case 25:
  1275. #line 292 "awk.y"
  1276. {
  1277.             /* empty actions are different from missing actions */
  1278.             yyval.nodeval = node ((NODE *) NULL, Node_illegal, (NODE *) NULL);
  1279.         ;
  1280.     break;}
  1281. case 26:
  1282. #line 297 "awk.y"
  1283. { yyval.nodeval = yyvsp[-2].nodeval ; ;
  1284.     break;}
  1285. case 27:
  1286. #line 302 "awk.y"
  1287. { yyval.nodeval = yyvsp[0].nodeval; ;
  1288.     break;}
  1289. case 28:
  1290. #line 304 "awk.y"
  1291. {
  1292.             if (yyvsp[-1].nodeval == NULL || yyvsp[-1].nodeval->type != Node_statement_list)
  1293.                 yyvsp[-1].nodeval = node(yyvsp[-1].nodeval, Node_statement_list,(NODE *)NULL);
  1294.                 yyval.nodeval = append_right(yyvsp[-1].nodeval,
  1295.                 node( yyvsp[0].nodeval, Node_statement_list, (NODE *)NULL));
  1296.                 yyerrok;
  1297.         ;
  1298.     break;}
  1299. case 29:
  1300. #line 312 "awk.y"
  1301. { yyval.nodeval = NULL; ;
  1302.     break;}
  1303. case 30:
  1304. #line 314 "awk.y"
  1305. { yyval.nodeval = NULL; ;
  1306.     break;}
  1307. case 31:
  1308. #line 319 "awk.y"
  1309. { yyval.nodetypeval = Node_illegal; ;
  1310.     break;}
  1311. case 32:
  1312. #line 321 "awk.y"
  1313. { yyval.nodetypeval = Node_illegal; ;
  1314.     break;}
  1315. case 33:
  1316. #line 327 "awk.y"
  1317. { yyval.nodeval = NULL; ;
  1318.     break;}
  1319. case 34:
  1320. #line 329 "awk.y"
  1321. { yyval.nodeval = NULL; ;
  1322.     break;}
  1323. case 35:
  1324. #line 331 "awk.y"
  1325. { yyval.nodeval = yyvsp[-1].nodeval; ;
  1326.     break;}
  1327. case 36:
  1328. #line 333 "awk.y"
  1329. { yyval.nodeval = yyvsp[0].nodeval; ;
  1330.     break;}
  1331. case 37:
  1332. #line 335 "awk.y"
  1333. { yyval.nodeval = node (yyvsp[-3].nodeval, Node_K_while, yyvsp[0].nodeval); ;
  1334.     break;}
  1335. case 38:
  1336. #line 337 "awk.y"
  1337. { yyval.nodeval = node (yyvsp[-2].nodeval, Node_K_do, yyvsp[-5].nodeval); ;
  1338.     break;}
  1339. case 39:
  1340. #line 339 "awk.y"
  1341. {
  1342.         yyval.nodeval = node (yyvsp[0].nodeval, Node_K_arrayfor, make_for_loop(variable(yyvsp[-5].sval),
  1343.             (NODE *)NULL, variable(yyvsp[-3].sval)));
  1344.       ;
  1345.     break;}
  1346. case 40:
  1347. #line 344 "awk.y"
  1348. {
  1349.         yyval.nodeval = node(yyvsp[0].nodeval, Node_K_for, (NODE *)make_for_loop(yyvsp[-7].nodeval, yyvsp[-5].nodeval, yyvsp[-3].nodeval));
  1350.       ;
  1351.     break;}
  1352. case 41:
  1353. #line 348 "awk.y"
  1354. {
  1355.         yyval.nodeval = node (yyvsp[0].nodeval, Node_K_for,
  1356.             (NODE *)make_for_loop(yyvsp[-6].nodeval, (NODE *)NULL, yyvsp[-3].nodeval));
  1357.       ;
  1358.     break;}
  1359. case 42:
  1360. #line 354 "awk.y"
  1361. { yyval.nodeval = node ((NODE *)NULL, Node_K_break, (NODE *)NULL); ;
  1362.     break;}
  1363. case 43:
  1364. #line 357 "awk.y"
  1365. { yyval.nodeval = node ((NODE *)NULL, Node_K_continue, (NODE *)NULL); ;
  1366.     break;}
  1367. case 44:
  1368. #line 359 "awk.y"
  1369. { yyval.nodeval = node (yyvsp[-3].nodeval, yyvsp[-5].nodetypeval, yyvsp[-1].nodeval); ;
  1370.     break;}
  1371. case 45:
  1372. #line 361 "awk.y"
  1373. { yyval.nodeval = node (yyvsp[-2].nodeval, yyvsp[-3].nodetypeval, yyvsp[-1].nodeval); ;
  1374.     break;}
  1375. case 46:
  1376. #line 363 "awk.y"
  1377. { if (! io_allowed) yyerror("next used in BEGIN or END action"); ;
  1378.     break;}
  1379. case 47:
  1380. #line 365 "awk.y"
  1381. { yyval.nodeval = node ((NODE *)NULL, Node_K_next, (NODE *)NULL); ;
  1382.     break;}
  1383. case 48:
  1384. #line 367 "awk.y"
  1385. { yyval.nodeval = node (yyvsp[-1].nodeval, Node_K_exit, (NODE *)NULL); ;
  1386.     break;}
  1387. case 49:
  1388. #line 369 "awk.y"
  1389. { if (! can_return) yyerror("return used outside function context"); ;
  1390.     break;}
  1391. case 50:
  1392. #line 371 "awk.y"
  1393. { yyval.nodeval = node (yyvsp[-1].nodeval, Node_K_return, (NODE *)NULL); ;
  1394.     break;}
  1395. case 51:
  1396. #line 373 "awk.y"
  1397. { yyval.nodeval = node (variable(yyvsp[-4].sval), Node_K_delete, yyvsp[-2].nodeval); ;
  1398.     break;}
  1399. case 52:
  1400. #line 375 "awk.y"
  1401. { yyval.nodeval = yyvsp[-1].nodeval; ;
  1402.     break;}
  1403. case 53:
  1404. #line 380 "awk.y"
  1405. { yyval.nodetypeval = yyvsp[0].nodetypeval; ;
  1406.     break;}
  1407. case 54:
  1408. #line 382 "awk.y"
  1409. { yyval.nodetypeval = yyvsp[0].nodetypeval; ;
  1410.     break;}
  1411. case 55:
  1412. #line 387 "awk.y"
  1413. {
  1414.         yyval.nodeval = node(yyvsp[-3].nodeval, Node_K_if, 
  1415.             node(yyvsp[0].nodeval, Node_if_branches, (NODE *)NULL));
  1416.       ;
  1417.     break;}
  1418. case 56:
  1419. #line 393 "awk.y"
  1420. { yyval.nodeval = node (yyvsp[-6].nodeval, Node_K_if,
  1421.                 node (yyvsp[-3].nodeval, Node_if_branches, yyvsp[0].nodeval)); ;
  1422.     break;}
  1423. case 57:
  1424. #line 399 "awk.y"
  1425. { yyval.nodetypeval = NULL; ;
  1426.     break;}
  1427. case 58:
  1428. #line 401 "awk.y"
  1429. { yyval.nodetypeval = NULL; ;
  1430.     break;}
  1431. case 59:
  1432. #line 406 "awk.y"
  1433. { yyval.nodetypeval = NULL; ;
  1434.     break;}
  1435. case 60:
  1436. #line 408 "awk.y"
  1437. { yyval.nodetypeval = NULL; ;
  1438.     break;}
  1439. case 61:
  1440. #line 413 "awk.y"
  1441. { yyval.nodeval = NULL; ;
  1442.     break;}
  1443. case 62:
  1444. #line 415 "awk.y"
  1445. { yyval.nodeval = node (yyvsp[0].nodeval, Node_redirect_input, (NODE *)NULL); ;
  1446.     break;}
  1447. case 63:
  1448. #line 420 "awk.y"
  1449. { yyval.nodeval = NULL; ;
  1450.     break;}
  1451. case 64:
  1452. #line 422 "awk.y"
  1453. { yyval.nodeval = node (yyvsp[0].nodeval, Node_redirect_output, (NODE *)NULL); ;
  1454.     break;}
  1455. case 65:
  1456. #line 424 "awk.y"
  1457. { yyval.nodeval = node (yyvsp[0].nodeval, Node_redirect_append, (NODE *)NULL); ;
  1458.     break;}
  1459. case 66:
  1460. #line 426 "awk.y"
  1461. { yyval.nodeval = node (yyvsp[0].nodeval, Node_redirect_pipe, (NODE *)NULL); ;
  1462.     break;}
  1463. case 67:
  1464. #line 431 "awk.y"
  1465. { yyval.nodeval = NULL; ;
  1466.     break;}
  1467. case 68:
  1468. #line 433 "awk.y"
  1469. { yyval.nodeval = yyvsp[0].nodeval; ;
  1470.     break;}
  1471. case 69:
  1472. #line 438 "awk.y"
  1473. { yyval.nodeval = make_param(yyvsp[0].sval); ;
  1474.     break;}
  1475. case 70:
  1476. #line 440 "awk.y"
  1477. { yyval.nodeval = append_right(yyvsp[-2].nodeval, make_param(yyvsp[0].sval)); yyerrok; ;
  1478.     break;}
  1479. case 71:
  1480. #line 442 "awk.y"
  1481. { yyval.nodeval = NULL; ;
  1482.     break;}
  1483. case 72:
  1484. #line 444 "awk.y"
  1485. { yyval.nodeval = NULL; ;
  1486.     break;}
  1487. case 73:
  1488. #line 446 "awk.y"
  1489. { yyval.nodeval = NULL; ;
  1490.     break;}
  1491. case 74:
  1492. #line 452 "awk.y"
  1493. { yyval.nodeval = NULL; ;
  1494.     break;}
  1495. case 75:
  1496. #line 454 "awk.y"
  1497. { yyval.nodeval = yyvsp[0].nodeval; ;
  1498.     break;}
  1499. case 76:
  1500. #line 459 "awk.y"
  1501. { yyval.nodeval = NULL; ;
  1502.     break;}
  1503. case 77:
  1504. #line 461 "awk.y"
  1505. { yyval.nodeval = yyvsp[0].nodeval; ;
  1506.     break;}
  1507. case 78:
  1508. #line 466 "awk.y"
  1509. { yyval.nodeval = node (yyvsp[0].nodeval, Node_expression_list, (NODE *)NULL); ;
  1510.     break;}
  1511. case 79:
  1512. #line 468 "awk.y"
  1513. {
  1514.         yyval.nodeval = append_right(yyvsp[-2].nodeval,
  1515.             node( yyvsp[0].nodeval, Node_expression_list, (NODE *)NULL));
  1516.         yyerrok;
  1517.       ;
  1518.     break;}
  1519. case 80:
  1520. #line 474 "awk.y"
  1521. { yyval.nodeval = NULL; ;
  1522.     break;}
  1523. case 81:
  1524. #line 476 "awk.y"
  1525. { yyval.nodeval = NULL; ;
  1526.     break;}
  1527. case 82:
  1528. #line 478 "awk.y"
  1529. { yyval.nodeval = NULL; ;
  1530.     break;}
  1531. case 83:
  1532. #line 480 "awk.y"
  1533. { yyval.nodeval = NULL; ;
  1534.     break;}
  1535. case 84:
  1536. #line 485 "awk.y"
  1537. { yyval.nodeval = NULL; ;
  1538.     break;}
  1539. case 85:
  1540. #line 487 "awk.y"
  1541. { yyval.nodeval = yyvsp[0].nodeval; ;
  1542.     break;}
  1543. case 86:
  1544. #line 492 "awk.y"
  1545. { yyval.nodeval = node (yyvsp[0].nodeval, Node_expression_list, (NODE *)NULL); ;
  1546.     break;}
  1547. case 87:
  1548. #line 494 "awk.y"
  1549. {
  1550.             yyval.nodeval = append_right(yyvsp[-2].nodeval,
  1551.                 node( yyvsp[0].nodeval, Node_expression_list, (NODE *)NULL));
  1552.             yyerrok;
  1553.         ;
  1554.     break;}
  1555. case 88:
  1556. #line 500 "awk.y"
  1557. { yyval.nodeval = NULL; ;
  1558.     break;}
  1559. case 89:
  1560. #line 502 "awk.y"
  1561. { yyval.nodeval = NULL; ;
  1562.     break;}
  1563. case 90:
  1564. #line 504 "awk.y"
  1565. { yyval.nodeval = NULL; ;
  1566.     break;}
  1567. case 91:
  1568. #line 506 "awk.y"
  1569. { yyval.nodeval = NULL; ;
  1570.     break;}
  1571. case 92:
  1572. #line 511 "awk.y"
  1573. { want_assign = 0; ;
  1574.     break;}
  1575. case 93:
  1576. #line 513 "awk.y"
  1577. { yyval.nodeval = node (yyvsp[-3].nodeval, yyvsp[-2].nodetypeval, yyvsp[0].nodeval); ;
  1578.     break;}
  1579. case 94:
  1580. #line 515 "awk.y"
  1581. { yyval.nodeval = node (variable(yyvsp[0].sval), Node_in_array, yyvsp[-3].nodeval); ;
  1582.     break;}
  1583. case 95:
  1584. #line 517 "awk.y"
  1585. {
  1586.           yyval.nodeval = node (yyvsp[0].nodeval, Node_K_getline,
  1587.              node (yyvsp[-3].nodeval, Node_redirect_pipein, (NODE *)NULL));
  1588.         ;
  1589.     break;}
  1590. case 96:
  1591. #line 522 "awk.y"
  1592. {
  1593.           /* "too painful to do right" */
  1594.           /*
  1595.           if (! io_allowed && $3 == NULL)
  1596.             yyerror("non-redirected getline illegal inside BEGIN or END action");
  1597.           */
  1598.           yyval.nodeval = node (yyvsp[-1].nodeval, Node_K_getline, yyvsp[0].nodeval);
  1599.         ;
  1600.     break;}
  1601. case 97:
  1602. #line 531 "awk.y"
  1603. { yyval.nodeval = node (yyvsp[-2].nodeval, Node_and, yyvsp[0].nodeval); ;
  1604.     break;}
  1605. case 98:
  1606. #line 533 "awk.y"
  1607. { yyval.nodeval = node (yyvsp[-2].nodeval, Node_or, yyvsp[0].nodeval); ;
  1608.     break;}
  1609. case 99:
  1610. #line 535 "awk.y"
  1611. { yyval.nodeval = node (yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, yyvsp[0].nodeval); ;
  1612.     break;}
  1613. case 100:
  1614. #line 537 "awk.y"
  1615. { yyval.nodeval = yyvsp[0].nodeval; ;
  1616.     break;}
  1617. case 101:
  1618. #line 539 "awk.y"
  1619. { yyval.nodeval = node((NODE *) NULL, Node_nomatch, yyvsp[0].nodeval); ;
  1620.     break;}
  1621. case 102:
  1622. #line 541 "awk.y"
  1623. { yyval.nodeval = node (variable(yyvsp[0].sval), Node_in_array, yyvsp[-2].nodeval); ;
  1624.     break;}
  1625. case 103:
  1626. #line 543 "awk.y"
  1627. { yyval.nodeval = node (yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, yyvsp[0].nodeval); ;
  1628.     break;}
  1629. case 104:
  1630. #line 545 "awk.y"
  1631. { yyval.nodeval = node (yyvsp[-2].nodeval, Node_less, yyvsp[0].nodeval); ;
  1632.     break;}
  1633. case 105:
  1634. #line 547 "awk.y"
  1635. { yyval.nodeval = node (yyvsp[-2].nodeval, Node_greater, yyvsp[0].nodeval); ;
  1636.     break;}
  1637. case 106:
  1638. #line 549 "awk.y"
  1639. { yyval.nodeval = node(yyvsp[-4].nodeval, Node_cond_exp, node(yyvsp[-2].nodeval, Node_if_branches, yyvsp[0].nodeval));;
  1640.     break;}
  1641. case 107:
  1642. #line 551 "awk.y"
  1643. { yyval.nodeval = yyvsp[0].nodeval; ;
  1644.     break;}
  1645. case 108:
  1646. #line 553 "awk.y"
  1647. { yyval.nodeval = node (yyvsp[-1].nodeval, Node_concat, yyvsp[0].nodeval); ;
  1648.     break;}
  1649. case 109:
  1650. #line 558 "awk.y"
  1651. { want_assign = 0; ;
  1652.     break;}
  1653. case 110:
  1654. #line 560 "awk.y"
  1655. { yyval.nodeval = node (yyvsp[-3].nodeval, yyvsp[-2].nodetypeval, yyvsp[0].nodeval); ;
  1656.     break;}
  1657. case 111:
  1658. #line 562 "awk.y"
  1659. { yyval.nodeval = node (yyvsp[-2].nodeval, Node_and, yyvsp[0].nodeval); ;
  1660.     break;}
  1661. case 112:
  1662. #line 564 "awk.y"
  1663. { yyval.nodeval = node (yyvsp[-2].nodeval, Node_or, yyvsp[0].nodeval); ;
  1664.     break;}
  1665. case 113:
  1666. #line 566 "awk.y"
  1667. {
  1668.           /* "too painful to do right" */
  1669.           /*
  1670.           if (! io_allowed && $3 == NULL)
  1671.             yyerror("non-redirected getline illegal inside BEGIN or END action");
  1672.           */
  1673.           yyval.nodeval = node (yyvsp[-1].nodeval, Node_K_getline, yyvsp[0].nodeval);
  1674.         ;
  1675.     break;}
  1676. case 114:
  1677. #line 575 "awk.y"
  1678. { yyval.nodeval = yyvsp[0].nodeval; ;
  1679.     break;}
  1680. case 115:
  1681. #line 577 "awk.y"
  1682. { yyval.nodeval = node((NODE *) NULL, Node_nomatch, yyvsp[0].nodeval); ;
  1683.     break;}
  1684. case 116:
  1685. #line 579 "awk.y"
  1686. { yyval.nodeval = node (yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, yyvsp[0].nodeval); ;
  1687.     break;}
  1688. case 117:
  1689. #line 581 "awk.y"
  1690. { yyval.nodeval = node (variable(yyvsp[0].sval), Node_in_array, yyvsp[-2].nodeval); ;
  1691.     break;}
  1692. case 118:
  1693. #line 583 "awk.y"
  1694. { yyval.nodeval = node (yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, yyvsp[0].nodeval); ;
  1695.     break;}
  1696. case 119:
  1697. #line 585 "awk.y"
  1698. { yyval.nodeval = node(yyvsp[-4].nodeval, Node_cond_exp, node(yyvsp[-2].nodeval, Node_if_branches, yyvsp[0].nodeval));;
  1699.     break;}
  1700. case 120:
  1701. #line 587 "awk.y"
  1702. { yyval.nodeval = yyvsp[0].nodeval; ;
  1703.     break;}
  1704. case 121:
  1705. #line 589 "awk.y"
  1706. { yyval.nodeval = node (yyvsp[-1].nodeval, Node_concat, yyvsp[0].nodeval); ;
  1707.     break;}
  1708. case 122:
  1709. #line 594 "awk.y"
  1710. { yyval.nodeval = node (yyvsp[0].nodeval, Node_not,(NODE *) NULL); ;
  1711.     break;}
  1712. case 123:
  1713. #line 596 "awk.y"
  1714. { yyval.nodeval = yyvsp[-1].nodeval; ;
  1715.     break;}
  1716. case 124:
  1717. #line 598 "awk.y"
  1718. { yyval.nodeval = snode (yyvsp[-1].nodeval, Node_builtin, yyvsp[-3].ptrval); ;
  1719.     break;}
  1720. case 125:
  1721. #line 600 "awk.y"
  1722. { yyval.nodeval = snode (yyvsp[-1].nodeval, Node_builtin, yyvsp[-3].ptrval); ;
  1723.     break;}
  1724. case 126:
  1725. #line 602 "awk.y"
  1726. { yyval.nodeval = snode ((NODE *)NULL, Node_builtin, yyvsp[0].ptrval); ;
  1727.     break;}
  1728. case 127:
  1729. #line 604 "awk.y"
  1730. {
  1731.         yyval.nodeval = node (yyvsp[-1].nodeval, Node_func_call, make_string(yyvsp[-3].sval, strlen(yyvsp[-3].sval)));
  1732.       ;
  1733.     break;}
  1734. case 128:
  1735. #line 608 "awk.y"
  1736. { yyval.nodeval = node (yyvsp[0].nodeval, Node_preincrement, (NODE *)NULL); ;
  1737.     break;}
  1738. case 129:
  1739. #line 610 "awk.y"
  1740. { yyval.nodeval = node (yyvsp[0].nodeval, Node_predecrement, (NODE *)NULL); ;
  1741.     break;}
  1742. case 130:
  1743. #line 612 "awk.y"
  1744. { yyval.nodeval = node (yyvsp[-1].nodeval, Node_postincrement, (NODE *)NULL); ;
  1745.     break;}
  1746. case 131:
  1747. #line 614 "awk.y"
  1748. { yyval.nodeval = node (yyvsp[-1].nodeval, Node_postdecrement, (NODE *)NULL); ;
  1749.     break;}
  1750. case 132:
  1751. #line 616 "awk.y"
  1752. { yyval.nodeval = yyvsp[0].nodeval; ;
  1753.     break;}
  1754. case 133:
  1755. #line 618 "awk.y"
  1756. { yyval.nodeval = yyvsp[0].nodeval; ;
  1757.     break;}
  1758. case 134:
  1759. #line 620 "awk.y"
  1760. { yyval.nodeval = yyvsp[0].nodeval; ;
  1761.     break;}
  1762. case 135:
  1763. #line 624 "awk.y"
  1764. { yyval.nodeval = node (yyvsp[-2].nodeval, Node_exp, yyvsp[0].nodeval); ;
  1765.     break;}
  1766. case 136:
  1767. #line 626 "awk.y"
  1768. { yyval.nodeval = node (yyvsp[-2].nodeval, Node_times, yyvsp[0].nodeval); ;
  1769.     break;}
  1770. case 137:
  1771. #line 628 "awk.y"
  1772. { yyval.nodeval = node (yyvsp[-2].nodeval, Node_quotient, yyvsp[0].nodeval); ;
  1773.     break;}
  1774. case 138:
  1775. #line 630 "awk.y"
  1776. { yyval.nodeval = node (yyvsp[-2].nodeval, Node_mod, yyvsp[0].nodeval); ;
  1777.     break;}
  1778. case 139:
  1779. #line 632 "awk.y"
  1780. { yyval.nodeval = node (yyvsp[-2].nodeval, Node_plus, yyvsp[0].nodeval); ;
  1781.     break;}
  1782. case 140:
  1783. #line 634 "awk.y"
  1784. { yyval.nodeval = node (yyvsp[-2].nodeval, Node_minus, yyvsp[0].nodeval); ;
  1785.     break;}
  1786. case 141:
  1787. #line 636 "awk.y"
  1788. { yyval.nodeval = node (yyvsp[0].nodeval, Node_unary_minus, (NODE *)NULL); ;
  1789.     break;}
  1790. case 142:
  1791. #line 638 "awk.y"
  1792. { yyval.nodeval = yyvsp[0].nodeval; ;
  1793.     break;}
  1794. case 143:
  1795. #line 643 "awk.y"
  1796. { yyval.nodeval = NULL; ;
  1797.     break;}
  1798. case 144:
  1799. #line 645 "awk.y"
  1800. { yyval.nodeval = yyvsp[0].nodeval; ;
  1801.     break;}
  1802. case 145:
  1803. #line 650 "awk.y"
  1804. { want_assign = 1; yyval.nodeval = variable (yyvsp[0].sval); ;
  1805.     break;}
  1806. case 146:
  1807. #line 652 "awk.y"
  1808. { want_assign = 1; yyval.nodeval = node (variable(yyvsp[-3].sval), Node_subscript, yyvsp[-1].nodeval); ;
  1809.     break;}
  1810. case 147:
  1811. #line 654 "awk.y"
  1812. { want_assign = 1; yyval.nodeval = node (yyvsp[0].nodeval, Node_field_spec, (NODE *)NULL); ;
  1813.     break;}
  1814. case 149:
  1815. #line 662 "awk.y"
  1816. { yyerrok; ;
  1817.     break;}
  1818. case 150:
  1819. #line 666 "awk.y"
  1820. { yyval.nodetypeval = Node_illegal; yyerrok; ;
  1821.     break;}
  1822. case 153:
  1823. #line 675 "awk.y"
  1824. { yyerrok; ;
  1825.     break;}
  1826. case 154:
  1827. #line 678 "awk.y"
  1828. { yyval.nodetypeval = Node_illegal; yyerrok; ;
  1829.     break;}
  1830. }
  1831.    /* the action file gets copied in in place of this dollarsign */
  1832. #line 303 "bison.simple"
  1833.  
  1834.   yyvsp -= yylen;
  1835.   yylsp -= yylen;
  1836.   yyssp -= yylen;
  1837.  
  1838. #ifdef YYDEBUG
  1839.   if (yydebug)
  1840.     {
  1841.       short *ssp1 = yyss - 1;
  1842.       fprintf (stderr, "state stack now", yyssp-yyss);
  1843.       while (ssp1 != yyssp)
  1844.     fprintf (stderr, " %d", *++ssp1);
  1845.       fprintf (stderr, "\n");
  1846.     }
  1847. #endif
  1848.  
  1849.   *++yyvsp = yyval;
  1850.  
  1851.   yylsp++;
  1852.   if (yylen == 0)
  1853.     {
  1854.       yylsp->first_line = yylloc.first_line;
  1855.       yylsp->first_column = yylloc.first_column;
  1856.       yylsp->last_line = (yylsp-1)->last_line;
  1857.       yylsp->last_column = (yylsp-1)->last_column;
  1858.       yylsp->text = 0;
  1859.     }
  1860.   else
  1861.     {
  1862.       yylsp->last_line = (yylsp+yylen-1)->last_line;
  1863.       yylsp->last_column = (yylsp+yylen-1)->last_column;
  1864.     }
  1865.  
  1866.   /* Now "shift" the result of the reduction.
  1867.      Determine what state that goes to,
  1868.      based on the state we popped back to
  1869.      and the rule number reduced by.  */
  1870.  
  1871.   yyn = yyr1[yyn];
  1872.  
  1873.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  1874.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1875.     yystate = yytable[yystate];
  1876.   else
  1877.     yystate = yydefgoto[yyn - YYNTBASE];
  1878.  
  1879.   goto yynewstate;
  1880.  
  1881. yyerrlab:   /* here on detecting error */
  1882.  
  1883.   if (! yyerrstatus)
  1884.     /* If not already recovering from an error, report this error.  */
  1885.     {
  1886.       yyerror("parse error");
  1887.     }
  1888.  
  1889.   if (yyerrstatus == 3)
  1890.     {
  1891.       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
  1892.  
  1893.       /* return failure if at end of input */
  1894.       if (yychar == YYEOF)
  1895.     YYERROR;
  1896.  
  1897. #ifdef YYDEBUG
  1898.       if (yydebug)
  1899.     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
  1900. #endif
  1901.  
  1902.       yychar = YYEMPTY;
  1903.     }
  1904.  
  1905.   /* Else will try to reuse lookahead token
  1906.      after shifting the error token.  */
  1907.  
  1908.   yyerrstatus = 3;        /* Each real token shifted decrements this */
  1909.  
  1910.   goto yyerrhandle;
  1911.  
  1912. yyerrdefault:  /* current state does not do anything special for the error token. */
  1913.  
  1914. #if 0
  1915.   /* This is wrong; only states that explicitly want error tokens
  1916.      should shift them.  */
  1917.   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  1918.   if (yyn) goto yydefault;
  1919. #endif
  1920.  
  1921. yyerrpop:   /* pop the current state because it cannot handle the error token */
  1922.  
  1923.   if (yyssp == yyss) YYERROR;
  1924.   yyvsp--;
  1925.   yylsp--;
  1926.   yystate = *--yyssp;
  1927.  
  1928. #ifdef YYDEBUG
  1929.   if (yydebug)
  1930.     {
  1931.       short *ssp1 = yyss - 1;
  1932.       fprintf (stderr, "Error: state stack now", yyssp-yyss);
  1933.       while (ssp1 != yyssp)
  1934.     fprintf (stderr, " %d", *++ssp1);
  1935.       fprintf (stderr, "\n");
  1936.     }
  1937. #endif
  1938.  
  1939. yyerrhandle:
  1940.  
  1941.   yyn = yypact[yystate];
  1942.   if (yyn == YYFLAG)
  1943.     goto yyerrdefault;
  1944.  
  1945.   yyn += YYTERROR;
  1946.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  1947.     goto yyerrdefault;
  1948.  
  1949.   yyn = yytable[yyn];
  1950.   if (yyn < 0)
  1951.     {
  1952.       if (yyn == YYFLAG)
  1953.     goto yyerrpop;
  1954.       yyn = -yyn;
  1955.       goto yyreduce;
  1956.     }
  1957.   else if (yyn == 0)
  1958.     goto yyerrpop;
  1959.  
  1960.   if (yyn == YYFINAL)
  1961.     YYACCEPT;
  1962.  
  1963. #ifdef YYDEBUG
  1964.   if (yydebug)
  1965.     fprintf(stderr, "Shifting error token, ");
  1966. #endif
  1967.  
  1968.   *++yyvsp = yylval;
  1969.   *++yylsp = yylloc;
  1970.  
  1971.   yystate = yyn;
  1972.   goto yynewstate;
  1973. }
  1974. #line 681 "awk.y"
  1975.  
  1976.  
  1977. struct token {
  1978.     char *operator;        /* text to match */
  1979.     NODETYPE value;        /* node type */
  1980.     int class;        /* lexical class */
  1981.     short nostrict;        /* ignore if in strict compatibility mode */
  1982.     NODE *(*ptr) ();    /* function that implements this keyword */
  1983. };
  1984.  
  1985. extern NODE
  1986.     *do_exp(),    *do_getline(),    *do_index(),    *do_length(),
  1987.     *do_sqrt(),    *do_log(),    *do_sprintf(),    *do_substr(),
  1988.     *do_split(),    *do_system(),    *do_int(),    *do_close(),
  1989.     *do_atan2(),    *do_sin(),    *do_cos(),    *do_rand(),
  1990.     *do_srand(),    *do_match(),    *do_tolower(),    *do_toupper(),
  1991.     *do_sub(),    *do_gsub();
  1992.  
  1993. /* Special functions for debugging */
  1994. #ifdef DEBUG
  1995. NODE *do_prvars(), *do_bp();
  1996. #endif
  1997.  
  1998. /* Tokentab is sorted ascii ascending order, so it can be binary searched. */
  1999.  
  2000. static struct token tokentab[] = {
  2001.     { "BEGIN",    Node_illegal,        LEX_BEGIN,    0,    0 },
  2002.     { "END",    Node_illegal,        LEX_END,    0,    0 },
  2003.     { "atan2",    Node_builtin,        LEX_BUILTIN,    0,    do_atan2 },
  2004. #ifdef DEBUG
  2005.     { "bp",        Node_builtin,        LEX_BUILTIN,    0,    do_bp },
  2006. #endif
  2007.     { "break",    Node_K_break,        LEX_BREAK,    0,    0 },
  2008.     { "close",    Node_builtin,        LEX_BUILTIN,    0,    do_close },
  2009.     { "continue",    Node_K_continue,    LEX_CONTINUE,    0,    0 },
  2010.     { "cos",    Node_builtin,        LEX_BUILTIN,    0,    do_cos },
  2011.     { "delete",    Node_K_delete,        LEX_DELETE,    0,    0 },
  2012.     { "do",        Node_K_do,        LEX_DO,        0,    0 },
  2013.     { "else",    Node_illegal,        LEX_ELSE,    0,    0 },
  2014.     { "exit",    Node_K_exit,        LEX_EXIT,    0,    0 },
  2015.     { "exp",    Node_builtin,        LEX_BUILTIN,    0,    do_exp },
  2016.     { "for",    Node_K_for,        LEX_FOR,    0,    0 },
  2017.     { "func",    Node_K_function,    LEX_FUNCTION,    0,    0 },
  2018.     { "function",    Node_K_function,    LEX_FUNCTION,    0,    0 },
  2019.     { "getline",    Node_K_getline,        LEX_GETLINE,    0,    0 },
  2020.     { "gsub",    Node_builtin,        LEX_BUILTIN,    0,    do_gsub },
  2021.     { "if",        Node_K_if,        LEX_IF,        0,    0 },
  2022.     { "in",        Node_illegal,        LEX_IN,        0,    0 },
  2023.     { "index",    Node_builtin,        LEX_BUILTIN,    0,    do_index },
  2024.     { "int",    Node_builtin,        LEX_BUILTIN,    0,    do_int },
  2025.     { "length",    Node_builtin,        LEX_LENGTH,    0,    do_length },
  2026.     { "log",    Node_builtin,        LEX_BUILTIN,    0,    do_log },
  2027.     { "match",    Node_builtin,        LEX_BUILTIN,    0,    do_match },
  2028.     { "next",    Node_K_next,        LEX_NEXT,    0,    0 },
  2029.     { "print",    Node_K_print,        LEX_PRINT,    0,    0 },
  2030.     { "printf",    Node_K_printf,        LEX_PRINTF,    0,    0 },
  2031. #ifdef DEBUG
  2032.     { "prvars",    Node_builtin,        LEX_BUILTIN,    0,    do_prvars },
  2033. #endif
  2034.     { "rand",    Node_builtin,        LEX_BUILTIN,    0,    do_rand },
  2035.     { "return",    Node_K_return,        LEX_RETURN,    0,    0 },
  2036.     { "sin",    Node_builtin,        LEX_BUILTIN,    0,    do_sin },
  2037.     { "split",    Node_builtin,        LEX_BUILTIN,    0,    do_split },
  2038.     { "sprintf",    Node_builtin,        LEX_BUILTIN,    0,    do_sprintf },
  2039.     { "sqrt",    Node_builtin,        LEX_BUILTIN,    0,    do_sqrt },
  2040.     { "srand",    Node_builtin,        LEX_BUILTIN,    0,    do_srand },
  2041.     { "sub",    Node_builtin,        LEX_BUILTIN,    0,    do_sub },
  2042.     { "substr",    Node_builtin,        LEX_BUILTIN,    0,    do_substr },
  2043.     { "system",    Node_builtin,        LEX_BUILTIN,    0,    do_system },
  2044.     { "tolower",    Node_builtin,        LEX_BUILTIN,    0,    do_tolower },
  2045.     { "toupper",    Node_builtin,        LEX_BUILTIN,    0,    do_toupper },
  2046.     { "while",    Node_K_while,        LEX_WHILE,    0,    0 },
  2047. };
  2048.  
  2049. static char *token_start;
  2050.  
  2051. /* VARARGS0 */
  2052. static void
  2053. #ifndef macintosh
  2054. yyerror(va_alist)
  2055. va_dcl
  2056. {
  2057.     char *mesg;
  2058. #else
  2059. yyerror(char *mesg, ...)
  2060. {
  2061. #endif
  2062.     va_list args;
  2063.     register char *ptr, *beg;
  2064.     char *scan;
  2065. #ifdef macintosh
  2066.     extern char **sourcefile;
  2067.     extern int tempsource, numfiles;
  2068. #endif
  2069.  
  2070.     errcount++;
  2071. #ifndef macintosh
  2072.     va_start(args);
  2073.     mesg = va_arg(args, char *);
  2074.     va_end(args);
  2075. #else
  2076.     va_start(args, mesg);
  2077.     va_end(args);
  2078. #endif
  2079.     /* Find the current line in the input file */
  2080.     if (! lexptr) {
  2081.         beg = "(END OF FILE)";
  2082.         ptr = beg + 13;
  2083.     } else {
  2084.         if (*lexptr == '\n' && lexptr != lexptr_begin)
  2085.             --lexptr;
  2086.         for (beg = lexptr; beg != lexptr_begin && *beg != '\n'; --beg)
  2087.             ;
  2088.         /* NL isn't guaranteed */
  2089.         for (ptr = lexptr; *ptr && *ptr != '\n'; ptr++)
  2090.             ;
  2091.         if (beg != lexptr_begin)
  2092.             beg++;
  2093.     }
  2094. #ifdef macintosh
  2095.     msg("# %.*s", ptr - beg, beg);
  2096.     putc('#', stderr);
  2097.     putc(' ', stderr);
  2098.     scan = beg;
  2099.     while (scan < token_start)
  2100.         if (*scan++ == '\t')
  2101.             putc('\t', stderr);
  2102.         else
  2103.             putc(' ', stderr);
  2104.     putc('^', stderr);
  2105.     putc(' ', stderr);
  2106.     vfprintf(stderr, mesg, args);
  2107.     putc('\n', stderr);
  2108.     if (!tempsource || numfiles)
  2109.         msg("File '%s'; Line %d\n", sourcefile[curinfile], lineno);
  2110.     else 
  2111.         msg("# Syntax error near line %d:\n", lineno);
  2112. #else
  2113.     msg("syntax error near line %d:\n%.*s", lineno, ptr - beg, beg);
  2114.     scan = beg;
  2115.     while (scan < token_start)
  2116.         if (*scan++ == '\t')
  2117.             putc('\t', stderr);
  2118.         else
  2119.             putc(' ', stderr);
  2120.     putc('^', stderr);
  2121.     putc(' ', stderr);
  2122.     vfprintf(stderr, mesg, args);
  2123.     putc('\n', stderr);
  2124. #endif
  2125.     exit(1);
  2126. }
  2127.  
  2128. /*
  2129.  * Parse a C escape sequence.  STRING_PTR points to a variable containing a
  2130.  * pointer to the string to parse.  That pointer is updated past the
  2131.  * characters we use.  The value of the escape sequence is returned. 
  2132.  *
  2133.  * A negative value means the sequence \ newline was seen, which is supposed to
  2134.  * be equivalent to nothing at all. 
  2135.  *
  2136.  * If \ is followed by a null character, we return a negative value and leave
  2137.  * the string pointer pointing at the null character. 
  2138.  *
  2139.  * If \ is followed by 000, we return 0 and leave the string pointer after the
  2140.  * zeros.  A value of 0 does not mean end of string.  
  2141.  */
  2142.  
  2143. int
  2144. parse_escape(string_ptr)
  2145. char **string_ptr;
  2146. {
  2147.     register int c = *(*string_ptr)++;
  2148.     register int i;
  2149.     register int count;
  2150.  
  2151.     switch (c) {
  2152.     case 'a':
  2153.         return BELL;
  2154.     case 'b':
  2155.         return '\b';
  2156.     case 'f':
  2157.         return '\f';
  2158.     case 'n':
  2159.         return '\n';
  2160.     case 'r':
  2161.         return '\r';
  2162.     case 't':
  2163.         return '\t';
  2164.     case 'v':
  2165.         return '\v';
  2166.     case '\n':
  2167.         return -2;
  2168.     case 0:
  2169.         (*string_ptr)--;
  2170.         return -1;
  2171.     case '0':
  2172.     case '1':
  2173.     case '2':
  2174.     case '3':
  2175.     case '4':
  2176.     case '5':
  2177.     case '6':
  2178.     case '7':
  2179.         i = c - '0';
  2180.         count = 0;
  2181.         while (++count < 3) {
  2182.             if ((c = *(*string_ptr)++) >= '0' && c <= '7') {
  2183.                 i *= 8;
  2184.                 i += c - '0';
  2185.             } else {
  2186.                 (*string_ptr)--;
  2187.                 break;
  2188.             }
  2189.         }
  2190.         return i;
  2191.     case 'x':
  2192.         i = 0;
  2193.         while (1) {
  2194.             if (isxdigit((c = *(*string_ptr)++))) {
  2195.                 if (isdigit(c))
  2196.                     i += c - '0';
  2197.                 else if (isupper(c))
  2198.                     i += c - 'A' + 10;
  2199.                 else
  2200.                     i += c - 'a' + 10;
  2201.             } else {
  2202.                 (*string_ptr)--;
  2203.                 break;
  2204.             }
  2205.         }
  2206.         return i;
  2207.     default:
  2208.         return c;
  2209.     }
  2210. }
  2211.  
  2212. /*
  2213.  * Read the input and turn it into tokens. Input is now read from a file
  2214.  * instead of from malloc'ed memory. The main program takes a program
  2215.  * passed as a command line argument and writes it to a temp file. Otherwise
  2216.  * the file name is made available in an external variable.
  2217.  */
  2218.  
  2219. static int
  2220. yylex()
  2221. {
  2222.     register int c;
  2223.     register int namelen;
  2224.     register char *tokstart;
  2225.     char *tokkey;
  2226.     static did_newline = 0;    /* the grammar insists that actions end
  2227.                  * with newlines.  This was easier than
  2228.                  * hacking the grammar. */
  2229.     int seen_e = 0;        /* These are for numbers */
  2230.     int seen_point = 0;
  2231.     int esc_seen;
  2232.     extern char **sourcefile;
  2233.     extern int tempsource, numfiles;
  2234.     static int file_opened = 0;
  2235.     static FILE *fin;
  2236.     static char cbuf[BUFSIZ];
  2237.     int low, mid, high;
  2238. #ifdef DEBUG
  2239.     extern int debugging;
  2240. #endif
  2241.  
  2242.     if (! file_opened) {
  2243.         file_opened = 1;
  2244. #ifdef DEBUG
  2245.         if (debugging) {
  2246.             int i;
  2247.  
  2248.             for (i = 0; i <= numfiles; i++)
  2249.                 fprintf (stderr, "sourcefile[%d] = %s\n", i,
  2250.                         sourcefile[i]);
  2251.         }
  2252. #endif
  2253.     nextfile:
  2254.         if ((fin = pathopen (sourcefile[++curinfile])) == NULL)
  2255.             fatal("cannot open `%s' for reading (%s)",
  2256.                 sourcefile[curinfile],
  2257.                 strerror(errno));
  2258.         *(lexptr = cbuf) = '\0';
  2259.         /*
  2260.          * immediately unlink the tempfile so that it will
  2261.          * go away cleanly if we bomb.
  2262.          * This unfortunately won't work on a Macintosh
  2263.          */
  2264. #ifndef macintosh
  2265.         if (tempsource && curinfile == 0)
  2266.             (void) unlink (sourcefile[curinfile]);
  2267. #endif
  2268.     }
  2269.  
  2270. retry:
  2271.     if (! *lexptr)
  2272.         if (fgets (cbuf, sizeof cbuf, fin) == NULL) {
  2273.             if (fin != NULL)
  2274.                 fclose (fin);    /* be neat and clean */
  2275. #ifdef macintosh
  2276.             if (tempsource && curinfile == 0)
  2277.                 (void) unlink (sourcefile[curinfile]);
  2278. #endif
  2279.             if (curinfile < numfiles)
  2280.                 goto nextfile;
  2281.             return 0;
  2282.         } else
  2283.             lexptr = lexptr_begin = cbuf;
  2284.  
  2285.     if (want_regexp) {
  2286.         int in_brack = 0;
  2287.  
  2288.         want_regexp = 0;
  2289.         token_start = tokstart = lexptr;
  2290.         while (c = *lexptr++) {
  2291.             switch (c) {
  2292.             case '[':
  2293.                 in_brack = 1;
  2294.                 break;
  2295.             case ']':
  2296.                 in_brack = 0;
  2297.                 break;
  2298.             case '\\':
  2299.                 if (*lexptr++ == '\0') {
  2300.                     yyerror("unterminated regexp ends with \\");
  2301.                     return ERROR;
  2302.                 } else if (lexptr[-1] == '\n')
  2303.                     goto retry;
  2304.                 break;
  2305.             case '/':    /* end of the regexp */
  2306.                 if (in_brack)
  2307.                     break;
  2308.  
  2309.                 lexptr--;
  2310.                 yylval.sval = tokstart;
  2311.                 return REGEXP;
  2312.             case '\n':
  2313.                 lineno++;
  2314.             case '\0':
  2315.                 lexptr--;    /* so error messages work */
  2316.                 yyerror("unterminated regexp");
  2317.                 return ERROR;
  2318.             }
  2319.         }
  2320.     }
  2321.  
  2322.     if (*lexptr == '\n') {
  2323.         lexptr++;
  2324.         lineno++;
  2325.         return NEWLINE;
  2326.     }
  2327.  
  2328.     while (*lexptr == ' ' || *lexptr == '\t')
  2329.         lexptr++;
  2330.  
  2331.     token_start = tokstart = lexptr;
  2332.  
  2333.     switch (c = *lexptr++) {
  2334.     case 0:
  2335.         return 0;
  2336.  
  2337.     case '\n':
  2338.         lineno++;
  2339.         return NEWLINE;
  2340.  
  2341.     case '#':        /* it's a comment */
  2342.         while (*lexptr != '\n' && *lexptr != '\0')
  2343.             lexptr++;
  2344.         goto retry;
  2345.  
  2346.     case '\\':
  2347.         if (*lexptr == '\n') {
  2348.             lineno++;
  2349.             lexptr++;
  2350.             goto retry;
  2351.         } else
  2352.             break;
  2353.     case ')':
  2354.     case ']':
  2355.     case '(':    
  2356.     case '[':
  2357.     case '$':
  2358.     case ';':
  2359.     case ':':
  2360.     case '?':
  2361.  
  2362.         /*
  2363.          * set node type to ILLEGAL because the action should set it
  2364.          * to the right thing 
  2365.          */
  2366.         yylval.nodetypeval = Node_illegal;
  2367.         return c;
  2368.  
  2369.     case '{':
  2370.     case ',':
  2371.         yylval.nodetypeval = Node_illegal;
  2372.         return c;
  2373.  
  2374.     case '*':
  2375.         if (*lexptr == '=') {
  2376.             yylval.nodetypeval = Node_assign_times;
  2377.             lexptr++;
  2378.             return ASSIGNOP;
  2379.         } else if (*lexptr == '*') {    /* make ** and **= aliases
  2380.                          * for ^ and ^= */
  2381.             if (lexptr[1] == '=') {
  2382.                 yylval.nodetypeval = Node_assign_exp;
  2383.                 lexptr += 2;
  2384.                 return ASSIGNOP;
  2385.             } else {
  2386.                 yylval.nodetypeval = Node_illegal;
  2387.                 lexptr++;
  2388.                 return '^';
  2389.             }
  2390.         }
  2391.         yylval.nodetypeval = Node_illegal;
  2392.         return c;
  2393.  
  2394.     case '/':
  2395.         if (want_assign && *lexptr == '=') {
  2396.             yylval.nodetypeval = Node_assign_quotient;
  2397.             lexptr++;
  2398.             return ASSIGNOP;
  2399.         }
  2400.         yylval.nodetypeval = Node_illegal;
  2401.         return c;
  2402.  
  2403.     case '%':
  2404.         if (*lexptr == '=') {
  2405.             yylval.nodetypeval = Node_assign_mod;
  2406.             lexptr++;
  2407.             return ASSIGNOP;
  2408.         }
  2409.         yylval.nodetypeval = Node_illegal;
  2410.         return c;
  2411.  
  2412.     case '^':
  2413.         if (*lexptr == '=') {
  2414.             yylval.nodetypeval = Node_assign_exp;
  2415.             lexptr++;
  2416.             return ASSIGNOP;
  2417.         }
  2418.         yylval.nodetypeval = Node_illegal;
  2419.         return c;
  2420.  
  2421.     case '+':
  2422.         if (*lexptr == '=') {
  2423.             yylval.nodetypeval = Node_assign_plus;
  2424.             lexptr++;
  2425.             return ASSIGNOP;
  2426.         }
  2427.         if (*lexptr == '+') {
  2428.             yylval.nodetypeval = Node_illegal;
  2429.             lexptr++;
  2430.             return INCREMENT;
  2431.         }
  2432.         yylval.nodetypeval = Node_illegal;
  2433.         return c;
  2434.  
  2435.     case '!':
  2436.         if (*lexptr == '=') {
  2437.             yylval.nodetypeval = Node_notequal;
  2438.             lexptr++;
  2439.             return RELOP;
  2440.         }
  2441.         if (*lexptr == '~') {
  2442.             yylval.nodetypeval = Node_nomatch;
  2443.             lexptr++;
  2444.             return MATCHOP;
  2445.         }
  2446.         yylval.nodetypeval = Node_illegal;
  2447.         return c;
  2448.  
  2449.     case '<':
  2450.         if (*lexptr == '=') {
  2451.             yylval.nodetypeval = Node_leq;
  2452.             lexptr++;
  2453.             return RELOP;
  2454.         }
  2455.         yylval.nodetypeval = Node_less;
  2456.         return c;
  2457.  
  2458.     case '=':
  2459.         if (*lexptr == '=') {
  2460.             yylval.nodetypeval = Node_equal;
  2461.             lexptr++;
  2462.             return RELOP;
  2463.         }
  2464.         yylval.nodetypeval = Node_assign;
  2465.         return ASSIGNOP;
  2466.  
  2467.     case '>':
  2468.         if (*lexptr == '=') {
  2469.             yylval.nodetypeval = Node_geq;
  2470.             lexptr++;
  2471.             return RELOP;
  2472.         } else if (*lexptr == '>') {
  2473.             yylval.nodetypeval = Node_redirect_append;
  2474.             lexptr++;
  2475.             return APPEND_OP;
  2476.         }
  2477.         yylval.nodetypeval = Node_greater;
  2478.         return c;
  2479.  
  2480.     case '~':
  2481.         yylval.nodetypeval = Node_match;
  2482.         return MATCHOP;
  2483.  
  2484.     case '}':
  2485.         /*
  2486.          * Added did newline stuff.  Easier than
  2487.          * hacking the grammar
  2488.          */
  2489.         if (did_newline) {
  2490.             did_newline = 0;
  2491.             return c;
  2492.         }
  2493.         did_newline++;
  2494.         --lexptr;
  2495.         return NEWLINE;
  2496.  
  2497.     case '"':
  2498.         esc_seen = 0;
  2499.         while (*lexptr != '\0') {
  2500.             switch (*lexptr++) {
  2501.             case '\\':
  2502.                 esc_seen = 1;
  2503.                 if (*lexptr == '\n')
  2504.                     yyerror("newline in string");
  2505.                 if (*lexptr++ != '\0')
  2506.                     break;
  2507.                 /* fall through */
  2508.             case '\n':
  2509.                 lexptr--;
  2510.                 yyerror("unterminated string");
  2511.                 return ERROR;
  2512.             case '"':
  2513.                 yylval.nodeval = make_str_node(tokstart + 1,
  2514.                         lexptr-tokstart-2, esc_seen);
  2515.                 yylval.nodeval->flags |= PERM;
  2516.                 return YSTRING;
  2517.             }
  2518.         }
  2519.         return ERROR;
  2520.  
  2521.     case '-':
  2522.         if (*lexptr == '=') {
  2523.             yylval.nodetypeval = Node_assign_minus;
  2524.             lexptr++;
  2525.             return ASSIGNOP;
  2526.         }
  2527.         if (*lexptr == '-') {
  2528.             yylval.nodetypeval = Node_illegal;
  2529.             lexptr++;
  2530.             return DECREMENT;
  2531.         }
  2532.         yylval.nodetypeval = Node_illegal;
  2533.         return c;
  2534.  
  2535.     case '0':
  2536.     case '1':
  2537.     case '2':
  2538.     case '3':
  2539.     case '4':
  2540.     case '5':
  2541.     case '6':
  2542.     case '7':
  2543.     case '8':
  2544.     case '9':
  2545.     case '.':
  2546.         /* It's a number */
  2547.         for (namelen = 0; (c = tokstart[namelen]) != '\0'; namelen++) {
  2548.             switch (c) {
  2549.             case '.':
  2550.                 if (seen_point)
  2551.                     goto got_number;
  2552.                 ++seen_point;
  2553.                 break;
  2554.             case 'e':
  2555.             case 'E':
  2556.                 if (seen_e)
  2557.                     goto got_number;
  2558.                 ++seen_e;
  2559.                 if (tokstart[namelen + 1] == '-' ||
  2560.                     tokstart[namelen + 1] == '+')
  2561.                     namelen++;
  2562.                 break;
  2563.             case '0':
  2564.             case '1':
  2565.             case '2':
  2566.             case '3':
  2567.             case '4':
  2568.             case '5':
  2569.             case '6':
  2570.             case '7':
  2571.             case '8':
  2572.             case '9':
  2573.                 break;
  2574.             default:
  2575.                 goto got_number;
  2576.             }
  2577.         }
  2578.  
  2579. got_number:
  2580.         lexptr = tokstart + namelen;
  2581.         /*
  2582.         yylval.nodeval = make_string(tokstart, namelen);
  2583.         (void) force_number(yylval.nodeval);
  2584.         */
  2585.         yylval.nodeval = make_number(atof(tokstart));
  2586.         yylval.nodeval->flags |= PERM;
  2587.         return NUMBER;
  2588.  
  2589.     case '&':
  2590.         if (*lexptr == '&') {
  2591.             yylval.nodetypeval = Node_and;
  2592.             while (c = *++lexptr) {
  2593.                 if (c == '#')
  2594.                     while ((c = *++lexptr) != '\n'
  2595.                            && c != '\0')
  2596.                         ;
  2597.                 if (c == '\n')
  2598.                     lineno++;
  2599.                 else if (! isspace(c))
  2600.                     break;
  2601.             }
  2602.             return LEX_AND;
  2603.         }
  2604.         return ERROR;
  2605.  
  2606.     case '|':
  2607.         if (*lexptr == '|') {
  2608.             yylval.nodetypeval = Node_or;
  2609.             while (c = *++lexptr) {
  2610.                 if (c == '#')
  2611.                     while ((c = *++lexptr) != '\n'
  2612.                            && c != '\0')
  2613.                         ;
  2614.                 if (c == '\n')
  2615.                     lineno++;
  2616.                 else if (! isspace(c))
  2617.                     break;
  2618.             }
  2619.             return LEX_OR;
  2620.         }
  2621.         yylval.nodetypeval = Node_illegal;
  2622.         return c;
  2623.     }
  2624.  
  2625.     if (c != '_' && ! isalpha(c)) {
  2626.         yyerror("Invalid char '%c' in expression\n", c);
  2627.         return ERROR;
  2628.     }
  2629.  
  2630.     /* it's some type of name-type-thing.  Find its length */
  2631.     for (namelen = 0; is_identchar(tokstart[namelen]); namelen++)
  2632.         /* null */ ;
  2633.     emalloc(tokkey, char *, namelen+1, "yylex");
  2634.     memcpy(tokkey, tokstart, namelen);
  2635.     tokkey[namelen] = '\0';
  2636.  
  2637.     /* See if it is a special token.  */
  2638.     low = 0;
  2639.     high = (sizeof (tokentab) / sizeof (tokentab[0])) - 1;
  2640.     while (low <= high) {
  2641.         int i, c;
  2642.  
  2643.         mid = (low + high) / 2;
  2644.         c = *tokstart - tokentab[mid].operator[0];
  2645.         i = c ? c : strcmp (tokkey, tokentab[mid].operator);
  2646.  
  2647.         if (i < 0) {        /* token < mid */
  2648.             high = mid - 1;
  2649.         } else if (i > 0) {    /* token > mid */
  2650.             low = mid + 1;
  2651.         } else {
  2652.             lexptr = tokstart + namelen;
  2653.             if (strict && tokentab[mid].nostrict)
  2654.                 break;
  2655.             if (tokentab[mid].class == LEX_BUILTIN
  2656.                 || tokentab[mid].class == LEX_LENGTH)
  2657.                 yylval.ptrval = tokentab[mid].ptr;
  2658.             else
  2659.                 yylval.nodetypeval = tokentab[mid].value;
  2660.             return tokentab[mid].class;
  2661.         }
  2662.     }
  2663.  
  2664.     /* It's a name.  See how long it is.  */
  2665.     yylval.sval = tokkey;
  2666.     lexptr = tokstart + namelen;
  2667.     if (*lexptr == '(')
  2668.         return FUNC_CALL;
  2669.     else
  2670.         return NAME;
  2671. }
  2672.  
  2673. #ifndef DEFPATH
  2674. #ifdef MSDOS
  2675. #define DEFPATH    "."
  2676. #define ENVSEP    ';'
  2677. #else
  2678. #ifdef macintosh
  2679. #define DEFPATH    ":"
  2680. #define ENVSEP    ','
  2681. #else
  2682. #define DEFPATH    ".:/usr/lib/awk:/usr/local/lib/awk"
  2683. #define ENVSEP    ':'
  2684. #endif
  2685. #endif
  2686. #endif
  2687.  
  2688. static FILE *
  2689. pathopen (file)
  2690. char *file;
  2691. {
  2692.     static char *savepath = DEFPATH;
  2693.     static int first = 1;
  2694.     char *awkpath, *cp;
  2695.     char trypath[BUFSIZ];
  2696.     FILE *fp;
  2697. #ifdef DEBUG
  2698.     extern int debugging;
  2699. #endif
  2700.     int fd;
  2701.  
  2702.     if (strcmp (file, "-") == 0)
  2703.         return (stdin);
  2704.  
  2705.     if (strict)
  2706.         return (fopen (file, "r"));
  2707.  
  2708.     if (first) {
  2709.         first = 0;
  2710.         if ((awkpath = getenv ("AWKPATH")) != NULL && *awkpath)
  2711.             savepath = awkpath;    /* used for restarting */
  2712.     }
  2713.     awkpath = savepath;
  2714.  
  2715.     /* some kind of path name, no search */
  2716. #ifndef MSDOS
  2717.     if (strchr (file, '/') != NULL)
  2718. #else
  2719. #ifdef macintosh
  2720.     if (strchr (file, ':') != NULL)
  2721. #else
  2722.     if (strchr (file, '/') != NULL || strchr (file, '\\') != NULL
  2723.             || strchr (file, ':') != NULL)
  2724. #endif
  2725. #endif
  2726.         return ( (fd = devopen (file, "r")) >= 0 ?
  2727.                 fdopen(fd, "r") :
  2728.                 NULL);
  2729.  
  2730.     do {
  2731.         trypath[0] = '\0';
  2732.         /* this should take into account limits on size of trypath */
  2733.         for (cp = trypath; *awkpath && *awkpath != ENVSEP; )
  2734.             *cp++ = *awkpath++;
  2735.  
  2736.         if (cp != trypath) {    /* nun-null element in path */
  2737. #ifndef macintosh
  2738.             *cp++ = '/';
  2739. #else
  2740.             *cp++ = ':';
  2741. #endif
  2742.             strcpy (cp, file);
  2743.         } else
  2744.             strcpy (trypath, file);
  2745. #ifdef DEBUG
  2746.         if (debugging)
  2747.             fprintf(stderr, "trying: %s\n", trypath);
  2748. #endif
  2749.         if ((fd = devopen (trypath, "r")) >= 0
  2750.             && (fp = fdopen(fd, "r")) != NULL)
  2751.             return (fp);
  2752.  
  2753.         /* no luck, keep going */
  2754.         if(*awkpath == ENVSEP && awkpath[1] != '\0')
  2755.             awkpath++;    /* skip colon */
  2756.     } while (*awkpath);
  2757. #if defined(MSDOS) || defined(macintosh)
  2758.     /*
  2759.      * Under DOS (and probably elsewhere) you might have one of the awk
  2760.      * paths defined, WITHOUT the current working directory in it.
  2761.      * Therefore you should try to open the file in the current directory.
  2762.      */
  2763.     return ( (fd = devopen(file, "r")) >= 0 ? fdopen(fd, "r") : NULL);
  2764. #else
  2765.     return (NULL);
  2766. #endif
  2767. }
  2768.  
  2769. static NODE *
  2770. node_common(op)
  2771. NODETYPE op;
  2772. {
  2773.     register NODE *r;
  2774.     extern int numfiles;
  2775.     extern int tempsource;
  2776.     extern char **sourcefile;
  2777.  
  2778.     r = newnode(op);
  2779.     r->source_line = lineno;
  2780.     if (numfiles > -1 && ! tempsource)
  2781.         r->source_file = sourcefile[curinfile];
  2782.     else
  2783.         r->source_file = NULL;
  2784.     return r;
  2785. }
  2786.  
  2787. /*
  2788.  * This allocates a node with defined lnode and rnode. 
  2789.  * This should only be used by yyparse+co while reading in the program 
  2790.  */
  2791. NODE *
  2792. node(left, op, right)
  2793. NODE *left, *right;
  2794. NODETYPE op;
  2795. {
  2796.     register NODE *r;
  2797.  
  2798.     r = node_common(op);
  2799.     r->lnode = left;
  2800.     r->rnode = right;
  2801.     return r;
  2802. }
  2803.  
  2804. /*
  2805.  * This allocates a node with defined subnode and proc
  2806.  * Otherwise like node()
  2807.  */
  2808. static NODE *
  2809. snode(subn, op, procp)
  2810. NODETYPE op;
  2811. NODE *(*procp) ();
  2812. NODE *subn;
  2813. {
  2814.     register NODE *r;
  2815.  
  2816.     r = node_common(op);
  2817.     r->subnode = subn;
  2818.     r->proc = procp;
  2819.     return r;
  2820. }
  2821.  
  2822. /*
  2823.  * This allocates a Node_line_range node with defined condpair and
  2824.  * zeroes the trigger word to avoid the temptation of assuming that calling
  2825.  * 'node( foo, Node_line_range, 0)' will properly initialize 'triggered'. 
  2826.  */
  2827. /* Otherwise like node() */
  2828. static NODE *
  2829. mkrangenode(cpair)
  2830. NODE *cpair;
  2831. {
  2832.     register NODE *r;
  2833.  
  2834.     r = newnode(Node_line_range);
  2835.     r->condpair = cpair;
  2836.     r->triggered = 0;
  2837.     return r;
  2838. }
  2839.  
  2840. /* Build a for loop */
  2841. static NODE *
  2842. make_for_loop(init, cond, incr)
  2843. NODE *init, *cond, *incr;
  2844. {
  2845.     register FOR_LOOP_HEADER *r;
  2846.     NODE *n;
  2847.  
  2848.     emalloc(r, FOR_LOOP_HEADER *, sizeof(FOR_LOOP_HEADER), "make_for_loop");
  2849.     n = newnode(Node_illegal);
  2850.     r->init = init;
  2851.     r->cond = cond;
  2852.     r->incr = incr;
  2853.     n->sub.nodep.r.hd = r;
  2854.     return n;
  2855. }
  2856.  
  2857. /*
  2858.  * Install a name in the hash table specified, even if it is already there.
  2859.  * Name stops with first non alphanumeric. Caller must check against
  2860.  * redefinition if that is desired. 
  2861.  */
  2862. NODE *
  2863. install(table, name, value)
  2864. NODE **table;
  2865. char *name;
  2866. NODE *value;
  2867. {
  2868.     register NODE *hp;
  2869.     register int len, bucket;
  2870.     register char *p;
  2871.  
  2872.     len = 0;
  2873.     p = name;
  2874.     while (is_identchar(*p))
  2875.         p++;
  2876.     len = p - name;
  2877.  
  2878.     hp = newnode(Node_hashnode);
  2879.     bucket = hashf(name, len, HASHSIZE);
  2880.     hp->hnext = table[bucket];
  2881.     table[bucket] = hp;
  2882.     hp->hlength = len;
  2883.     hp->hvalue = value;
  2884.     emalloc(hp->hname, char *, len + 1, "install");
  2885.     memcpy(hp->hname, name, len);
  2886.     hp->hname[len] = '\0';
  2887.     return hp->hvalue;
  2888. }
  2889.  
  2890. /*
  2891.  * find the most recent hash node for name name (ending with first
  2892.  * non-identifier char) installed by install 
  2893.  */
  2894. NODE *
  2895. lookup(table, name)
  2896. NODE **table;
  2897. char *name;
  2898. {
  2899.     register char *bp;
  2900.     register NODE *bucket;
  2901.     register int len;
  2902.  
  2903.     for (bp = name; is_identchar(*bp); bp++)
  2904.         ;
  2905.     len = bp - name;
  2906.     bucket = table[hashf(name, len, HASHSIZE)];
  2907.     while (bucket) {
  2908.         if (bucket->hlength == len && STREQN(bucket->hname, name, len))
  2909.             return bucket->hvalue;
  2910.         bucket = bucket->hnext;
  2911.     }
  2912.     return NULL;
  2913. }
  2914.  
  2915. #define HASHSTEP(old, c) ((old << 1) + c)
  2916. #define MAKE_POS(v) (v & ~0x80000000)    /* make number positive */
  2917.  
  2918. /*
  2919.  * return hash function on name.
  2920.  */
  2921. static int
  2922. hashf(name, len, hashsize)
  2923. register char *name;
  2924. register int len;
  2925. int hashsize;
  2926. {
  2927.     register int r = 0;
  2928.  
  2929.     while (len--)
  2930.         r = HASHSTEP(r, *name++);
  2931.  
  2932.     r = MAKE_POS(r) % hashsize;
  2933.     return r;
  2934. }
  2935.  
  2936. /*
  2937.  * Add new to the rightmost branch of LIST.  This uses n^2 time, so we make
  2938.  * a simple attempt at optimizing it.
  2939.  */
  2940. static NODE *
  2941. append_right(list, new)
  2942. NODE *list, *new;
  2943.  
  2944. {
  2945.     register NODE *oldlist;
  2946.     static NODE *savefront = NULL, *savetail = NULL;
  2947.  
  2948.     oldlist = list;
  2949.     if (savefront == oldlist) {
  2950.         savetail = savetail->rnode = new;
  2951.         return oldlist;
  2952.     } else
  2953.         savefront = oldlist;
  2954.     while (list->rnode != NULL)
  2955.         list = list->rnode;
  2956.     savetail = list->rnode = new;
  2957.     return oldlist;
  2958. }
  2959.  
  2960. /*
  2961.  * check if name is already installed;  if so, it had better have Null value,
  2962.  * in which case def is added as the value. Otherwise, install name with def
  2963.  * as value. 
  2964.  */
  2965. static void
  2966. func_install(params, def)
  2967. NODE *params;
  2968. NODE *def;
  2969. {
  2970.     NODE *r;
  2971.  
  2972.     pop_params(params->rnode);
  2973.     pop_var(params, 0);
  2974.     r = lookup(variables, params->param);
  2975.     if (r != NULL) {
  2976.         fatal("function name `%s' previously defined", params->param);
  2977.     } else
  2978.         (void) install(variables, params->param,
  2979.             node(params, Node_func, def));
  2980. }
  2981.  
  2982. static void
  2983. pop_var(np, freeit)
  2984. NODE *np;
  2985. int freeit;
  2986. {
  2987.     register char *bp;
  2988.     register NODE *bucket, **save;
  2989.     register int len;
  2990.     char *name;
  2991.  
  2992.     name = np->param;
  2993.     for (bp = name; is_identchar(*bp); bp++)
  2994.         ;
  2995.     len = bp - name;
  2996.     save = &(variables[hashf(name, len, HASHSIZE)]);
  2997.     for (bucket = *save; bucket; bucket = bucket->hnext) {
  2998.         if (len == bucket->hlength && STREQN(bucket->hname, name, len)) {
  2999.             *save = bucket->hnext;
  3000.             freenode(bucket);
  3001.             free(bucket->hname);
  3002.             if (freeit)
  3003.                 free(np->param);
  3004.             return;
  3005.         }
  3006.         save = &(bucket->hnext);
  3007.     }
  3008. }
  3009.  
  3010. static void
  3011. pop_params(params)
  3012. NODE *params;
  3013. {
  3014.     register NODE *np;
  3015.  
  3016.     for (np = params; np != NULL; np = np->rnode)
  3017.         pop_var(np, 1);
  3018. }
  3019.  
  3020. static NODE *
  3021. make_param(name)
  3022. char *name;
  3023. {
  3024.     NODE *r;
  3025.  
  3026.     r = newnode(Node_param_list);
  3027.     r->param = name;
  3028.     r->rnode = NULL;
  3029.     r->param_cnt = param_counter++;
  3030.     return (install(variables, name, r));
  3031. }
  3032.  
  3033. /* Name points to a variable name.  Make sure its in the symbol table */
  3034. NODE *
  3035. variable(name)
  3036. char *name;
  3037. {
  3038.     register NODE *r;
  3039.  
  3040.     if ((r = lookup(variables, name)) == NULL)
  3041.         r = install(variables, name,
  3042.             node(Nnull_string, Node_var, (NODE *) NULL));
  3043.     return r;
  3044. }
  3045.