
/*  A Bison parser, made from awk.y  */

#define	FUNC_CALL	258
#define	NAME	259
#define	REGEXP	260
#define	YSTRING	261
#define	ERROR	262
#define	INCDEC	263
#define	NUMBER	264
#define	RELOP	265
#define	APPEND_OP	266
#define	ASSIGNOP	267
#define	MATCHOP	268
#define	NEWLINE	269
#define	CONCAT_OP	270
#define	LEX_BEGIN	271
#define	LEX_END	272
#define	LEX_IF	273
#define	LEX_ELSE	274
#define	LEX_RETURN	275
#define	LEX_DELETE	276
#define	LEX_WHILE	277
#define	LEX_DO	278
#define	LEX_FOR	279
#define	LEX_BREAK	280
#define	LEX_CONTINUE	281
#define	LEX_PRINT	282
#define	LEX_PRINTF	283
#define	LEX_NEXT	284
#define	LEX_EXIT	285
#define	LEX_FUNCTION	286
#define	LEX_GETLINE	287
#define	LEX_SUB	288
#define	LEX_MATCH	289
#define	LEX_IN	290
#define	LEX_AND	291
#define	LEX_OR	292
#define	INCREMENT	293
#define	DECREMENT	294
#define	LEX_BUILTIN	295
#define	UNARY	296

#line 197 "awk.y"

#ifdef DEBUG
#define YYDEBUG 12
#endif
#define YYIMPROVE

#include "awk.h"

extern void msg();
extern struct re_pattern_buffer *mk_re_parse();

NODE *node();
NODE *lookup();
NODE *install();

static NODE *snode();
static NODE *mkrangenode();
static FILE *pathopen();
static NODE *make_for_loop();
static NODE *append_right();
static void func_install();
static NODE *make_param();
static int hashf();
static void pop_params();
static void pop_var();
static int yylex ();
static void yyerror();

static int want_regexp;		/* lexical scanning kludge */
static int lineno = 1;		/* for error msgs */
static char *lexptr;		/* pointer to next char during parsing */
static char *lexptr_begin;	/* keep track of where we were for error msgs */
static int curinfile = -1;	/* index into sourcefiles[] */

NODE *variables[HASHSIZE];

extern int errcount;
extern NODE *begin_block;
extern NODE *end_block;
extern int param_counter;

#line 239 "awk.y"
typedef union {
	long lval;
	AWKNUM fval;
	NODE *nodeval;
	NODETYPE nodetypeval;
	char *sval;
	NODE *(*ptrval)();
} YYSTYPE;

#ifndef YYLTYPE
typedef
  struct yyltype
    {
      int timestamp;
      int first_line;
      int first_column;
      int last_line;
      int last_column;
      char *text;
   }
  yyltype;

#define YYLTYPE yyltype
#endif

#include <stdio.h>

#ifndef __STDC__
#define const
#endif



#define	YYFINAL		312
#define	YYFLAG		-32768
#define	YYNTBASE	63

#define YYTRANSLATE(x) ((unsigned)(x) <= 296 ? yytranslate[x] : 103)

static const char yytranslate[] = {     0,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,    53,     2,     2,    56,    52,     2,     2,    46,
    47,    50,    48,    62,    49,     2,    51,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,    42,    61,    43,
     2,    44,    41,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    57,     2,    58,    55,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,    59,    45,    60,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
    26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
    36,    37,    38,    39,    40,    54
};

static const short yyrline[] = {     0,
   300,   305,   313,   329,   330,   334,   348,   362,   368,   374,
   376,   378,   380,   389,   391,   396,   400,   407,   413,   415,
   417,   419,   421,   423,   428,   430,   435,   448,   450,   461,
   466,   471,   473,   481,   483,   488,   490,   496,   498,   500,
   502,   504,   506,   511,   515,   520,   523,   526,   528,   530,
   532,   534,   536,   538,   543,   545,   550,   555,   562,   564,
   569,   571,   576,   578,   583,   585,   587,   589,   594,   596,
   601,   603,   605,   607,   609,   615,   617,   622,   624,   629,
   631,   637,   639,   641,   643,   648,   650,   655,   657,   663,
   665,   667,   669,   674,   676,   678,   683,   687,   689,   691,
   693,   695,   697,   699,   701,   703,   705,   707,   712,   714,
   716,   718,   722,   724,   726,   728,   730,   732,   734,   739,
   741,   743,   745,   747,   749,   751,   753,   755,   759,   761,
   763,   765,   767,   769,   771,   775,   777,   779,   781,   783,
   785,   787,   789,   794,   796,   801,   803,   805,   810,   814,
   818,   822,   823,   827,   830
};

static const char * const yytname[] = {     0,
"error","$illegal.","FUNC_CALL","NAME","REGEXP","YSTRING","ERROR","INCDEC","NUMBER","RELOP",
"APPEND_OP","ASSIGNOP","MATCHOP","NEWLINE","CONCAT_OP","LEX_BEGIN","LEX_END","LEX_IF","LEX_ELSE","LEX_RETURN",
"LEX_DELETE","LEX_WHILE","LEX_DO","LEX_FOR","LEX_BREAK","LEX_CONTINUE","LEX_PRINT","LEX_PRINTF","LEX_NEXT","LEX_EXIT",
"LEX_FUNCTION","LEX_GETLINE","LEX_SUB","LEX_MATCH","LEX_IN","LEX_AND","LEX_OR","INCREMENT","DECREMENT","LEX_BUILTIN",
"'?'","':'","'<'","'>'","'|'","'('","')'","'+'","'-'","'*'",
"'/'","'%'","'!'","UNARY","'^'","'$'","'['","']'","'{'","'}'",
"';'","','","start"
};

static const short yyr1[] = {     0,
    63,    64,    64,    64,    64,    65,    65,    65,    65,    65,
    65,    65,    65,    66,    66,    68,    67,    69,    70,    70,
    70,    70,    70,    70,    71,    71,    72,    74,    73,    75,
    75,    76,    76,    76,    76,    77,    77,    78,    78,    78,
    78,    78,    78,    78,    78,    78,    78,    78,    78,    78,
    78,    78,    78,    78,    79,    79,    80,    80,    81,    81,
    82,    82,    83,    83,    84,    84,    84,    84,    85,    85,
    86,    86,    86,    86,    86,    87,    87,    88,    88,    89,
    89,    89,    89,    89,    89,    90,    90,    91,    91,    91,
    91,    91,    91,    92,    92,    92,    92,    92,    92,    92,
    92,    92,    92,    92,    92,    92,    92,    92,    93,    93,
    93,    93,    93,    93,    93,    93,    93,    93,    93,    94,
    94,    94,    94,    94,    94,    94,    94,    94,    94,    94,
    94,    94,    94,    94,    94,    94,    94,    94,    94,    94,
    94,    94,    94,    95,    95,    96,    96,    96,    97,    98,
    99,   100,   100,   101,   102
};

static const short yyr2[] = {     0,
     2,     1,     2,     1,     2,     2,     2,     2,     2,     2,
     1,     2,     2,     1,     1,     0,     7,     3,     1,     1,
     3,     3,     2,     3,     1,     3,     1,     0,     4,     3,
     4,     1,     2,     1,     2,     1,     2,     2,     3,     1,
     6,     8,     8,    10,     9,     2,     2,     6,     4,     2,
     3,     3,     6,     2,     1,     1,     6,     9,     1,     2,
     0,     1,     0,     2,     0,     2,     2,     2,     0,     1,
     1,     3,     1,     2,     3,     0,     1,     0,     1,     1,
     3,     1,     2,     3,     3,     0,     1,     1,     3,     1,
     2,     3,     3,     3,     5,     4,     3,     3,     3,     3,
     3,     3,     3,     3,     3,     5,     2,     1,     3,     3,
     3,     3,     3,     3,     3,     3,     5,     2,     1,     2,
     3,     4,     1,     6,     6,     6,     6,     4,     2,     2,
     2,     2,     1,     1,     1,     3,     3,     3,     3,     3,
     3,     2,     2,     0,     1,     1,     4,     2,     2,     2,
     1,     0,     1,     1,     2
};

static const short yydefact[] = {    61,
    59,    62,     0,    60,     4,     0,   146,   135,   134,     0,
     0,    16,   144,     0,     0,     0,     0,   123,     0,     0,
     0,    28,     0,     0,    61,     0,     2,     0,    25,     0,
    20,    27,    11,    19,   108,   133,     0,     0,     0,   154,
     6,     8,    36,    61,     7,     9,     0,    63,   145,     0,
     0,   129,   130,     0,    90,     0,     0,     0,     0,    88,
     0,   143,   133,   142,     0,    23,   120,   148,   149,     5,
     3,    13,     0,    61,     0,    10,    12,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,   107,     0,
     0,     0,     0,     0,     0,     0,   131,   132,    34,     0,
    76,     0,     0,    61,     0,     0,     0,    55,    56,     0,
    76,    61,     0,    32,     0,    40,     0,     0,   152,    61,
     0,     0,    88,     0,    37,    15,    14,     0,     0,    97,
     0,     0,     0,     0,   151,    24,    91,     0,     0,   121,
     0,     0,     0,   155,    26,    21,    22,   103,   100,   101,
   102,    98,    99,     0,   104,   105,   144,   140,   141,   137,
   138,   139,   136,    94,     0,     0,    77,     0,     0,     0,
    76,    46,    47,    50,     0,   150,    35,    33,   152,    82,
   144,     0,    65,     0,    80,   119,   133,    54,     0,    30,
   153,    38,   128,   147,     0,    64,     0,     0,     0,   122,
    92,     0,    93,    89,    29,    18,     0,    96,     0,    52,
     0,     0,     0,   146,     0,    51,    31,    63,     0,     0,
     0,     0,     0,    83,     0,     0,     0,     0,     0,     0,
     0,   118,     0,    39,    73,    71,     0,     0,     0,     0,
     0,     0,    95,   106,    61,     0,    61,     0,     0,     0,
   112,    65,    67,    66,    68,    49,    84,    85,    81,   116,
   113,   114,   115,   110,   111,     0,   109,    61,    74,     0,
   124,   125,   126,   127,     0,     0,     0,     0,     0,     0,
    76,     0,     0,    17,    75,    72,    57,    53,    41,     0,
    61,    76,     0,    48,   117,    61,    61,     0,     0,    61,
     0,    42,    43,    61,     0,    58,     0,    45,    44,     0,
     0,     0
};

static const short yydefgoto[] = {   310,
    26,    27,   128,    28,    47,    72,    29,    30,    31,    32,
    65,    33,   113,    42,   114,   115,   116,     2,     3,   130,
   223,   237,   238,   166,   183,   184,   121,    59,    89,   232,
    35,    48,    36,   118,   119,   140,   190,   120,   139
};

static const short yypact[] = {     1,
-32768,    17,  1006,-32768,-32768,   -17,    31,-32768,-32768,    -5,
    -5,-32768,     4,    11,    19,     4,     4,    57,  1085,  1933,
  1933,-32768,  1798,  1933,     1,   809,-32768,    50,    55,    -5,
    58,-32768,-32768,  1396,   191,    80,   535,  1126,  1177,-32768,
-32768,-32768,    17,     1,-32768,-32768,    93,    86,-32768,  1701,
  1836,-32768,-32768,  1126,-32768,  1177,  1933,    88,     5,  1300,
  1836,    82,    68,    82,   136,-32768,    82,-32768,-32768,-32768,
-32768,-32768,   663,     1,  1739,-32768,-32768,  1739,  1739,  1836,
  1701,   140,  1836,  1836,  1836,  1836,  1836,   117,   176,  1933,
  1933,  1933,  1933,  1933,  1933,  1836,-32768,-32768,-32768,   110,
  1836,   149,   111,     1,   112,     0,     0,-32768,-32768,     0,
  1836,     1,   602,-32768,   704,-32768,   901,   663,    98,     1,
    88,    24,  1396,     6,-32768,-32768,-32768,   115,  1933,-32768,
    55,   758,   758,    88,-32768,-32768,  1836,   119,  1218,-32768,
  1300,   122,   602,-32768,-32768,-32768,-32768,  1949,-32768,  1193,
-32768,  1533,  1444,  1348,  1949,  1949,     4,    96,    96,    82,
    82,    82,    82,  1396,  1836,     0,  1396,   106,  1836,   860,
  1874,-32768,-32768,-32768,     0,-32768,-32768,-32768,    98,-32768,
     4,  1177,    94,    29,  1581,   191,   104,-32768,   602,-32768,
-32768,-32768,-32768,-32768,    16,   191,  1177,  1177,  1701,-32768,
  1396,   170,-32768,  1396,-32768,-32768,  1836,-32768,  1300,-32768,
  1177,  1300,   153,   -13,    98,-32768,-32768,    86,     5,  1933,
  1933,  1933,     0,  1912,  1259,  1912,  1777,   172,  1912,  1912,
  1912,   176,  1912,-32768,-32768,-32768,    88,    40,     5,     5,
    88,  1300,-32768,  1396,     1,    27,     1,   131,   181,  1044,
-32768,    94,   191,   191,   191,-32768,  1581,-32768,  1581,  1997,
-32768,  1060,-32768,  1663,  1622,  1492,  1581,     1,-32768,    38,
-32768,-32768,-32768,-32768,   860,     0,   860,  1836,    88,   955,
  1836,     0,  1912,-32768,-32768,-32768,   173,-32768,-32768,  1300,
     1,  1836,    88,-32768,  1581,     1,     1,   860,    88,     1,
   860,-32768,-32768,     1,   860,-32768,   860,-32768,-32768,   189,
   193,-32768
};

static const short yypgoto[] = {-32768,
-32768,   165,-32768,-32768,-32768,-32768,   -29,-32768,    36,   -49,
-32768,     8,   -52,    15,   -44,-32768,-32768,    -6,   108,   -12,
   -43,-32768,-32768,  -109,-32768,-32768,   157,   -27,    -3,   156,
   228,  -144,   107,   177,  -110,   225,    34,   367,   -19
};


#define	YYLAST		2053


static const short yytable[] = {    34,
   131,   175,   179,    43,    43,   137,   137,     7,     1,    75,
   122,   124,   208,     1,     1,    60,   235,    41,    45,   236,
   143,   249,    34,    43,   137,    46,   122,   137,    38,   224,
     4,   149,   206,   117,   123,   123,   218,    76,   285,   -79,
   269,   286,   -79,    39,    77,   145,   132,   133,   146,   147,
   123,   135,    60,    25,    58,    40,    50,   141,    66,    24,
    40,   215,   -69,   194,    51,   189,    74,    74,   178,   117,
   -87,    34,   -79,   -79,    34,    34,   148,   150,   234,   152,
   153,   154,   155,   156,   276,    74,   -70,    39,    74,   -79,
    74,    96,   164,    78,    79,   126,   127,   167,   178,    43,
    43,    74,    54,    43,   220,    97,    98,   167,    25,   117,
    43,   197,   198,   199,   117,   233,    74,    97,    98,    49,
   172,   173,    52,    53,   174,   213,    63,    63,   129,    63,
    63,   188,    69,   201,   135,   204,    95,   221,   222,   117,
   142,    97,    98,   151,   178,    92,    93,    94,   157,   241,
    95,   125,   168,   202,   219,   165,   169,   171,    40,    43,
   195,   209,   211,    63,   225,   212,   117,   167,    43,   239,
   240,   293,   205,   243,   248,   263,   278,   261,    60,    37,
   210,   144,   299,   246,   279,   117,    37,    37,   311,   216,
    71,   296,   312,   123,   123,   242,    63,    63,    63,    63,
    63,    63,    37,   244,    73,   251,    37,   123,   282,     0,
   134,   170,   217,    16,    17,     0,    43,     0,   270,   176,
     0,   187,     0,    20,    21,     0,     0,   192,    57,     0,
   287,    24,   289,     0,     0,    63,     0,   256,    90,    91,
    92,    93,    94,     0,     0,    95,   280,    62,    64,     0,
    67,    68,     0,   303,     0,     0,   306,     0,     0,     0,
   308,     0,   309,    49,     0,     0,     0,     0,     0,    43,
   185,   117,     0,   117,   290,    43,     0,   167,     0,     0,
     0,     0,   136,   138,    67,     0,     0,    49,   167,     0,
   288,   187,     0,     0,   117,     0,   294,   117,     0,     0,
     0,   117,     0,   117,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,   158,   159,   160,
   161,   162,   163,     0,     0,     0,    63,    63,    63,     0,
   187,   187,   187,   187,     0,   187,   187,   187,   187,   187,
     0,     0,   186,     0,     0,   193,     0,     0,     0,     0,
     0,     0,   275,     0,   277,     0,   196,     0,   200,     0,
     0,     0,     0,   187,     0,   187,   187,     0,   187,     0,
   187,   187,   187,   187,     0,   284,    44,    44,     0,   257,
   259,   260,   262,     0,   264,   265,   266,     0,   267,   187,
     0,     0,     0,     0,     0,     0,    44,     0,   298,     0,
     0,   187,     0,   301,   302,     0,     0,   305,     0,     0,
     0,   307,   186,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,   245,     0,     0,   247,     0,   295,     0,
     0,     0,     0,   252,     0,     0,     0,   253,   254,   255,
     0,   186,   186,   186,   186,     0,   186,   186,   186,   186,
   186,   268,     0,   271,   272,   273,   274,     0,     0,     0,
     0,     0,    44,    44,     0,     0,    44,     0,     0,     0,
     0,     0,     0,    44,   186,   191,   186,   186,     0,   186,
     0,   186,   186,   186,   186,     0,     0,     0,     0,     0,
     0,     0,     0,   291,     0,     0,     0,     0,     0,     0,
   186,     0,     0,     0,   297,     0,     0,   300,     0,     0,
     0,     0,   186,   304,     0,     0,     0,     0,     0,     0,
     0,     0,    44,     0,     0,    99,     0,     6,     7,     0,
     8,    44,     0,     9,     0,   191,     0,     0,     0,     0,
     0,     0,   100,     0,   101,   102,   103,   104,   105,   106,
   107,   108,   109,   110,   111,     0,    13,    14,    15,     0,
     0,     0,    16,    17,    18,     0,     0,     0,     0,     0,
    56,   250,    20,    21,     0,     0,     0,    57,     0,    44,
    24,     0,     0,    25,   112,    40,     0,     0,     0,     0,
     0,     0,   177,     0,     6,     7,     0,     8,     0,     0,
     9,     0,     0,     0,     0,     0,   281,     0,     0,   100,
     0,   101,   102,   103,   104,   105,   106,   107,   108,   109,
   110,   111,     0,    13,    14,    15,     0,     0,     0,    16,
    17,    18,    44,     0,     0,     0,   292,    56,    44,    20,
    21,     0,     0,     0,    57,     0,     0,    24,     0,     0,
    25,   112,    40,    99,     0,     6,     7,     0,     8,     0,
     0,     9,     0,     0,     0,     0,     0,     0,     0,     0,
   100,     0,   101,   102,   103,   104,   105,   106,   107,   108,
   109,   110,   111,     0,    13,    14,    15,     0,     0,     0,
    16,    17,    18,     0,   180,     0,     6,     7,    56,     8,
    20,    21,     9,     0,   -78,    57,     0,   -78,    24,     0,
     0,    25,     0,    40,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,   181,    14,    15,     0,     0,
     0,    16,    17,    18,     0,     0,     0,   -78,   -78,   182,
     0,    20,    21,     0,     0,     0,    57,     0,     0,    24,
     6,     7,     0,     8,   -78,     0,     9,    80,     0,     0,
    81,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,    13,
    14,    15,    82,    83,    84,    16,    17,    18,    85,     0,
    86,    87,    88,    56,     0,    20,    21,     0,    -1,    70,
    57,     6,     7,    24,     8,     0,     0,     9,     0,    74,
     0,     0,     0,     0,    10,    11,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,    12,
    13,    14,    15,     0,     0,     0,    16,    17,    18,     0,
     0,     0,     0,     0,    19,     0,    20,    21,     0,    22,
     0,    23,     6,     7,    24,     8,     0,    25,     9,     0,
     0,     0,     0,     0,     0,     0,     0,   100,     0,   101,
   102,   103,   104,   105,   106,   107,   108,   109,   110,   111,
     0,    13,    14,    15,     0,     0,     0,    16,    17,    18,
     0,     0,     0,     6,     7,    56,     8,    20,    21,     9,
    80,     0,    57,    81,     1,    24,     0,     0,    25,     0,
    40,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,    13,    14,    15,    82,    83,    84,    16,    17,
    18,    85,     0,    86,    87,    88,    56,     0,    20,    21,
     0,     0,     0,    57,     0,     0,    24,     6,     7,     0,
     8,    40,     0,     9,    80,     0,     0,    81,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,    13,    14,    15,    82,
    83,    84,    16,    17,    18,    85,     0,    86,    87,    88,
    56,     0,    20,    21,     0,     0,     5,    57,     6,     7,
    24,     8,     0,     0,     9,    40,     0,     0,     0,     0,
     0,    10,    11,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,    12,    13,    14,    15,
     0,     0,     0,    16,    17,    18,     6,     7,     0,     8,
     0,    19,     9,    20,    21,     0,    22,     0,    23,     0,
     0,    24,     0,     7,    25,     8,     0,     0,     0,   226,
     0,     0,-32768,     0,     0,    13,    14,    15,     0,     0,
     0,    16,    17,    18,     0,    55,     0,     6,     7,    56,
     8,    20,    21,     9,   228,     0,    57,    16,    17,    24,
     0,     0,     0,     0,    40,    61,     0,    20,    21,     0,
     0,     0,    57,     0,     0,    24,    13,    14,    15,     0,
     0,     0,    16,    17,    18,     0,    55,     0,     6,     7,
    56,     8,    20,    21,     9,    22,     0,    57,     0,     0,
    24,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,    13,    14,    15,
     0,     0,     0,    16,    17,    18,     0,     0,     0,     0,
     0,    56,   -86,    20,    21,     0,     0,    55,    57,     6,
     7,    24,     8,     0,     0,     9,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     7,     0,     8,     0,
     0,     0,    80,     0,     0,-32768,     0,     0,    13,    14,
    15,     0,     0,     0,    16,    17,    18,     0,   203,     0,
     6,     7,    56,     8,    20,    21,     9,    82,     0,    57,
    16,    17,    24,     0,     0,    86,    87,    88,    56,     0,
    20,    21,     0,     0,     0,    57,     0,     0,    24,    13,
    14,    15,     0,     0,     0,    16,    17,    18,     0,   258,
     0,     6,     7,    56,     8,    20,    21,     9,     0,     0,
    57,     0,     0,    24,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
   181,    14,    15,     0,     0,     0,    16,    17,    18,     0,
     0,     0,     6,     7,    61,     8,    20,    21,     9,    80,
     0,    57,    81,     0,    24,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,    13,    14,    15,    82,    83,    84,    16,    17,    18,
    85,     0,    86,    87,    88,    56,   135,    20,    21,     0,
     6,     7,    57,     8,     0,    24,     9,    80,     0,     0,
    81,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,    13,
    14,    15,    82,    83,    84,    16,    17,    18,    85,   207,
    86,    87,    88,    56,     0,    20,    21,     0,     6,     7,
    57,     8,     0,    24,     9,    80,     0,     0,    81,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,    13,    14,    15,
    82,    83,    84,    16,    17,    18,    85,     0,    86,    87,
    88,    56,     0,    20,    21,     0,     6,     7,    57,     8,
     0,    24,     9,    80,     0,     0,    81,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,    13,    14,    15,    82,    83,
     0,    16,    17,    18,     0,     0,    86,    87,    88,    56,
     0,    20,    21,     0,     6,     7,    57,     8,     0,    24,
     9,   226,     0,     0,   227,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,   181,    14,    15,   228,   229,   230,    16,
    17,    18,   231,   283,     0,     6,     7,    61,     8,    20,
    21,     9,    80,     0,    57,    81,     0,    24,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,    13,    14,    15,    82,     0,     0,
    16,    17,    18,     0,     0,    86,    87,    88,    56,     0,
    20,    21,     0,     6,     7,    57,     8,     0,    24,     9,
   226,     0,     0,   227,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,   181,    14,    15,   228,   229,   230,    16,    17,
    18,   231,     0,     0,     6,     7,    61,     8,    20,    21,
     9,   226,     0,    57,   227,     0,    24,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,   181,    14,    15,   228,   229,     0,    16,
    17,    18,     0,     0,     0,     6,     7,    61,     8,    20,
    21,     9,   226,     0,    57,   227,     0,    24,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,   181,    14,    15,   228,     0,     0,
    16,    17,    18,     6,     7,     0,     8,     0,    61,     9,
    20,    21,     0,     0,     0,    57,     0,     0,    24,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,    13,    14,    15,     0,     0,     0,    16,    17,
    18,     6,     7,     0,     8,     0,    56,     9,    20,    21,
     0,    22,     0,    57,     0,     0,    24,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    13,    14,    15,     0,     0,     0,    16,    17,    18,     6,
     7,     0,     8,     0,    19,     9,    20,    21,     0,    22,
     0,    23,     0,     0,    24,     0,     0,     0,     0,     0,
     6,     7,     0,     8,     0,     0,     9,     0,   181,    14,
    15,     0,     0,     0,    16,    17,    18,     0,     0,     0,
     0,     0,    61,     0,    20,    21,     0,    22,     0,    57,
    14,    15,    24,     0,     0,    16,    17,    18,     6,     7,
     0,     8,     0,    61,     9,    20,    21,     0,    22,     0,
    57,     0,     0,    24,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,    13,    14,    15,
     0,     0,     0,    16,    17,    18,     6,   214,     0,     8,
     0,    56,     9,    20,    21,     0,     0,     0,    57,     0,
     0,    24,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,    13,    14,    15,     0,     0,
     0,    16,    17,    18,     6,     7,     0,     8,     0,    56,
     9,    20,    21,     0,     0,     0,    57,     0,     0,    24,
     0,     0,     0,     0,     0,     6,     7,     0,     8,     0,
     0,     9,     0,   181,    14,    15,     0,     0,     0,    16,
    17,    18,     7,     0,     8,     0,     0,    61,-32768,    20,
    21,     0,     0,     0,    57,    14,    15,    24,     0,     0,
    16,    17,    18,     0,     0,     0,     0,     0,    61,     0,
    20,    21,     0,    82,     0,    57,    16,    17,    24,     0,
     0,-32768,-32768,-32768,    56,     0,    20,    21,     0,     0,
     7,    57,     8,     0,    24,     0,-32768,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,   228,     0,     0,    16,    17,     0,     0,     0,     0,
     0,     0,    61,     0,    20,    21,     0,     0,     0,    57,
     0,     0,    24
};

static const short yycheck[] = {     3,
    50,   111,   113,    10,    11,     1,     1,     4,    14,    29,
    38,    39,   157,    14,    14,    19,     1,    10,    11,     4,
    73,    35,    26,    30,     1,    11,    54,     1,    46,     1,
    14,    81,   143,    37,    38,    39,   181,    30,     1,    11,
     1,     4,    14,    57,    30,    75,    50,    51,    78,    79,
    54,    47,    56,    59,    19,    61,    46,    61,    23,    56,
    61,   171,    47,    58,    46,   118,    62,    62,   113,    73,
    47,    75,    44,    45,    78,    79,    80,    81,   189,    83,
    84,    85,    86,    87,    58,    62,    47,    57,    62,    61,
    62,    12,    96,    36,    37,     3,     4,   101,   143,   106,
   107,    62,    46,   110,    11,    38,    39,   111,    59,   113,
   117,   131,   132,   133,   118,    12,    62,    38,    39,    13,
   106,   107,    16,    17,   110,   170,    20,    21,    43,    23,
    24,   117,    25,   137,    47,   139,    55,    44,    45,   143,
     5,    38,    39,     4,   189,    50,    51,    52,    32,   199,
    55,    44,     4,    35,   182,    46,    46,    46,    61,   166,
    46,   165,    57,    57,   184,   169,   170,   171,   175,   197,
   198,   281,    51,     4,    22,     4,    46,   227,   182,     3,
   166,    74,   292,   211,     4,   189,    10,    11,     0,   175,
    26,    19,     0,   197,   198,   199,    90,    91,    92,    93,
    94,    95,    26,   207,    28,   218,    30,   211,   252,    -1,
    54,   104,   179,    38,    39,    -1,   223,    -1,   238,   112,
    -1,   115,    -1,    48,    49,    -1,    -1,   120,    53,    -1,
   275,    56,   277,    -1,    -1,   129,    -1,   223,    48,    49,
    50,    51,    52,    -1,    -1,    55,   250,    20,    21,    -1,
    23,    24,    -1,   298,    -1,    -1,   301,    -1,    -1,    -1,
   305,    -1,   307,   157,    -1,    -1,    -1,    -1,    -1,   276,
   115,   275,    -1,   277,   278,   282,    -1,   281,    -1,    -1,
    -1,    -1,    58,    59,    57,    -1,    -1,   181,   292,    -1,
   276,   185,    -1,    -1,   298,    -1,   282,   301,    -1,    -1,
    -1,   305,    -1,   307,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    90,    91,    92,
    93,    94,    95,    -1,    -1,    -1,   220,   221,   222,    -1,
   224,   225,   226,   227,    -1,   229,   230,   231,   232,   233,
    -1,    -1,   115,    -1,    -1,   121,    -1,    -1,    -1,    -1,
    -1,    -1,   245,    -1,   247,    -1,   129,    -1,   134,    -1,
    -1,    -1,    -1,   257,    -1,   259,   260,    -1,   262,    -1,
   264,   265,   266,   267,    -1,   268,    10,    11,    -1,   224,
   225,   226,   227,    -1,   229,   230,   231,    -1,   233,   283,
    -1,    -1,    -1,    -1,    -1,    -1,    30,    -1,   291,    -1,
    -1,   295,    -1,   296,   297,    -1,    -1,   300,    -1,    -1,
    -1,   304,   185,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,   209,    -1,    -1,   212,    -1,   283,    -1,
    -1,    -1,    -1,   219,    -1,    -1,    -1,   220,   221,   222,
    -1,   224,   225,   226,   227,    -1,   229,   230,   231,   232,
   233,   237,    -1,   239,   240,   241,   242,    -1,    -1,    -1,
    -1,    -1,   106,   107,    -1,    -1,   110,    -1,    -1,    -1,
    -1,    -1,    -1,   117,   257,   119,   259,   260,    -1,   262,
    -1,   264,   265,   266,   267,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,   279,    -1,    -1,    -1,    -1,    -1,    -1,
   283,    -1,    -1,    -1,   290,    -1,    -1,   293,    -1,    -1,
    -1,    -1,   295,   299,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,   166,    -1,    -1,     1,    -1,     3,     4,    -1,
     6,   175,    -1,     9,    -1,   179,    -1,    -1,    -1,    -1,
    -1,    -1,    18,    -1,    20,    21,    22,    23,    24,    25,
    26,    27,    28,    29,    30,    -1,    32,    33,    34,    -1,
    -1,    -1,    38,    39,    40,    -1,    -1,    -1,    -1,    -1,
    46,   215,    48,    49,    -1,    -1,    -1,    53,    -1,   223,
    56,    -1,    -1,    59,    60,    61,    -1,    -1,    -1,    -1,
    -1,    -1,     1,    -1,     3,     4,    -1,     6,    -1,    -1,
     9,    -1,    -1,    -1,    -1,    -1,   250,    -1,    -1,    18,
    -1,    20,    21,    22,    23,    24,    25,    26,    27,    28,
    29,    30,    -1,    32,    33,    34,    -1,    -1,    -1,    38,
    39,    40,   276,    -1,    -1,    -1,   280,    46,   282,    48,
    49,    -1,    -1,    -1,    53,    -1,    -1,    56,    -1,    -1,
    59,    60,    61,     1,    -1,     3,     4,    -1,     6,    -1,
    -1,     9,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    18,    -1,    20,    21,    22,    23,    24,    25,    26,    27,
    28,    29,    30,    -1,    32,    33,    34,    -1,    -1,    -1,
    38,    39,    40,    -1,     1,    -1,     3,     4,    46,     6,
    48,    49,     9,    -1,    11,    53,    -1,    14,    56,    -1,
    -1,    59,    -1,    61,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    32,    33,    34,    -1,    -1,
    -1,    38,    39,    40,    -1,    -1,    -1,    44,    45,    46,
    -1,    48,    49,    -1,    -1,    -1,    53,    -1,    -1,    56,
     3,     4,    -1,     6,    61,    -1,     9,    10,    -1,    -1,
    13,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    32,
    33,    34,    35,    36,    37,    38,    39,    40,    41,    -1,
    43,    44,    45,    46,    -1,    48,    49,    -1,     0,     1,
    53,     3,     4,    56,     6,    -1,    -1,     9,    -1,    62,
    -1,    -1,    -1,    -1,    16,    17,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    31,
    32,    33,    34,    -1,    -1,    -1,    38,    39,    40,    -1,
    -1,    -1,    -1,    -1,    46,    -1,    48,    49,    -1,    51,
    -1,    53,     3,     4,    56,     6,    -1,    59,     9,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    18,    -1,    20,
    21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
    -1,    32,    33,    34,    -1,    -1,    -1,    38,    39,    40,
    -1,    -1,    -1,     3,     4,    46,     6,    48,    49,     9,
    10,    -1,    53,    13,    14,    56,    -1,    -1,    59,    -1,
    61,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    32,    33,    34,    35,    36,    37,    38,    39,
    40,    41,    -1,    43,    44,    45,    46,    -1,    48,    49,
    -1,    -1,    -1,    53,    -1,    -1,    56,     3,     4,    -1,
     6,    61,    -1,     9,    10,    -1,    -1,    13,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    32,    33,    34,    35,
    36,    37,    38,    39,    40,    41,    -1,    43,    44,    45,
    46,    -1,    48,    49,    -1,    -1,     1,    53,     3,     4,
    56,     6,    -1,    -1,     9,    61,    -1,    -1,    -1,    -1,
    -1,    16,    17,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    31,    32,    33,    34,
    -1,    -1,    -1,    38,    39,    40,     3,     4,    -1,     6,
    -1,    46,     9,    48,    49,    -1,    51,    -1,    53,    -1,
    -1,    56,    -1,     4,    59,     6,    -1,    -1,    -1,    10,
    -1,    -1,    13,    -1,    -1,    32,    33,    34,    -1,    -1,
    -1,    38,    39,    40,    -1,     1,    -1,     3,     4,    46,
     6,    48,    49,     9,    35,    -1,    53,    38,    39,    56,
    -1,    -1,    -1,    -1,    61,    46,    -1,    48,    49,    -1,
    -1,    -1,    53,    -1,    -1,    56,    32,    33,    34,    -1,
    -1,    -1,    38,    39,    40,    -1,     1,    -1,     3,     4,
    46,     6,    48,    49,     9,    51,    -1,    53,    -1,    -1,
    56,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    32,    33,    34,
    -1,    -1,    -1,    38,    39,    40,    -1,    -1,    -1,    -1,
    -1,    46,    47,    48,    49,    -1,    -1,     1,    53,     3,
     4,    56,     6,    -1,    -1,     9,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,     4,    -1,     6,    -1,
    -1,    -1,    10,    -1,    -1,    13,    -1,    -1,    32,    33,
    34,    -1,    -1,    -1,    38,    39,    40,    -1,     1,    -1,
     3,     4,    46,     6,    48,    49,     9,    35,    -1,    53,
    38,    39,    56,    -1,    -1,    43,    44,    45,    46,    -1,
    48,    49,    -1,    -1,    -1,    53,    -1,    -1,    56,    32,
    33,    34,    -1,    -1,    -1,    38,    39,    40,    -1,     1,
    -1,     3,     4,    46,     6,    48,    49,     9,    -1,    -1,
    53,    -1,    -1,    56,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    32,    33,    34,    -1,    -1,    -1,    38,    39,    40,    -1,
    -1,    -1,     3,     4,    46,     6,    48,    49,     9,    10,
    -1,    53,    13,    -1,    56,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    32,    33,    34,    35,    36,    37,    38,    39,    40,
    41,    -1,    43,    44,    45,    46,    47,    48,    49,    -1,
     3,     4,    53,     6,    -1,    56,     9,    10,    -1,    -1,
    13,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    32,
    33,    34,    35,    36,    37,    38,    39,    40,    41,    42,
    43,    44,    45,    46,    -1,    48,    49,    -1,     3,     4,
    53,     6,    -1,    56,     9,    10,    -1,    -1,    13,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    32,    33,    34,
    35,    36,    37,    38,    39,    40,    41,    -1,    43,    44,
    45,    46,    -1,    48,    49,    -1,     3,     4,    53,     6,
    -1,    56,     9,    10,    -1,    -1,    13,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    32,    33,    34,    35,    36,
    -1,    38,    39,    40,    -1,    -1,    43,    44,    45,    46,
    -1,    48,    49,    -1,     3,     4,    53,     6,    -1,    56,
     9,    10,    -1,    -1,    13,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    32,    33,    34,    35,    36,    37,    38,
    39,    40,    41,    42,    -1,     3,     4,    46,     6,    48,
    49,     9,    10,    -1,    53,    13,    -1,    56,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    32,    33,    34,    35,    -1,    -1,
    38,    39,    40,    -1,    -1,    43,    44,    45,    46,    -1,
    48,    49,    -1,     3,     4,    53,     6,    -1,    56,     9,
    10,    -1,    -1,    13,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    32,    33,    34,    35,    36,    37,    38,    39,
    40,    41,    -1,    -1,     3,     4,    46,     6,    48,    49,
     9,    10,    -1,    53,    13,    -1,    56,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    32,    33,    34,    35,    36,    -1,    38,
    39,    40,    -1,    -1,    -1,     3,     4,    46,     6,    48,
    49,     9,    10,    -1,    53,    13,    -1,    56,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    32,    33,    34,    35,    -1,    -1,
    38,    39,    40,     3,     4,    -1,     6,    -1,    46,     9,
    48,    49,    -1,    -1,    -1,    53,    -1,    -1,    56,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    32,    33,    34,    -1,    -1,    -1,    38,    39,
    40,     3,     4,    -1,     6,    -1,    46,     9,    48,    49,
    -1,    51,    -1,    53,    -1,    -1,    56,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    32,    33,    34,    -1,    -1,    -1,    38,    39,    40,     3,
     4,    -1,     6,    -1,    46,     9,    48,    49,    -1,    51,
    -1,    53,    -1,    -1,    56,    -1,    -1,    -1,    -1,    -1,
     3,     4,    -1,     6,    -1,    -1,     9,    -1,    32,    33,
    34,    -1,    -1,    -1,    38,    39,    40,    -1,    -1,    -1,
    -1,    -1,    46,    -1,    48,    49,    -1,    51,    -1,    53,
    33,    34,    56,    -1,    -1,    38,    39,    40,     3,     4,
    -1,     6,    -1,    46,     9,    48,    49,    -1,    51,    -1,
    53,    -1,    -1,    56,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    32,    33,    34,
    -1,    -1,    -1,    38,    39,    40,     3,     4,    -1,     6,
    -1,    46,     9,    48,    49,    -1,    -1,    -1,    53,    -1,
    -1,    56,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    32,    33,    34,    -1,    -1,
    -1,    38,    39,    40,     3,     4,    -1,     6,    -1,    46,
     9,    48,    49,    -1,    -1,    -1,    53,    -1,    -1,    56,
    -1,    -1,    -1,    -1,    -1,     3,     4,    -1,     6,    -1,
    -1,     9,    -1,    32,    33,    34,    -1,    -1,    -1,    38,
    39,    40,     4,    -1,     6,    -1,    -1,    46,    10,    48,
    49,    -1,    -1,    -1,    53,    33,    34,    56,    -1,    -1,
    38,    39,    40,    -1,    -1,    -1,    -1,    -1,    46,    -1,
    48,    49,    -1,    35,    -1,    53,    38,    39,    56,    -1,
    -1,    43,    44,    45,    46,    -1,    48,    49,    -1,    -1,
     4,    53,     6,    -1,    56,    -1,    10,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
    -1,    35,    -1,    -1,    38,    39,    -1,    -1,    -1,    -1,
    -1,    -1,    46,    -1,    48,    49,    -1,    -1,    -1,    53,
    -1,    -1,    56
};
#define YYPURE 1

/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
#line 3 "bison.simple"

/* Skeleton output parser for bison,
   Copyright (C) 1984 Bob Corbett and Richard Stallman

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 1, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */


#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__)
#include <alloca.h>
#endif

/* This is the parser code that is written into each bison parser
  when the %semantic_parser declaration is not specified in the grammar.
  It was written by Richard Stallman by simplifying the hairy parser
  used when %semantic_parser is specified.  */

/* Note: there must be only one dollar sign in this file.
   It is replaced by the list of actions, each action
   as one case of the switch.  */

#ifndef BSD
#define bcopy(s,d,l) memcpy(d,s,l)
#endif

#define yyerrok		(yyerrstatus = 0)
#define yyclearin	(yychar = YYEMPTY)
#define YYEMPTY		-2
#define YYEOF		0
#define YYFAIL		goto yyerrlab;
#define YYACCEPT	return(0)
#define YYABORT 	return(1)
#define YYERROR		goto yyerrlab

#define YYTERROR	1

#ifndef YYIMPURE
#define YYLEX		yylex()
#endif

#ifndef YYPURE
#define YYLEX		yylex(&yylval, &yylloc)
#endif

/* If nonreentrant, generate the variables here */

#ifndef YYIMPURE

int	yychar;			/*  the lookahead symbol		*/
YYSTYPE	yylval;			/*  the semantic value of the		*/
				/*  lookahead symbol			*/

YYLTYPE yylloc;			/*  location data for the lookahead	*/
				/*  symbol				*/

int yynerrs;			/*  number of parse errors so far       */
#endif  /* YYIMPURE */

#if YYDEBUG != 0
int yydebug;			/*  nonzero means print parse trace	*/
/* Since this is uninitialized, it does not stop multiple parsers
   from coexisting.  */
#endif

/*  YYMAXDEPTH indicates the initial size of the parser's stacks	*/

#ifndef	YYMAXDEPTH
#define YYMAXDEPTH 200
#endif

/*  YYMAXLIMIT is the maximum size the stacks can grow to
    (effective only if the built-in stack extension method is used).  */

#ifndef YYMAXLIMIT
#define YYMAXLIMIT 10000
#endif


#line 175 "bison.simple"
int
yyparse()
{
  register int yystate;
  register int yyn;
  register short *yyssp;
  register YYSTYPE *yyvsp;
  YYLTYPE *yylsp;
  int yyerrstatus;	/*  number of tokens to shift before error messages enabled */
  int yychar1;		/*  lookahead token as an internal (translated) token number */

  short	yyssa[YYMAXDEPTH];	/*  the state stack			*/
  YYSTYPE yyvsa[YYMAXDEPTH];	/*  the semantic value stack		*/
  YYLTYPE yylsa[YYMAXDEPTH];	/*  the location stack			*/

  short *yyss = yyssa;		/*  refer to the stacks thru separate pointers */
  YYSTYPE *yyvs = yyvsa;	/*  to allow yyoverflow to reallocate them elsewhere */
  YYLTYPE *yyls = yylsa;

  int yymaxdepth = YYMAXDEPTH;

#ifndef YYPURE
  int yychar;
  YYSTYPE yylval;
  YYLTYPE yylloc;
  int yynerrs;
#endif

  YYSTYPE yyval;		/*  the variable used to return		*/
				/*  semantic values from the action	*/
				/*  routines				*/

  int yylen;

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Starting parse\n");
#endif

  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = YYEMPTY;		/* Cause a token to be read.  */

  /* Initialize stack pointers.
     Waste one element of value and location stack
     so that they stay on the same level as the state stack.  */

  yyssp = yyss - 1;
  yyvsp = yyvs;
  yylsp = yyls;

/* Push a new state, which is found in  yystate  .  */
/* In all cases, when you get here, the value and location stacks
   have just been pushed. so pushing a state here evens the stacks.  */
yynewstate:

  *++yyssp = yystate;

  if (yyssp >= yyss + yymaxdepth - 1)
    {
      /* Give user a chance to reallocate the stack */
      /* Use copies of these so that the &'s don't force the real ones into memory. */
      YYSTYPE *yyvs1 = yyvs;
      YYLTYPE *yyls1 = yyls;
      short *yyss1 = yyss;

      /* Get the current used size of the three stacks, in elements.  */
      int size = yyssp - yyss + 1;

#ifdef yyoverflow
      /* Each stack pointer address is followed by the size of
	 the data in use in that stack, in bytes.  */
      yyoverflow("parser stack overflow",
		 &yyss1, size * sizeof (*yyssp),
		 &yyvs1, size * sizeof (*yyvsp),
		 &yyls1, size * sizeof (*yylsp),
		 &yymaxdepth);

      yyss = yyss1; yyvs = yyvs1; yyls = yyls1;
#else /* no yyoverflow */
      /* Extend the stack our own way.  */
      if (yymaxdepth >= YYMAXLIMIT)
	yyerror("parser stack overflow");
      yymaxdepth *= 2;
      if (yymaxdepth > YYMAXLIMIT)
	yymaxdepth = YYMAXLIMIT;
      yyss = (short *) alloca (yymaxdepth * sizeof (*yyssp));
      bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
      yyvs = (YYSTYPE *) alloca (yymaxdepth * sizeof (*yyvsp));
      bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
#ifdef YYLSP_NEEDED
      yyls = (YYLTYPE *) alloca (yymaxdepth * sizeof (*yylsp));
      bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
#endif
#endif /* no yyoverflow */

      yyssp = yyss + size - 1;
      yyvsp = yyvs + size - 1;
#ifdef YYLSP_NEEDED
      yylsp = yyls + size - 1;
#endif

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Stack size increased to %d\n", yymaxdepth);
#endif

      if (yyssp >= yyss + yymaxdepth - 1)
	YYABORT;
    }

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Entering state %d\n", yystate);
#endif

/* Do appropriate processing given the current state.  */
/* Read a lookahead token if we need one and don't already have one.  */
yyresume:

  /* First try to decide what to do without reference to lookahead token.  */

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* yychar is either YYEMPTY or YYEOF
     or a valid token in external form.  */

  if (yychar == YYEMPTY)
    {
#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Reading a token: ");
#endif
      yychar = YYLEX;
    }

  /* Convert token to internal form (in yychar1) for indexing tables with */

  if (yychar <= 0)		/* This means end of input. */
    {
      yychar1 = 0;
      yychar = YYEOF;		/* Don't call YYLEX any more */

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Now at end of input.\n");
#endif
    }
  else
    {
      yychar1 = YYTRANSLATE(yychar);

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Next token is %d (%s)\n", yychar, yytname[yychar1]);
#endif
    }

  yyn += yychar1;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
    goto yydefault;

  yyn = yytable[yyn];

  /* yyn is what to do for this token type in this state.
     Negative => reduce, -yyn is rule number.
     Positive => shift, yyn is new state.
       New state is final state => don't bother to shift,
       just return success.
     0, or most negative number => error.  */

  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrlab;

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
#endif

  /* Discard the token being shifted unless it is eof.  */
  if (yychar != YYEOF)
    yychar = YYEMPTY;

  *++yyvsp = yylval;
#ifdef YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  /* count tokens shifted since error; after three, turn off error status.  */
  if (yyerrstatus) yyerrstatus--;

  yystate = yyn;
  goto yynewstate;

/* Do the default action for the current state.  */
yydefault:

  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;

/* Do a reduction.  yyn is the number of a rule to reduce with.  */
yyreduce:
  yylen = yyr2[yyn];
  yyval = yyvsp[1-yylen]; /* implement default value of the action */

#if YYDEBUG != 0
  if (yydebug)
    {
      if (yylen == 1)
	fprintf (stderr, "Reducing 1 value via line %d, ",
		 yyrline[yyn]);
      else
	fprintf (stderr, "Reducing %d values via line %d, ",
		 yylen, yyrline[yyn]);
    }
#endif


  switch (yyn) {

case 1:
#line 301 "awk.y"
{ expression_value = yyvsp[0].nodeval; ;
    break;}
case 2:
#line 306 "awk.y"
{ 
			if (yyvsp[0].nodeval != NULL)
				yyval.nodeval = yyvsp[0].nodeval;
			else
				yyval.nodeval = NULL;
			yyerrok;
		;
    break;}
case 3:
#line 315 "awk.y"
{
			if (yyvsp[0].nodeval == NULL)
				yyval.nodeval = yyvsp[-1].nodeval;
			else if (yyvsp[-1].nodeval == NULL)
				yyval.nodeval = yyvsp[0].nodeval;
			else {
				if (yyvsp[-1].nodeval->type != Node_rule_list)
					yyvsp[-1].nodeval = node(yyvsp[-1].nodeval, Node_rule_list,
						(NODE*)NULL);
				yyval.nodeval = append_right (yyvsp[-1].nodeval,
				   node(yyvsp[0].nodeval, Node_rule_list,(NODE *) NULL));
			}
			yyerrok;
		;
    break;}
case 4:
#line 329 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 5:
#line 330 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 6:
#line 335 "awk.y"
{
		if (begin_block) {
			if (begin_block->type != Node_rule_list)
				begin_block = node(begin_block, Node_rule_list,
					(NODE *)NULL);
			append_right (begin_block, node(
			    node((NODE *)NULL, Node_rule_node, yyvsp[0].nodeval),
			    Node_rule_list, (NODE *)NULL) );
		} else
			begin_block = node((NODE *)NULL, Node_rule_node, yyvsp[0].nodeval);
		yyval.nodeval = NULL;
		yyerrok;
	  ;
    break;}
case 7:
#line 349 "awk.y"
{
		if (end_block) {
			if (end_block->type != Node_rule_list)
				end_block = node(end_block, Node_rule_list,
					(NODE *)NULL);
			append_right (end_block, node(
			    node((NODE *)NULL, Node_rule_node, yyvsp[0].nodeval),
			    Node_rule_list, (NODE *)NULL));
		} else
			end_block = node((NODE *)NULL, Node_rule_node, yyvsp[0].nodeval);
		yyval.nodeval = NULL;
		yyerrok;
	  ;
    break;}
case 8:
#line 363 "awk.y"
{
		msg ("error near line %d: BEGIN blocks must have an action part", lineno);
		errcount++;
		yyerrok;
	  ;
    break;}
case 9:
#line 369 "awk.y"
{
		msg ("error near line %d: END blocks must have an action part", lineno);
		errcount++;
		yyerrok;
	  ;
    break;}
case 10:
#line 375 "awk.y"
{ yyval.nodeval = node (yyvsp[-1].nodeval, Node_rule_node, yyvsp[0].nodeval); yyerrok; ;
    break;}
case 11:
#line 377 "awk.y"
{ yyval.nodeval = node ((NODE *)NULL, Node_rule_node, yyvsp[0].nodeval); yyerrok; ;
    break;}
case 12:
#line 379 "awk.y"
{ if(yyvsp[-1].nodeval) yyval.nodeval = node (yyvsp[-1].nodeval, Node_rule_node, (NODE *)NULL); yyerrok; ;
    break;}
case 13:
#line 381 "awk.y"
{
			func_install(yyvsp[-1].nodeval, yyvsp[0].nodeval);
			yyval.nodeval = NULL;
			yyerrok;
		;
    break;}
case 14:
#line 390 "awk.y"
{ yyval.sval = yyvsp[0].sval; ;
    break;}
case 15:
#line 392 "awk.y"
{ yyval.sval = yyvsp[0].sval; ;
    break;}
case 16:
#line 397 "awk.y"
{
			param_counter = 0;
		;
    break;}
case 17:
#line 401 "awk.y"
{
			yyval.nodeval = append_right(make_param(yyvsp[-4].sval), yyvsp[-2].nodeval);
		;
    break;}
case 18:
#line 408 "awk.y"
{ yyval.nodeval = yyvsp[-1].nodeval; ;
    break;}
case 19:
#line 414 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
    break;}
case 20:
#line 416 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
    break;}
case 21:
#line 418 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_and, yyvsp[0].nodeval); ;
    break;}
case 22:
#line 420 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_or, yyvsp[0].nodeval); ;
    break;}
case 23:
#line 422 "awk.y"
{ yyval.nodeval = node (yyvsp[0].nodeval, Node_not,(NODE *) NULL); ;
    break;}
case 24:
#line 424 "awk.y"
{ yyval.nodeval = yyvsp[-1].nodeval; ;
    break;}
case 25:
#line 429 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
    break;}
case 26:
#line 431 "awk.y"
{ yyval.nodeval = mkrangenode ( node(yyvsp[-2].nodeval, Node_cond_pair, yyvsp[0].nodeval) ); ;
    break;}
case 27:
#line 436 "awk.y"
{ 
		  yyval.nodeval = node(
		       node(make_number((AWKNUM)0),Node_field_spec,(NODE*)NULL),
		       Node_match, yyvsp[0].nodeval);
		;
    break;}
case 28:
#line 449 "awk.y"
{ ++want_regexp; ;
    break;}
case 29:
#line 451 "awk.y"
{
		  want_regexp = 0;
		  yyval.nodeval = node((NODE *)NULL,Node_regex,(NODE *)mk_re_parse(yyvsp[-1].sval, 0));
		  yyval.nodeval -> re_case = 0;
		  emalloc (yyval.nodeval -> re_text, char *, strlen(yyvsp[-1].sval)+1, "regexp");
		  strcpy (yyval.nodeval -> re_text, yyvsp[-1].sval);
		;
    break;}
case 30:
#line 462 "awk.y"
{
			/* empty actions are different from missing actions */
			yyval.nodeval = node ((NODE *) NULL, Node_illegal, (NODE *) NULL);
		;
    break;}
case 31:
#line 467 "awk.y"
{ yyval.nodeval = yyvsp[-2].nodeval ; ;
    break;}
case 32:
#line 472 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
    break;}
case 33:
#line 474 "awk.y"
{
			if (yyvsp[-1].nodeval->type != Node_statement_list)
				yyvsp[-1].nodeval = node(yyvsp[-1].nodeval, Node_statement_list,(NODE *)NULL);
	    		yyval.nodeval = append_right(yyvsp[-1].nodeval,
				node( yyvsp[0].nodeval, Node_statement_list, (NODE *)NULL));
	    		yyerrok;
		;
    break;}
case 34:
#line 482 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 35:
#line 484 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 36:
#line 489 "awk.y"
{ yyval.nodetypeval = Node_illegal; ;
    break;}
case 37:
#line 491 "awk.y"
{ yyval.nodetypeval = Node_illegal; ;
    break;}
case 38:
#line 497 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 39:
#line 499 "awk.y"
{ yyval.nodeval = yyvsp[-1].nodeval; ;
    break;}
case 40:
#line 501 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
    break;}
case 41:
#line 503 "awk.y"
{ yyval.nodeval = node (yyvsp[-3].nodeval, Node_K_while, yyvsp[0].nodeval); ;
    break;}
case 42:
#line 505 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_K_do, yyvsp[-5].nodeval); ;
    break;}
case 43:
#line 507 "awk.y"
{
		yyval.nodeval = node (yyvsp[0].nodeval, Node_K_arrayfor, make_for_loop(variable(yyvsp[-5].sval),
			(NODE *)NULL, variable(yyvsp[-3].sval)));
	  ;
    break;}
case 44:
#line 512 "awk.y"
{
		yyval.nodeval = node(yyvsp[0].nodeval, Node_K_for, (NODE *)make_for_loop(yyvsp[-7].nodeval, yyvsp[-5].nodeval, yyvsp[-3].nodeval));
	  ;
    break;}
case 45:
#line 516 "awk.y"
{
		yyval.nodeval = node (yyvsp[0].nodeval, Node_K_for,
			(NODE *)make_for_loop(yyvsp[-6].nodeval, (NODE *)NULL, yyvsp[-3].nodeval));
	  ;
    break;}
case 46:
#line 522 "awk.y"
{ yyval.nodeval = node ((NODE *)NULL, Node_K_break, (NODE *)NULL); ;
    break;}
case 47:
#line 525 "awk.y"
{ yyval.nodeval = node ((NODE *)NULL, Node_K_continue, (NODE *)NULL); ;
    break;}
case 48:
#line 527 "awk.y"
{ yyval.nodeval = node (yyvsp[-3].nodeval, yyvsp[-5].nodetypeval, yyvsp[-1].nodeval); ;
    break;}
case 49:
#line 529 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, yyvsp[-3].nodetypeval, yyvsp[-1].nodeval); ;
    break;}
case 50:
#line 531 "awk.y"
{ yyval.nodeval = node ((NODE *)NULL, Node_K_next, (NODE *)NULL); ;
    break;}
case 51:
#line 533 "awk.y"
{ yyval.nodeval = node (yyvsp[-1].nodeval, Node_K_exit, (NODE *)NULL); ;
    break;}
case 52:
#line 535 "awk.y"
{ yyval.nodeval = node (yyvsp[-1].nodeval, Node_K_return, (NODE *)NULL); ;
    break;}
case 53:
#line 537 "awk.y"
{ yyval.nodeval = node (variable(yyvsp[-4].sval), Node_K_delete, yyvsp[-2].nodeval); ;
    break;}
case 54:
#line 539 "awk.y"
{ yyval.nodeval = yyvsp[-1].nodeval; ;
    break;}
case 55:
#line 544 "awk.y"
{ yyval.nodetypeval = yyvsp[0].nodetypeval; ;
    break;}
case 56:
#line 546 "awk.y"
{ yyval.nodetypeval = yyvsp[0].nodetypeval; ;
    break;}
case 57:
#line 551 "awk.y"
{
		yyval.nodeval = node(yyvsp[-3].nodeval, Node_K_if, 
			node(yyvsp[0].nodeval, Node_if_branches, (NODE *)NULL));
	  ;
    break;}
case 58:
#line 557 "awk.y"
{ yyval.nodeval = node (yyvsp[-6].nodeval, Node_K_if,
				node (yyvsp[-3].nodeval, Node_if_branches, yyvsp[0].nodeval)); ;
    break;}
case 59:
#line 563 "awk.y"
{ yyval.nodetypeval = NULL; ;
    break;}
case 60:
#line 565 "awk.y"
{ yyval.nodetypeval = NULL; ;
    break;}
case 61:
#line 570 "awk.y"
{ yyval.nodetypeval = NULL; ;
    break;}
case 62:
#line 572 "awk.y"
{ yyval.nodetypeval = NULL; ;
    break;}
case 63:
#line 577 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 64:
#line 579 "awk.y"
{ yyval.nodeval = node (yyvsp[0].nodeval, Node_redirect_input, (NODE *)NULL); ;
    break;}
case 65:
#line 584 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 66:
#line 586 "awk.y"
{ yyval.nodeval = node (yyvsp[0].nodeval, Node_redirect_output, (NODE *)NULL); ;
    break;}
case 67:
#line 588 "awk.y"
{ yyval.nodeval = node (yyvsp[0].nodeval, Node_redirect_append, (NODE *)NULL); ;
    break;}
case 68:
#line 590 "awk.y"
{ yyval.nodeval = node (yyvsp[0].nodeval, Node_redirect_pipe, (NODE *)NULL); ;
    break;}
case 69:
#line 595 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 70:
#line 597 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
    break;}
case 71:
#line 602 "awk.y"
{ yyval.nodeval = make_param(yyvsp[0].sval); ;
    break;}
case 72:
#line 604 "awk.y"
{ yyval.nodeval = append_right(yyvsp[-2].nodeval, make_param(yyvsp[0].sval)); yyerrok; ;
    break;}
case 73:
#line 606 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 74:
#line 608 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 75:
#line 610 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 76:
#line 616 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 77:
#line 618 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
    break;}
case 78:
#line 623 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 79:
#line 625 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
    break;}
case 80:
#line 630 "awk.y"
{ yyval.nodeval = node (yyvsp[0].nodeval, Node_expression_list, (NODE *)NULL); ;
    break;}
case 81:
#line 632 "awk.y"
{
		yyval.nodeval = append_right(yyvsp[-2].nodeval,
			node( yyvsp[0].nodeval, Node_expression_list, (NODE *)NULL));
		yyerrok;
	  ;
    break;}
case 82:
#line 638 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 83:
#line 640 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 84:
#line 642 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 85:
#line 644 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 86:
#line 649 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 87:
#line 651 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
    break;}
case 88:
#line 656 "awk.y"
{ yyval.nodeval = node (yyvsp[0].nodeval, Node_expression_list, (NODE *)NULL); ;
    break;}
case 89:
#line 658 "awk.y"
{
			yyval.nodeval = append_right(yyvsp[-2].nodeval,
				node( yyvsp[0].nodeval, Node_expression_list, (NODE *)NULL));
			yyerrok;
		;
    break;}
case 90:
#line 664 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 91:
#line 666 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 92:
#line 668 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 93:
#line 670 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 94:
#line 675 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, yyvsp[0].nodeval); ;
    break;}
case 95:
#line 677 "awk.y"
{ yyval.nodeval = node (variable(yyvsp[0].sval), Node_in_array, yyvsp[-3].nodeval); ;
    break;}
case 96:
#line 679 "awk.y"
{
		  yyval.nodeval = node (yyvsp[0].nodeval, Node_K_getline,
			 node (yyvsp[-3].nodeval, Node_redirect_pipein, (NODE *)NULL));
		;
    break;}
case 97:
#line 684 "awk.y"
{
		  yyval.nodeval = node (yyvsp[-1].nodeval, Node_K_getline, yyvsp[0].nodeval);
		;
    break;}
case 98:
#line 688 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_and, yyvsp[0].nodeval); ;
    break;}
case 99:
#line 690 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_or, yyvsp[0].nodeval); ;
    break;}
case 100:
#line 692 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, yyvsp[0].nodeval); ;
    break;}
case 101:
#line 694 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, yyvsp[0].nodeval); ;
    break;}
case 102:
#line 696 "awk.y"
{ yyval.nodeval = node (variable(yyvsp[0].sval), Node_in_array, yyvsp[-2].nodeval); ;
    break;}
case 103:
#line 698 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, yyvsp[0].nodeval); ;
    break;}
case 104:
#line 700 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_less, yyvsp[0].nodeval); ;
    break;}
case 105:
#line 702 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_greater, yyvsp[0].nodeval); ;
    break;}
case 106:
#line 704 "awk.y"
{ yyval.nodeval = node(yyvsp[-4].nodeval, Node_cond_exp, node(yyvsp[-2].nodeval, Node_if_branches, yyvsp[0].nodeval));;
    break;}
case 107:
#line 706 "awk.y"
{ yyval.nodeval = node (yyvsp[-1].nodeval, Node_concat, yyvsp[0].nodeval); ;
    break;}
case 108:
#line 708 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
    break;}
case 109:
#line 713 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, yyvsp[0].nodeval); ;
    break;}
case 110:
#line 715 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_and, yyvsp[0].nodeval); ;
    break;}
case 111:
#line 717 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_or, yyvsp[0].nodeval); ;
    break;}
case 112:
#line 719 "awk.y"
{
		  yyval.nodeval = node (yyvsp[-1].nodeval, Node_K_getline, yyvsp[0].nodeval);
		;
    break;}
case 113:
#line 723 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, yyvsp[0].nodeval); ;
    break;}
case 114:
#line 725 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, yyvsp[0].nodeval); ;
    break;}
case 115:
#line 727 "awk.y"
{ yyval.nodeval = node (variable(yyvsp[0].sval), Node_in_array, yyvsp[-2].nodeval); ;
    break;}
case 116:
#line 729 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, yyvsp[-1].nodetypeval, yyvsp[0].nodeval); ;
    break;}
case 117:
#line 731 "awk.y"
{ yyval.nodeval = node(yyvsp[-4].nodeval, Node_cond_exp, node(yyvsp[-2].nodeval, Node_if_branches, yyvsp[0].nodeval));;
    break;}
case 118:
#line 733 "awk.y"
{ yyval.nodeval = node (yyvsp[-1].nodeval, Node_concat, yyvsp[0].nodeval); ;
    break;}
case 119:
#line 735 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
    break;}
case 120:
#line 740 "awk.y"
{ yyval.nodeval = node (yyvsp[0].nodeval, Node_not,(NODE *) NULL); ;
    break;}
case 121:
#line 742 "awk.y"
{ yyval.nodeval = yyvsp[-1].nodeval; ;
    break;}
case 122:
#line 744 "awk.y"
{ yyval.nodeval = snode (yyvsp[-1].nodeval, Node_builtin, yyvsp[-3].ptrval); ;
    break;}
case 123:
#line 746 "awk.y"
{ yyval.nodeval = snode ((NODE *)NULL, Node_builtin, yyvsp[0].ptrval); ;
    break;}
case 124:
#line 748 "awk.y"
{ yyval.nodeval = node(yyvsp[-1].nodeval, yyvsp[-5].nodetypeval, yyvsp[-3].nodeval); ;
    break;}
case 125:
#line 750 "awk.y"
{ yyval.nodeval = node(yyvsp[-1].nodeval, yyvsp[-5].nodetypeval, yyvsp[-3].nodeval); ;
    break;}
case 126:
#line 752 "awk.y"
{ yyval.nodeval = node(yyvsp[-3].nodeval, yyvsp[-5].nodetypeval, yyvsp[-1].nodeval); ;
    break;}
case 127:
#line 754 "awk.y"
{ yyval.nodeval = node(yyvsp[-3].nodeval, yyvsp[-5].nodetypeval, yyvsp[-1].nodeval); ;
    break;}
case 128:
#line 756 "awk.y"
{
		yyval.nodeval = node (yyvsp[-1].nodeval, Node_func_call, make_string(yyvsp[-3].sval, strlen(yyvsp[-3].sval)));
	  ;
    break;}
case 129:
#line 760 "awk.y"
{ yyval.nodeval = node (yyvsp[0].nodeval, Node_preincrement, (NODE *)NULL); ;
    break;}
case 130:
#line 762 "awk.y"
{ yyval.nodeval = node (yyvsp[0].nodeval, Node_predecrement, (NODE *)NULL); ;
    break;}
case 131:
#line 764 "awk.y"
{ yyval.nodeval = node (yyvsp[-1].nodeval, Node_postincrement, (NODE *)NULL); ;
    break;}
case 132:
#line 766 "awk.y"
{ yyval.nodeval = node (yyvsp[-1].nodeval, Node_postdecrement, (NODE *)NULL); ;
    break;}
case 133:
#line 768 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
    break;}
case 134:
#line 770 "awk.y"
{ yyval.nodeval = make_number (yyvsp[0].fval); ;
    break;}
case 135:
#line 772 "awk.y"
{ yyval.nodeval = make_string (yyvsp[0].sval, -1); ;
    break;}
case 136:
#line 776 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_exp, yyvsp[0].nodeval); ;
    break;}
case 137:
#line 778 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_times, yyvsp[0].nodeval); ;
    break;}
case 138:
#line 780 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_quotient, yyvsp[0].nodeval); ;
    break;}
case 139:
#line 782 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_mod, yyvsp[0].nodeval); ;
    break;}
case 140:
#line 784 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_plus, yyvsp[0].nodeval); ;
    break;}
case 141:
#line 786 "awk.y"
{ yyval.nodeval = node (yyvsp[-2].nodeval, Node_minus, yyvsp[0].nodeval); ;
    break;}
case 142:
#line 788 "awk.y"
{ yyval.nodeval = node (yyvsp[0].nodeval, Node_unary_minus, (NODE *)NULL); ;
    break;}
case 143:
#line 790 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
    break;}
case 144:
#line 795 "awk.y"
{ yyval.nodeval = NULL; ;
    break;}
case 145:
#line 797 "awk.y"
{ yyval.nodeval = yyvsp[0].nodeval; ;
    break;}
case 146:
#line 802 "awk.y"
{ yyval.nodeval = variable (yyvsp[0].sval); ;
    break;}
case 147:
#line 804 "awk.y"
{ yyval.nodeval = node (variable(yyvsp[-3].sval), Node_subscript, yyvsp[-1].nodeval); ;
    break;}
case 148:
#line 806 "awk.y"
{ yyval.nodeval = node (yyvsp[0].nodeval, Node_field_spec, (NODE *)NULL); ;
    break;}
case 150:
#line 814 "awk.y"
{ yyerrok; ;
    break;}
case 151:
#line 818 "awk.y"
{ yyval.nodetypeval = Node_illegal; yyerrok; ;
    break;}
case 154:
#line 827 "awk.y"
{ yyerrok; ;
    break;}
case 155:
#line 830 "awk.y"
{ yyval.nodetypeval = Node_illegal; yyerrok; ;
    break;}
}
   /* the action file gets copied in in place of this dollarsign */
#line 412 "bison.simple"

  yyvsp -= yylen;
  yyssp -= yylen;
#ifdef YYLSP_NEEDED
  yylsp -= yylen;
#endif

#if YYDEBUG != 0
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "state stack now");
      while (ssp1 != yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

  *++yyvsp = yyval;

#ifdef YYLSP_NEEDED
  yylsp++;
  if (yylen == 0)
    {
      yylsp->first_line = yylloc.first_line;
      yylsp->first_column = yylloc.first_column;
      yylsp->last_line = (yylsp-1)->last_line;
      yylsp->last_column = (yylsp-1)->last_column;
      yylsp->text = 0;
    }
  else
    {
      yylsp->last_line = (yylsp+yylen-1)->last_line;
      yylsp->last_column = (yylsp+yylen-1)->last_column;
    }
#endif

  /* Now "shift" the result of the reduction.
     Determine what state that goes to,
     based on the state we popped back to
     and the rule number reduced by.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTBASE];

  goto yynewstate;

yyerrlab:   /* here on detecting error */

  if (! yyerrstatus)
    /* If not already recovering from an error, report this error.  */
    {
      ++yynerrs;
      yyerror("parse error");
    }

  if (yyerrstatus == 3)
    {
      /* if just tried and failed to reuse lookahead token after an error, discard it.  */

      /* return failure if at end of input */
      if (yychar == YYEOF)
	YYABORT;

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
#endif

      yychar = YYEMPTY;
    }

  /* Else will try to reuse lookahead token
     after shifting the error token.  */

  yyerrstatus = 3;		/* Each real token shifted decrements this */

  goto yyerrhandle;

yyerrdefault:  /* current state does not do anything special for the error token. */

#if 0
  /* This is wrong; only states that explicitly want error tokens
     should shift them.  */
  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  if (yyn) goto yydefault;
#endif

yyerrpop:   /* pop the current state because it cannot handle the error token */

  if (yyssp == yyss) YYABORT;
  yyvsp--;
  yystate = *--yyssp;
#ifdef YYLSP_NEEDED
  yylsp--;
#endif

#if YYDEBUG != 0
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "Error: state stack now");
      while (ssp1 != yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

yyerrhandle:

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yyerrdefault;

  yyn += YYTERROR;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
    goto yyerrdefault;

  yyn = yytable[yyn];
  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrpop;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrpop;

  if (yyn == YYFINAL)
    YYACCEPT;

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Shifting error token, ");
#endif

  *++yyvsp = yylval;
#ifdef YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  yystate = yyn;
  goto yynewstate;
}
#line 833 "awk.y"


struct token {
	char *operator;		/* text to match */
	NODETYPE value;		/* node type */
	int class;		/* lexical class */
	short nostrict;		/* ignore if in strict compatibility mode */
	NODE *(*ptr) ();	/* function that implements this keyword */
};

#ifndef NULL
#define NULL 0
#endif

extern NODE
	*do_exp(),	*do_getline(),	*do_index(),	*do_length(),
	*do_sqrt(),	*do_log(),	*do_sprintf(),	*do_substr(),
	*do_split(),	*do_system(),	*do_int(),	*do_close(),
	*do_atan2(),	*do_sin(),	*do_cos(),	*do_rand(),
	*do_srand(),	*do_match(),	*do_tolower(),	*do_toupper();

/* Special functions for debugging */
#ifdef DEBUG
NODE *do_prvars(), *do_bp();
#endif

/* Tokentab is sorted ascii ascending order, so it can be binary searched. */

static struct token tokentab[] = {
	{ "BEGIN",	Node_illegal,		LEX_BEGIN,	0,	0 },
	{ "END",	Node_illegal,		LEX_END,	0,	0 },
	{ "atan2",	Node_builtin,		LEX_BUILTIN,	0,	do_atan2 },
#ifdef DEBUG
	{ "bp",		Node_builtin,		LEX_BUILTIN,	0,	do_bp },
#endif
	{ "break",	Node_K_break,		LEX_BREAK,	0,	0 },
	{ "close",	Node_builtin,		LEX_BUILTIN,	0,	do_close },
	{ "continue",	Node_K_continue,	LEX_CONTINUE,	0,	0 },
	{ "cos",	Node_builtin,		LEX_BUILTIN,	0,	do_cos },
	{ "delete",	Node_K_delete,		LEX_DELETE,	0,	0 },
	{ "do",		Node_K_do,		LEX_DO,		0,	0 },
	{ "else",	Node_illegal,		LEX_ELSE,	0,	0 },
	{ "exit",	Node_K_exit,		LEX_EXIT,	0,	0 },
	{ "exp",	Node_builtin,		LEX_BUILTIN,	0,	do_exp },
	{ "for",	Node_K_for,		LEX_FOR,	0,	0 },
	{ "func",	Node_K_function,	LEX_FUNCTION,	0,	0 },
	{ "function",	Node_K_function,	LEX_FUNCTION,	0,	0 },
	{ "getline",	Node_K_getline,		LEX_GETLINE,	0,	0 },
	{ "gsub",	Node_gsub,		LEX_SUB,	0,	0 },
	{ "if",		Node_K_if,		LEX_IF,		0,	0 },
	{ "in",		Node_illegal,		LEX_IN,		0,	0 },
	{ "index",	Node_builtin,		LEX_BUILTIN,	0,	do_index },
	{ "int",	Node_builtin,		LEX_BUILTIN,	0,	do_int },
	{ "length",	Node_builtin,		LEX_BUILTIN,	0,	do_length },
	{ "log",	Node_builtin,		LEX_BUILTIN,	0,	do_log },
	{ "match",	Node_K_match,		LEX_MATCH,	0,	0 },
	{ "next",	Node_K_next,		LEX_NEXT,	0,	0 },
	{ "print",	Node_K_print,		LEX_PRINT,	0,	0 },
	{ "printf",	Node_K_printf,		LEX_PRINTF,	0,	0 },
#ifdef DEBUG
	{ "prvars",	Node_builtin,		LEX_BUILTIN,	0,	do_prvars },
#endif
	{ "rand",	Node_builtin,		LEX_BUILTIN,	0,	do_rand },
	{ "return",	Node_K_return,		LEX_RETURN,	0,	0 },
	{ "sin",	Node_builtin,		LEX_BUILTIN,	0,	do_sin },
	{ "split",	Node_builtin,		LEX_BUILTIN,	0,	do_split },
	{ "sprintf",	Node_builtin,		LEX_BUILTIN,	0,	do_sprintf },
	{ "sqrt",	Node_builtin,		LEX_BUILTIN,	0,	do_sqrt },
	{ "srand",	Node_builtin,		LEX_BUILTIN,	0,	do_srand },
	{ "sub",	Node_sub,		LEX_SUB,	0,	0 },
	{ "substr",	Node_builtin,		LEX_BUILTIN,	0,	do_substr },
	{ "system",	Node_builtin,		LEX_BUILTIN,	0,	do_system },
	{ "tolower",	Node_builtin,		LEX_BUILTIN,	1,	do_tolower },
	{ "toupper",	Node_builtin,		LEX_BUILTIN,	1,	do_toupper },
	{ "while",	Node_K_while,		LEX_WHILE,	0,	0 },
};

/* VARARGS0 */
static void
yyerror(va_alist)
va_dcl
{
	va_list args;
	char *mesg;
	char *a1;
	register char *ptr, *beg;
	static int list = 0;
	char *scan;

	errcount++;
	va_start(args);
	mesg = va_arg(args, char *);
	if (! list)
		a1 = va_arg(args, char *);
	va_end(args);
	if (mesg || !list) {
		/* Find the current line in the input file */
		if (!lexptr) {
			beg = "(END OF FILE)";
			ptr = beg + 13;
		} else {
			if (*lexptr == '\n' && lexptr != lexptr_begin)
				--lexptr;
			for (beg = lexptr; beg != lexptr_begin && *beg != '\n'; --beg)
				;
			/* NL isn't guaranteed */
			for (ptr = lexptr; *ptr && *ptr != '\n'; ptr++)
				;
			if (beg != lexptr_begin)
				beg++;
		}
		msg("syntax error near line %d:\n%.*s", lineno, ptr - beg, beg);
		scan = beg;
		while (scan <= lexptr)
			if (*scan++ == '\t')
				putc('\t', stderr);
			else
				putc(' ', stderr);
		putc('^', stderr);
		putc(' ', stderr);
		if (mesg) {
			vfprintf(stderr, mesg, args);
		        putc('\n', stderr);
			exit(1);
		} else {
			if (a1) {
				fputs("expecting: ", stderr);
				fputs(a1, stderr);
				list = 1;
				return;
			}
		}
		return;
	}
	if (a1) {
		fputs(" or ", stderr);
		fputs(a1, stderr);
		putc('\n', stderr);
		return;
	}
	putc('\n', stderr);
	list = 0;
}

/*
 * Parse a C escape sequence.  STRING_PTR points to a variable containing a
 * pointer to the string to parse.  That pointer is updated past the
 * characters we use.  The value of the escape sequence is returned. 
 *
 * A negative value means the sequence \ newline was seen, which is supposed to
 * be equivalent to nothing at all. 
 *
 * If \ is followed by a null character, we return a negative value and leave
 * the string pointer pointing at the null character. 
 *
 * If \ is followed by 000, we return 0 and leave the string pointer after the
 * zeros.  A value of 0 does not mean end of string.  
 */

static int
parse_escape(string_ptr)
char **string_ptr;
{
	register int c = *(*string_ptr)++;
	register int i;

	switch (c) {
	case 'a':
		if (strict)
			goto def;
		else
			return BELL;
	case 'b':
		return '\b';
	case 'f':
		return '\f';
	case 'n':
		return '\n';
	case 'r':
		return '\r';
	case 't':
		return '\t';
	case 'v':
		if (strict)
			goto def;
		else
			return '\v';
	case '\n':
		return -2;
	case 0:
		(*string_ptr)--;
		return 0;
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
		{
			register int i = c - '0';
			register int count = 0;

			while (++count < 3) {
				if ((c = *(*string_ptr)++) >= '0' && c <= '7') {
					i *= 8;
					i += c - '0';
				} else {
					(*string_ptr)--;
					break;
				}
			}
			return i;
		}
	case 'x':
		if (strict)
			goto def;

		i = 0;
		while (1) {
			if (isxdigit((c = *(*string_ptr)++))) {
				if (isdigit(c))
					i += c - '0';
				else if (isupper(c))
					i += c - 'A' + 10;
				else
					i += c - 'a' + 10;
			} else {
				(*string_ptr)--;
				break;
			}
		}
		return i;
	default:
	def:
		return c;
	}
}

/*
 * Read the input and turn it into tokens. Input is now read from a file
 * instead of from malloc'ed memory. The main program takes a program
 * passed as a command line argument and writes it to a temp file. Otherwise
 * the file name is made available in an external variable.
 */
#line 1080 "awk.y"
static int
yylex()
{
	register int c;
	register int namelen;
	register char *tokstart;
	char *tokkey;
	static did_newline = 0;	/* the grammar insists that actions end
				 * with newlines.  This was easier than
				 * hacking the grammar. */
	int seen_e = 0;		/* These are for numbers */
	int seen_point = 0;
	extern char **sourcefile;
	extern int tempsource, numfiles;
	static int file_opened = 0;
	static FILE *fin;
	static char cbuf[BUFSIZ];
	int low, mid, high;
#ifdef DEBUG
	extern int debugging;
#endif

	if (! file_opened) {
		file_opened = 1;
#ifdef DEBUG
		if (debugging) {
			int i;

			for (i = 0; i <= numfiles; i++)
				fprintf (stderr, "sourcefile[%d] = %s\n", i,
						sourcefile[i]);
		}
#endif
	nextfile:
		if ((fin = pathopen (sourcefile[++curinfile])) == NULL)
			fatal("cannot open `%s' for reading (%s)",
				sourcefile[curinfile],
				sys_errlist[errno]);
		*(lexptr = cbuf) = '\0';
		/*
		 * immediately unlink the tempfile so that it will
		 * go away cleanly if we bomb.
		 */
		if (tempsource && curinfile == 0)
			(void) unlink (sourcefile[curinfile]);
	}

retry:
	if (! *lexptr)
		if (fgets (cbuf, sizeof cbuf, fin) == NULL) {
			if (fin != NULL)
				fclose (fin);	/* be neat and clean */
			if (curinfile < numfiles)
				goto nextfile;
			return 0;
		} else
			lexptr = lexptr_begin = cbuf;

	if (want_regexp) {
		want_regexp = 0;

		/*
		 * there is a potential bug if a regexp is followed by an
		 * equal sign: "/foo/=bar" would result in assign_quotient
		 * being returned as the next token.  Nothing is done about
		 * it since it is not valid awk, but maybe something should
		 * be done anyway. 
		 */

		tokstart = lexptr;
		while (c = *lexptr++) {
			switch (c) {
			case '\\':
				if (*lexptr++ == '\0') {
					yyerror("unterminated regexp ends with \\");
					return ERROR;
				} else if (lexptr[-1] == '\n')
					goto retry;
				break;
			case '/':	/* end of the regexp */
				lexptr--;
				yylval.sval = tokstart;
				return REGEXP;
			case '\n':
				lineno++;
			case '\0':
				lexptr--;	/* so error messages work */
				yyerror("unterminated regexp");
				return ERROR;
			}
		}
	}

	if (*lexptr == '\n') {
		lexptr++;
		lineno++;
		return NEWLINE;
	}

	while (*lexptr == ' ' || *lexptr == '\t')
		lexptr++;

	tokstart = lexptr;

	switch (c = *lexptr++) {
	case 0:
		return 0;

	case '\n':
		lineno++;
		return NEWLINE;

	case '#':		/* it's a comment */
		while (*lexptr != '\n' && *lexptr != '\0')
			lexptr++;
		goto retry;

	case '\\':
		if (*lexptr == '\n') {
			lineno++;
			lexptr++;
			goto retry;
		} else
			break;
	case ')':
	case ']':
	case '(':	
	case '[':
	case '$':
	case ';':
	case ':':
	case '?':

		/*
		 * set node type to ILLEGAL because the action should set it
		 * to the right thing 
		 */
		yylval.nodetypeval = Node_illegal;
		return c;

	case '{':
	case ',':
		yylval.nodetypeval = Node_illegal;
		return c;

	case '*':
		if (*lexptr == '=') {
			yylval.nodetypeval = Node_assign_times;
			lexptr++;
			return ASSIGNOP;
		} else if (*lexptr == '*') {	/* make ** and **= aliases
						 * for ^ and ^= */
			if (lexptr[1] == '=') {
				yylval.nodetypeval = Node_assign_exp;
				lexptr += 2;
				return ASSIGNOP;
			} else {
				yylval.nodetypeval = Node_illegal;
				lexptr++;
				return '^';
			}
		}
		yylval.nodetypeval = Node_illegal;
		return c;

	case '/':
		if (*lexptr == '=') {
			yylval.nodetypeval = Node_assign_quotient;
			lexptr++;
			return ASSIGNOP;
		}
		yylval.nodetypeval = Node_illegal;
		return c;

	case '%':
		if (*lexptr == '=') {
			yylval.nodetypeval = Node_assign_mod;
			lexptr++;
			return ASSIGNOP;
		}
		yylval.nodetypeval = Node_illegal;
		return c;

	case '^':
		if (*lexptr == '=') {
			yylval.nodetypeval = Node_assign_exp;
			lexptr++;
			return ASSIGNOP;
		}
		yylval.nodetypeval = Node_illegal;
		return c;

	case '+':
		if (*lexptr == '=') {
			yylval.nodetypeval = Node_assign_plus;
			lexptr++;
			return ASSIGNOP;
		}
		if (*lexptr == '+') {
			yylval.nodetypeval = Node_illegal;
			lexptr++;
			return INCREMENT;
		}
		yylval.nodetypeval = Node_illegal;
		return c;

	case '!':
		if (*lexptr == '=') {
			yylval.nodetypeval = Node_notequal;
			lexptr++;
			return RELOP;
		}
		if (*lexptr == '~') {
			yylval.nodetypeval = Node_nomatch;
			lexptr++;
			return MATCHOP;
		}
		yylval.nodetypeval = Node_illegal;
		return c;

	case '<':
		if (*lexptr == '=') {
			yylval.nodetypeval = Node_leq;
			lexptr++;
			return RELOP;
		}
		yylval.nodetypeval = Node_less;
		return c;

	case '=':
		if (*lexptr == '=') {
			yylval.nodetypeval = Node_equal;
			lexptr++;
			return RELOP;
		}
		yylval.nodetypeval = Node_assign;
		return ASSIGNOP;

	case '>':
		if (*lexptr == '=') {
			yylval.nodetypeval = Node_geq;
			lexptr++;
			return RELOP;
		} else if (*lexptr == '>') {
			yylval.nodetypeval = Node_redirect_append;
			lexptr++;
			return APPEND_OP;
		}
		yylval.nodetypeval = Node_greater;
		return c;

	case '~':
		yylval.nodetypeval = Node_match;
		return MATCHOP;

	case '}':
		/*
		 * Added did newline stuff.  Easier than
		 * hacking the grammar
		 */
		if (did_newline) {
			did_newline = 0;
			return c;
		}
		did_newline++;
		--lexptr;
		return NEWLINE;

	case '"':
		while (*lexptr != '\0') {
			switch (*lexptr++) {
			case '\\':
				if (*lexptr++ != '\0')
					break;
				/* fall through */
			case '\n':
				yyerror("unterminated string");
				return ERROR;
			case '\"':
				/* Skip the doublequote */
				yylval.sval = tokstart + 1;
				return YSTRING;
			}
		}
		return ERROR;

	case '-':
		if (*lexptr == '=') {
			yylval.nodetypeval = Node_assign_minus;
			lexptr++;
			return ASSIGNOP;
		}
		if (*lexptr == '-') {
			yylval.nodetypeval = Node_illegal;
			lexptr++;
			return DECREMENT;
		}

		/*
		 * It looks like space tab comma and newline are the legal
		 * places for a UMINUS.  Have we missed any? 
		 */
		if ((! isdigit(*lexptr) && *lexptr != '.') ||
			(lexptr > lexptr_begin + 1 &&
				    ! index(" \t,\n", lexptr[-2]))) {

			/*
			 * set node type to ILLEGAL because the action should
			 * set it to the right thing 
			 */
			yylval.nodetypeval = Node_illegal;
			return c;
		}
		/* FALL through into number code */
	case '0':
	case '1':
	case '2':
	case '3':
	case '4':
	case '5':
	case '6':
	case '7':
	case '8':
	case '9':
	case '.':
		/* It's a number */
		if (c == '-')
			namelen = 1;
		else
			namelen = 0;
		for (; (c = tokstart[namelen]) != '\0'; namelen++) {
			switch (c) {
			case '.':
				if (seen_point)
					goto got_number;
				++seen_point;
				break;
			case 'e':
			case 'E':
				if (seen_e)
					goto got_number;
				++seen_e;
				if (tokstart[namelen + 1] == '-' ||
				    tokstart[namelen + 1] == '+')
					namelen++;
				break;
			case '0':
			case '1':
			case '2':
			case '3':
			case '4':
			case '5':
			case '6':
			case '7':
			case '8':
			case '9':
				break;
			default:
				goto got_number;
			}
		}

got_number:
		lexptr = tokstart + namelen;
		yylval.fval = atof(tokstart);
		return NUMBER;

	case '&':
		if (*lexptr == '&') {
			yylval.nodetypeval = Node_and;
			while (c = *++lexptr) {
				if (c == '#')
					while ((c = *++lexptr) != '\n'
					       && c != '\0')
						;
				if (c == '\n')
					lineno++;
				else if (!isspace(c))
					break;
			}
			return LEX_AND;
		}
		return ERROR;

	case '|':
		if (*lexptr == '|') {
			yylval.nodetypeval = Node_or;
			while (c = *++lexptr) {
				if (c == '#')
					while ((c = *++lexptr) != '\n'
					       && c != '\0')
						;
				if (c == '\n')
					lineno++;
				else if (!isspace(c))
					break;
			}
			return LEX_OR;
		}
			yylval.nodetypeval = Node_illegal;
			return c;
		}

	if (c != '_' && !isalpha(c)) {
		yyerror("Invalid char '%c' in expression\n", c);
		return ERROR;
	}

	/* it's some type of name-type-thing.  Find its length */
	for (namelen = 0; is_identchar(tokstart[namelen]); namelen++)
		/* null */ ;
	emalloc(tokkey, char *, namelen+1, "yylex");
	(void) strncpy (tokkey, tokstart, namelen);
	tokkey[namelen] = '\0';

	/* See if it is a special token.  */
	low = 0;
	high = (sizeof (tokentab) / sizeof (tokentab[0])) - 1;
	while (low <= high) {
		int i, c;

		mid = (low + high) / 2;

	compare:
		c = *tokstart - tokentab[mid].operator[0];
		i = c ? c : strcmp (tokkey, tokentab[mid].operator);

		if (i < 0) {		/* token < mid */
			high = mid - 1;
		} else if (i > 0) {	/* token > mid */
			low = mid + 1;
		} else {
			lexptr = tokstart + namelen;
			if (strict && tokentab[mid].nostrict)
				break;
			if (tokentab[mid].class == LEX_BUILTIN)
				yylval.ptrval = tokentab[mid].ptr;
			else
				yylval.nodetypeval = tokentab[mid].value;
			return tokentab[mid].class;
		}
	}

	/* It's a name.  See how long it is.  */
	yylval.sval = tokkey;
	lexptr = tokstart + namelen;
	if (*lexptr == '(')
		return FUNC_CALL;
	else
		return NAME;
}

#ifndef DEFPATH
/*** CHANGE [2632,2639] IN x:awk.tab.c TO [2632,2695] IN awktab.c ***/
	#ifdef AMIGA
		#define DEFPATH "S:"
		#define ENVSEP ' '
	#elif defined MSDOS
		#define DEFPATH "."
		#define ENVSEP	';'
	#else
		#define DEFPATH ".:/usr/lib/awk:/usr/local/lib/awk"
		#define ENVSEP	':'
	#endif
#endif

#ifdef AMIGA /* static FILE * pathopen() for AMIGA YEA! */

static FILE *
pathopen (file)
char *file;
{
	static char *savepath = DEFPATH;
	static int first = 1;
	char *awkpath, *cp;
	char trypath[BUFSIZ];
	int fh; /* temp to check devopen() >= 0 before returning fdopen() */
	extern int debugging;

	if (strcmp (file, "-") == 0)
		return (stdin);

	if (strict)
		return (fopen (file, "r"));
   
   /* check for file in current directory first */
	if ((fh = devopen(file, "r")) >= 0)
		return(fdopen(fh, "r"));
	
	if (first) {
		first = 0;
		if ((awkpath = getenv("AWKPATH")) != NULL && *awkpath)
			savepath = awkpath;	/* used for restarting */
	}
	awkpath = savepath;
	
	do {
		for (cp = trypath; *awkpath && *awkpath != ENVSEP; )
			*cp++ = *awkpath++;
			
		if (*(cp-1) == ':' || *(cp-1) == '/')
			*cp = '\0';
		else {
			*cp++ = '/';
			*cp = '\0';
		}
		if ((fh = devopen(strcat(trypath, file), "r")) >= 0)
			return(fdopen(fh, "r"));
	
		if(*awkpath)
			awkpath++;	/* skip colon */

	} while (*awkpath);
	
	return (NULL);
}

#else /* static FILE * pathopen() for the rest of the world BOO! */
/*** CHANGE [2632,2639] IN x:awk.tab.c TO [2632,2695] IN awktab.c ***/

static FILE *
pathopen (file)
char *file;
{
	static char *savepath = DEFPATH;
	static int first = 1;
	char *awkpath, *cp;
	char trypath[BUFSIZ];
	FILE *fp;
	extern int debugging;

	if (strcmp (file, "-") == 0)
		return (stdin);

	if (strict)
		return (fopen (file, "r"));

	if (first) {
		first = 0;
		if ((awkpath = getenv ("AWKPATH")) != NULL && *awkpath)
			savepath = awkpath;	/* used for restarting */
#ifdef MSDOS
		else if ((awkpath = getenv ("INIT")) != NULL && *awkpath)
			savepath = awkpath;	/* MSC 5.1 users may prefer */
						/* to use INIT		    */
#endif
	}
	awkpath = savepath;

	/* some kind of path name, no search */
#ifndef MSDOS
	if (index (file, '/') != NULL)
#else
	if (index (file, '/') != NULL || index (file, '\\') != NULL
			|| index (file, ':') != NULL)
#endif
		return (fdopen(devopen (file, "r"), "r"));

	do {
		/* this should take into account limits on size of trypath */
		for (cp = trypath; *awkpath && *awkpath != ENVSEP; )
			*cp++ = *awkpath++;
		*cp++ = '/';
		*cp = '\0';	/* clear left over junk */
		strcat (cp, file);
		if ((fp = fdopen(devopen (trypath, "r"), "r")) != NULL)
			return (fp);

		/* no luck, keep going */
		if(*awkpath)
			awkpath++;	/* skip colon */
	} while (*awkpath);
#ifdef MSDOS
/*
** under DOS (and probably elsewhere) you might have one of the awk paths
** defined, WITHOUT the current working directory in it.  Therefore you
** should try to open the file in the current directory
*/
	return fdopen(devopen(file,"r"),"r");
#else
	return (NULL);
#endif
}
/*** APPEND AFTER 2703 IN x:awk.tab.c ***/
#endif /* static FILE * pathopen() */
/*** APPEND AFTER 2703 IN x:awk.tab.c ***/

static NODE *
node_common(op)
NODETYPE op;
{
	register NODE *r;
	extern int numfiles;
	extern int tempsource;
	extern char **sourcefile;

	r = newnode(op);
	r->source_line = lineno;
	if (numfiles > 1 && !tempsource)
		r->source_file = sourcefile[curinfile];
	else
		r->source_file = NULL;
	return r;
}

/*
 * This allocates a node with defined lnode and rnode. 
 * This should only be used by yyparse+co while reading in the program 
 */
NODE *
node(left, op, right)
NODE *left, *right;
NODETYPE op;
{
	register NODE *r;

	r = node_common(op);
	r->lnode = left;
	r->rnode = right;
	return r;
}

/*
 * This allocates a node with defined subnode and proc
 * Otherwise like node()
 */
static NODE *
snode(subn, op, procp)
NODETYPE op;
NODE *(*procp) ();
NODE *subn;
{
	register NODE *r;

	r = node_common(op);
	r->subnode = subn;
	r->proc = procp;
	return r;
}

/*
 * This allocates a Node_line_range node with defined condpair and
 * zeroes the trigger word to avoid the temptation of assuming that calling
 * 'node( foo, Node_line_range, 0)' will properly initialize 'triggered'. 
 */
/* Otherwise like node() */
static NODE *
mkrangenode(cpair)
NODE *cpair;
{
	register NODE *r;

	r = newnode(Node_line_range);
	r->condpair = cpair;
	r->triggered = 0;
	return r;
}

/* Build a for loop */
static NODE *
make_for_loop(init, cond, incr)
NODE *init, *cond, *incr;
{
	register FOR_LOOP_HEADER *r;
	NODE *n;

	emalloc(r, FOR_LOOP_HEADER *, sizeof(FOR_LOOP_HEADER), "make_for_loop");
	n = newnode(Node_illegal);
	r->init = init;
	r->cond = cond;
	r->incr = incr;
	n->sub.nodep.r.hd = r;
	return n;
}

/*
 * Install a name in the hash table specified, even if it is already there.
 * Name stops with first non alphanumeric. Caller must check against
 * redefinition if that is desired. 
 */
NODE *
install(table, name, value)
NODE **table;
char *name;
NODE *value;
{
	register NODE *hp;
	register int len, bucket;
	register char *p;

	len = 0;
	p = name;
	while (is_identchar(*p))
		p++;
	len = p - name;

	hp = newnode(Node_hashnode);
	bucket = hashf(name, len, HASHSIZE);
	hp->hnext = table[bucket];
	table[bucket] = hp;
	hp->hlength = len;
	hp->hvalue = value;
	emalloc(hp->hname, char *, len + 1, "install");
	bcopy(name, hp->hname, len);
	hp->hname[len] = '\0';
	hp->hvalue->varname = hp->hname;
	return hp->hvalue;
}

/*
 * find the most recent hash node for name name (ending with first
 * non-identifier char) installed by install 
 */
NODE *
lookup(table, name)
NODE **table;
char *name;
{
	register char *bp;
	register NODE *bucket;
	register int len;

	for (bp = name; is_identchar(*bp); bp++)
		;
	len = bp - name;
	bucket = table[hashf(name, len, HASHSIZE)];
	while (bucket) {
		if (bucket->hlength == len && STREQN(bucket->hname, name, len))
			return bucket->hvalue;
		bucket = bucket->hnext;
	}
	return NULL;
}

#define HASHSTEP(old, c) ((old << 1) + c)
#define MAKE_POS(v) (v & ~0x80000000)	/* make number positive */

/*
 * return hash function on name.
 */
static int
hashf(name, len, hashsize)
register char *name;
register int len;
int hashsize;
{
	register int r = 0;

	while (len--)
		r = HASHSTEP(r, *name++);

	r = MAKE_POS(r) % hashsize;
	return r;
}

/*
 * Add new to the rightmost branch of LIST.  This uses n^2 time, but doesn't
 * get used enough to make optimizing worth it. . . 
 */
/* You don't believe me?  Profile it yourself! */
static NODE *
append_right(list, new)
NODE *list, *new;

{
	register NODE *oldlist;

	oldlist = list;
	while (list->rnode != NULL)
		list = list->rnode;
	list->rnode = new;
	return oldlist;
}

/*
 * check if name is already installed;  if so, it had better have Null value,
 * in which case def is added as the value. Otherwise, install name with def
 * as value. 
 */
static void
func_install(params, def)
NODE *params;
NODE *def;
{
	NODE *r;

	pop_params(params->rnode);
	pop_var(params, 0);
	r = lookup(variables, params->param);
	if (r != NULL) {
		fatal("function name `%s' previously defined", params->param);
	} else
		(void) install(variables, params->param,
			node(params, Node_func, def));
}

static void
pop_var(np, freeit)
NODE *np;
int freeit;
{
	register char *bp;
	register NODE *bucket, **save;
	register int len;
	char *name;

	name = np->param;
	for (bp = name; is_identchar(*bp); bp++)
		;
	len = bp - name;
	save = &(variables[hashf(name, len, HASHSIZE)]);
	for (bucket = *save; bucket; bucket = bucket->hnext) {
		if (len == bucket->hlength && STREQN(bucket->hname, name, len)) {
			*save = bucket->hnext;
			freenode(bucket);
			free(bucket->hname);
			if (freeit)
				free(np->param);
			return;
		}
		save = &(bucket->hnext);
	}
}

static void
pop_params(params)
NODE *params;
{
	register NODE *np;

	for (np = params; np != NULL; np = np->rnode)
		pop_var(np, 1);
}

static NODE *
make_param(name)
char *name;
{
	NODE *r;

	r = newnode(Node_param_list);
	r->param = name;
	r->rnode = NULL;
	r->param_cnt = param_counter++;
	return (install(variables, name, r));
}

/* Name points to a variable name.  Make sure its in the symbol table */
NODE *
variable(name)
char *name;
{
	register NODE *r;

	if ((r = lookup(variables, name)) == NULL)
		r = install(variables, name,
			node(Nnull_string, Node_var, (NODE *) NULL));
	return r;
}
