Jabber WindowGram Client (JWGC)

Introduction Screenshots Installation Downloads
Documentation Browse Source Resources Project Site

Stable Version
-none-

Latest Version
beta5



Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

parser.c

Go to the documentation of this file.
00001 
00002 /*  A Bison parser, made from parser.y
00003     by GNU Bison version 1.28  */
00004 
00005 #define YYBISON 1  /* Identify Bison output.  */
00006 
00007 #define ERROR   257
00008 #define VARNAME 258
00009 #define VARREF  259
00010 #define STRING  260
00011 #define SHOW    261
00012 #define APPENDPORT      262
00013 #define BUFFER  263
00014 #define BREAK   264
00015 #define CLOSEINPUT      265
00016 #define CLOSEOUTPUT     266
00017 #define CLOSEPORT       267
00018 #define CASE    268
00019 #define CLEARBUF        269
00020 #define DEFAULT 270
00021 #define DISPLAY 271
00022 #define DO      272
00023 #define DOWNCASE        273
00024 #define ELSE    274
00025 #define ELSEIF  275
00026 #define ENDCASE 276
00027 #define ENDIF   277
00028 #define ENDWHILE        278
00029 #define EXEC    279
00030 #define EXECPORT        280
00031 #define EXIT    281
00032 #define FIELDS  282
00033 #define GET     283
00034 #define GETENV  284
00035 #define IF      285
00036 #define INPUTPORT       286
00037 #define LANY    287
00038 #define LBREAK  288
00039 #define LSPAN   289
00040 #define MATCH   290
00041 #define NOOP    291
00042 #define NOT     292
00043 #define OUTPUTPORT      293
00044 #define PRINT   294
00045 #define PROTECT 295
00046 #define VERBATIM        296
00047 #define PUT     297
00048 #define RANY    298
00049 #define RBREAK  299
00050 #define RSPAN   300
00051 #define SET     301
00052 #define SUBSTITUTE      302
00053 #define THEN    303
00054 #define UPCASE  304
00055 #define WHILE   305
00056 #define JVAR    306
00057 #define PARAGRAPH       307
00058 #define EQ      308
00059 #define NEQ     309
00060 #define REGEQ   310
00061 #define REGNEQ  311
00062 
00063 #line 1 "parser.y"
00064 
00065 #include <sysdep.h>
00066 
00067 /* Saber-C suppressions because yacc loses */
00068 
00069 /*SUPPRESS 288*/
00070 /*SUPPRESS 287*/
00071 
00072 #include <stdio.h>
00073 #include "lexer.h"
00074 #include "node.h"
00075 #include "main.h"
00076 
00077 static void yyerror();
00078 int yyparse();
00079 
00080 /*
00081  * the_program - local variable used to communicate the program's node
00082  *               representation from the program action to the parse_file
00083  *               function.
00084  */
00085 
00086 static Node *the_program;
00087 
00088 #line 26 "parser.y"
00089 typedef union{
00090     char *text;
00091     struct _Node *node;
00092 } YYSTYPE;
00093 #include <stdio.h>
00094 
00095 #ifndef __cplusplus
00096 #ifndef __STDC__
00097 #define const
00098 #endif
00099 #endif
00100 
00101 
00102 
00103 #define YYFINAL         176
00104 #define YYFLAG          -32768
00105 #define YYNTBASE        66
00106 
00107 #define YYTRANSLATE(x) ((unsigned)(x) <= 311 ? yytranslate[x] : 79)
00108 
00109 static const char yytranslate[] = {     0,
00110      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00111      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00112      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00113      2,     2,    61,     2,     2,     2,     2,    55,     2,    62,
00114     63,     2,    60,    64,     2,     2,     2,     2,     2,     2,
00115      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00116     65,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00117      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00118      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00119      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00120      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00121      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00122      2,     2,     2,    54,     2,     2,     2,     2,     2,     2,
00123      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00124      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00125      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00126      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00127      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00128      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00129      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00130      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00131      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00132      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00133      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00134      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00135      2,     2,     2,     2,     2,     1,     3,     4,     5,     6,
00136      7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
00137     17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
00138     27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
00139     37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
00140     47,    48,    49,    50,    51,    52,    53,    56,    57,    58,
00141     59
00142 };
00143 
00144 #if YYDEBUG != 0
00145 static const short yyprhs[] = {     0,
00146      0,     2,     4,     6,    10,    12,    14,    17,    21,    25,
00147     29,    33,    37,    41,    45,    49,    54,    59,    64,    69,
00148     74,    79,    84,    89,    96,   103,   110,   117,   124,   131,
00149    138,   140,   145,   148,   151,   153,   155,   159,   164,   168,
00150    172,   176,   178,   181,   184,   187,   191,   198,   203,   209,
00151    211,   213,   215,   219,   220,   226,   230,   233,   234,   237,
00152    239,   243,   244,   247,   248,   251,   252
00153 };
00154 
00155 static const short yyrhs[] = {    78,
00156      0,     4,     0,     6,     0,    62,    69,    63,     0,    68,
00157      0,     5,     0,    61,    69,     0,    69,    60,    69,     0,
00158     69,    54,    69,     0,    69,    55,    69,     0,    69,    56,
00159     69,     0,    69,    57,    69,     0,    69,    58,    69,     0,
00160     69,    59,    69,     0,     9,    62,    63,     0,    48,    62,
00161     69,    63,     0,    41,    62,    69,    63,     0,    42,    62,
00162     69,    63,     0,    30,    62,    69,    63,     0,    50,    62,
00163     69,    63,     0,    19,    62,    69,    63,     0,    52,    62,
00164     69,    63,     0,    29,    62,    69,    63,     0,    33,    62,
00165     69,    64,    69,    63,     0,    44,    62,    69,    64,    69,
00166     63,     0,    34,    62,    69,    64,    69,    63,     0,    45,
00167     62,    69,    64,    69,    63,     0,    35,    62,    69,    64,
00168     69,    63,     0,    46,    62,    69,    64,    69,    63,     0,
00169     53,    62,    69,    64,    69,    63,     0,    37,     0,    47,
00170     67,    65,    69,     0,    28,    76,     0,    40,    74,     0,
00171      7,     0,    15,     0,     8,    69,    69,     0,    26,    69,
00172     69,    74,     0,    32,    69,    69,     0,    39,    69,    69,
00173      0,    43,    69,    74,     0,    43,     0,    11,    69,     0,
00174     12,    69,     0,    13,    69,     0,    25,    69,    74,     0,
00175     31,    69,    49,    78,    71,    23,     0,    14,    69,    77,
00176     22,     0,    51,    69,    18,    78,    24,     0,    10,     0,
00177     27,     0,    72,     0,    72,    20,    78,     0,     0,    72,
00178     21,    69,    49,    78,     0,    36,    75,    78,     0,    16,
00179     78,     0,     0,    74,    69,     0,    69,     0,    75,    64,
00180     69,     0,     0,    76,    67,     0,     0,    77,    73,     0,
00181      0,    78,    70,     0
00182 };
00183 
00184 #endif
00185 
00186 #if YYDEBUG != 0
00187 static const short yyrline[] = { 0,
00188     59,    64,    68,    72,    75,    77,    80,    83,    85,    87,
00189     89,    91,    93,    95,    98,   101,   103,   105,   107,   109,
00190    111,   113,   115,   118,   120,   122,   124,   126,   128,   130,
00191    134,   136,   138,   145,   148,   153,   159,   161,   164,   166,
00192    168,   171,   173,   175,   177,   183,   190,   195,   198,   201,
00193    203,   207,   209,   217,   219,   225,   229,   244,   246,   251,
00194    253,   258,   260,   265,   267,   272,   274
00195 };
00196 #endif
00197 
00198 
00199 #if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
00200 
00201 static const char * const yytname[] = {   "$","error","$undefined.","ERROR",
00202 "VARNAME","VARREF","STRING","SHOW","APPENDPORT","BUFFER","BREAK","CLOSEINPUT",
00203 "CLOSEOUTPUT","CLOSEPORT","CASE","CLEARBUF","DEFAULT","DISPLAY","DO","DOWNCASE",
00204 "ELSE","ELSEIF","ENDCASE","ENDIF","ENDWHILE","EXEC","EXECPORT","EXIT","FIELDS",
00205 "GET","GETENV","IF","INPUTPORT","LANY","LBREAK","LSPAN","MATCH","NOOP","NOT",
00206 "OUTPUTPORT","PRINT","PROTECT","VERBATIM","PUT","RANY","RBREAK","RSPAN","SET",
00207 "SUBSTITUTE","THEN","UPCASE","WHILE","JVAR","PARAGRAPH","'|'","'&'","EQ","NEQ",
00208 "REGEQ","REGNEQ","'+'","'!'","'('","')'","','","'='","program","varname","string",
00209 "expr","statement","elseparts","elseifparts","match","exprlist","comma_exprlist",
00210 "varnamelist","matchlist","statements", NULL
00211 };
00212 #endif
00213 
00214 static const short yyr1[] = {     0,
00215     66,    67,    68,    69,    69,    69,    69,    69,    69,    69,
00216     69,    69,    69,    69,    69,    69,    69,    69,    69,    69,
00217     69,    69,    69,    69,    69,    69,    69,    69,    69,    69,
00218     70,    70,    70,    70,    70,    70,    70,    70,    70,    70,
00219     70,    70,    70,    70,    70,    70,    70,    70,    70,    70,
00220     70,    71,    71,    72,    72,    73,    73,    74,    74,    75,
00221     75,    76,    76,    77,    77,    78,    78
00222 };
00223 
00224 static const short yyr2[] = {     0,
00225      1,     1,     1,     3,     1,     1,     2,     3,     3,     3,
00226      3,     3,     3,     3,     3,     4,     4,     4,     4,     4,
00227      4,     4,     4,     6,     6,     6,     6,     6,     6,     6,
00228      1,     4,     2,     2,     1,     1,     3,     4,     3,     3,
00229      3,     1,     2,     2,     2,     3,     6,     4,     5,     1,
00230      1,     1,     3,     0,     5,     3,     2,     0,     2,     1,
00231      3,     0,     2,     0,     2,     0,     2
00232 };
00233 
00234 static const short yydefact[] = {    66,
00235      1,    35,     0,    50,     0,     0,     0,     0,    36,     0,
00236      0,    51,    62,     0,     0,    31,     0,    58,    42,     0,
00237      0,    67,     6,     3,     0,     0,     0,     0,     0,     0,
00238      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00239      0,     0,     5,     0,    43,    44,    45,    64,    58,     0,
00240     33,     0,     0,     0,    34,    58,     2,     0,     0,     0,
00241      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00242      0,     0,     0,     0,     0,     7,     0,     0,     0,     0,
00243      0,     0,     0,     0,    37,     0,    46,    58,    63,    66,
00244     39,    40,    59,    41,     0,    66,    15,     0,     0,     0,
00245      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
00246      0,     0,     4,     9,    10,    11,    12,    13,    14,     8,
00247     66,    48,     0,    65,    38,    54,    32,     0,    21,    23,
00248     19,     0,     0,     0,    17,    18,     0,     0,     0,    16,
00249     20,    22,     0,    57,    60,    66,     0,    52,    49,     0,
00250      0,     0,     0,     0,     0,     0,     0,    56,    47,    66,
00251      0,    24,    26,    28,    25,    27,    29,    30,    61,    53,
00252      0,    66,    55,     0,     0,     0
00253 };
00254 
00255 static const short yydefgoto[] = {   174,
00256     58,    43,    93,    22,   147,   148,   124,    55,   146,    51,
00257     86,     1
00258 };
00259 
00260 static const short yypact[] = {-32768,
00261    274,-32768,   176,-32768,   176,   176,   176,   176,-32768,   176,
00262    176,-32768,-32768,   176,   176,-32768,   176,-32768,   176,     6,
00263    176,-32768,-32768,-32768,   -61,   -41,   -40,   -38,   -36,   -35,
00264    -34,   -25,   -22,   -20,   -19,   -18,   -16,   -13,    -5,    20,
00265    176,   176,-32768,   118,   194,   194,   194,   194,   194,   118,
00266      6,   -24,   118,   118,   176,   194,-32768,    18,    56,    21,
00267    176,   176,   176,   176,   176,   176,   176,   176,   176,   176,
00268    176,   176,   176,   176,   176,-32768,   327,   176,   176,   176,
00269    176,   176,   176,   176,   194,    -7,   176,   194,-32768,-32768,
00270    194,   194,   194,   176,   176,-32768,-32768,   337,   347,   357,
00271    132,   143,   272,   367,   377,   283,   294,   305,   387,   397,
00272    407,   316,-32768,    86,    -4,    25,    25,    25,    25,-32768,
00273 -32768,-32768,   176,-32768,   176,   274,   194,   232,-32768,-32768,
00274 -32768,   176,   176,   176,-32768,-32768,   176,   176,   176,-32768,
00275 -32768,-32768,   176,   274,   194,    22,    65,    -1,-32768,   417,
00276    427,   437,   447,   457,   467,   477,   176,   274,-32768,-32768,
00277    176,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   194,   274,
00278     46,-32768,   274,    89,    90,-32768
00279 };
00280 
00281 static const short yypgoto[] = {-32768,
00282     40,-32768,    -3,-32768,-32768,-32768,-32768,   -43,-32768,-32768,
00283 -32768,   -73
00284 };
00285 
00286 
00287 #define YYLAST          540
00288 
00289 
00290 static const short yytable[] = {    44,
00291     60,    45,    46,    47,    48,    87,    49,    50,   121,    57,
00292     52,    53,    94,    54,   122,    56,   126,    59,   160,   161,
00293     61,    62,   128,    63,    90,    64,    65,    66,   123,    78,
00294     79,    80,    81,    82,    83,    84,    67,    76,    77,    68,
00295     85,    69,    70,    71,   125,    72,    88,   144,    73,    91,
00296     92,    80,    81,    82,    83,    84,    74,    98,    99,   100,
00297    101,   102,   103,   104,   105,   106,   107,   108,   109,   110,
00298    111,   112,   158,    96,   114,   115,   116,   117,   118,   119,
00299    120,    75,    95,    97,    84,   157,   170,   159,   175,   176,
00300     89,   127,     0,     0,   172,     0,     0,     0,   173,    78,
00301     79,    80,    81,    82,    83,    84,     0,     0,     0,    78,
00302     79,    80,    81,    82,    83,    84,     0,     0,     0,   145,
00303      0,     0,    23,    24,     0,     0,    25,     0,   150,   151,
00304    152,     0,     0,   153,   154,   155,    26,     0,     0,   156,
00305     79,    80,    81,    82,    83,    84,    27,    28,     0,     0,
00306     29,    30,    31,   169,     0,     0,     0,   171,    32,    33,
00307      0,    34,    35,    36,     0,    37,     0,    38,     0,    39,
00308     40,    78,    79,    80,    81,    82,    83,    84,    41,    42,
00309     23,    24,     0,     0,    25,    78,    79,    80,    81,    82,
00310     83,    84,     0,     0,    26,   132,    78,    79,    80,    81,
00311     82,    83,    84,     0,    27,    28,   133,     0,    29,    30,
00312     31,     0,     0,     0,     0,     0,    32,    33,     0,    34,
00313     35,    36,     0,    37,     0,    38,     0,    39,    40,     0,
00314      0,     0,     0,     0,     0,     0,    41,    42,     2,     3,
00315      0,     4,     5,     6,     7,     8,     9,    78,    79,    80,
00316     81,    82,    83,    84,     0,   149,    10,    11,    12,    13,
00317      0,     0,    14,    15,     0,     0,     0,     0,    16,     0,
00318     17,    18,     0,     0,    19,     0,     0,     0,    20,     0,
00319      2,     3,    21,     4,     5,     6,     7,     8,     9,     0,
00320      0,     0,     0,     0,     0,     0,     0,     0,    10,    11,
00321     12,    13,     0,     0,    14,    15,     0,     0,     0,     0,
00322     16,     0,    17,    18,     0,     0,    19,     0,     0,     0,
00323     20,     0,     0,     0,    21,    78,    79,    80,    81,    82,
00324     83,    84,     0,     0,     0,   134,    78,    79,    80,    81,
00325     82,    83,    84,     0,     0,     0,   137,    78,    79,    80,
00326     81,    82,    83,    84,     0,     0,     0,   138,    78,    79,
00327     80,    81,    82,    83,    84,     0,     0,     0,   139,    78,
00328     79,    80,    81,    82,    83,    84,     0,     0,     0,   143,
00329     78,    79,    80,    81,    82,    83,    84,     0,     0,   113,
00330     78,    79,    80,    81,    82,    83,    84,     0,     0,   129,
00331     78,    79,    80,    81,    82,    83,    84,     0,     0,   130,
00332     78,    79,    80,    81,    82,    83,    84,     0,     0,   131,
00333     78,    79,    80,    81,    82,    83,    84,     0,     0,   135,
00334     78,    79,    80,    81,    82,    83,    84,     0,     0,   136,
00335     78,    79,    80,    81,    82,    83,    84,     0,     0,   140,
00336     78,    79,    80,    81,    82,    83,    84,     0,     0,   141,
00337     78,    79,    80,    81,    82,    83,    84,     0,     0,   142,
00338     78,    79,    80,    81,    82,    83,    84,     0,     0,   162,
00339     78,    79,    80,    81,    82,    83,    84,     0,     0,   163,
00340     78,    79,    80,    81,    82,    83,    84,     0,     0,   164,
00341     78,    79,    80,    81,    82,    83,    84,     0,     0,   165,
00342     78,    79,    80,    81,    82,    83,    84,     0,     0,   166,
00343     78,    79,    80,    81,    82,    83,    84,     0,     0,   167,
00344     78,    79,    80,    81,    82,    83,    84,     0,     0,   168
00345 };
00346 
00347 static const short yycheck[] = {     3,
00348     62,     5,     6,     7,     8,    49,    10,    11,    16,     4,
00349     14,    15,    56,    17,    22,    19,    90,    21,    20,    21,
00350     62,    62,    96,    62,    49,    62,    62,    62,    36,    54,
00351     55,    56,    57,    58,    59,    60,    62,    41,    42,    62,
00352     44,    62,    62,    62,    88,    62,    50,   121,    62,    53,
00353     54,    56,    57,    58,    59,    60,    62,    61,    62,    63,
00354     64,    65,    66,    67,    68,    69,    70,    71,    72,    73,
00355     74,    75,   146,    18,    78,    79,    80,    81,    82,    83,
00356     84,    62,    65,    63,    60,    64,   160,    23,     0,     0,
00357     51,    95,    -1,    -1,    49,    -1,    -1,    -1,   172,    54,
00358     55,    56,    57,    58,    59,    60,    -1,    -1,    -1,    54,
00359     55,    56,    57,    58,    59,    60,    -1,    -1,    -1,   123,
00360     -1,    -1,     5,     6,    -1,    -1,     9,    -1,   132,   133,
00361    134,    -1,    -1,   137,   138,   139,    19,    -1,    -1,   143,
00362     55,    56,    57,    58,    59,    60,    29,    30,    -1,    -1,
00363     33,    34,    35,   157,    -1,    -1,    -1,   161,    41,    42,
00364     -1,    44,    45,    46,    -1,    48,    -1,    50,    -1,    52,
00365     53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
00366      5,     6,    -1,    -1,     9,    54,    55,    56,    57,    58,
00367     59,    60,    -1,    -1,    19,    64,    54,    55,    56,    57,
00368     58,    59,    60,    -1,    29,    30,    64,    -1,    33,    34,
00369     35,    -1,    -1,    -1,    -1,    -1,    41,    42,    -1,    44,
00370     45,    46,    -1,    48,    -1,    50,    -1,    52,    53,    -1,
00371     -1,    -1,    -1,    -1,    -1,    -1,    61,    62,     7,     8,
00372     -1,    10,    11,    12,    13,    14,    15,    54,    55,    56,
00373     57,    58,    59,    60,    -1,    24,    25,    26,    27,    28,
00374     -1,    -1,    31,    32,    -1,    -1,    -1,    -1,    37,    -1,
00375     39,    40,    -1,    -1,    43,    -1,    -1,    -1,    47,    -1,
00376      7,     8,    51,    10,    11,    12,    13,    14,    15,    -1,
00377     -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    25,    26,
00378     27,    28,    -1,    -1,    31,    32,    -1,    -1,    -1,    -1,
00379     37,    -1,    39,    40,    -1,    -1,    43,    -1,    -1,    -1,
00380     47,    -1,    -1,    -1,    51,    54,    55,    56,    57,    58,
00381     59,    60,    -1,    -1,    -1,    64,    54,    55,    56,    57,
00382     58,    59,    60,    -1,    -1,    -1,    64,    54,    55,    56,
00383     57,    58,    59,    60,    -1,    -1,    -1,    64,    54,    55,
00384     56,    57,    58,    59,    60,    -1,    -1,    -1,    64,    54,
00385     55,    56,    57,    58,    59,    60,    -1,    -1,    -1,    64,
00386     54,    55,    56,    57,    58,    59,    60,    -1,    -1,    63,
00387     54,    55,    56,    57,    58,    59,    60,    -1,    -1,    63,
00388     54,    55,    56,    57,    58,    59,    60,    -1,    -1,    63,
00389     54,    55,    56,    57,    58,    59,    60,    -1,    -1,    63,
00390     54,    55,    56,    57,    58,    59,    60,    -1,    -1,    63,
00391     54,    55,    56,    57,    58,    59,    60,    -1,    -1,    63,
00392     54,    55,    56,    57,    58,    59,    60,    -1,    -1,    63,
00393     54,    55,    56,    57,    58,    59,    60,    -1,    -1,    63,
00394     54,    55,    56,    57,    58,    59,    60,    -1,    -1,    63,
00395     54,    55,    56,    57,    58,    59,    60,    -1,    -1,    63,
00396     54,    55,    56,    57,    58,    59,    60,    -1,    -1,    63,
00397     54,    55,    56,    57,    58,    59,    60,    -1,    -1,    63,
00398     54,    55,    56,    57,    58,    59,    60,    -1,    -1,    63,
00399     54,    55,    56,    57,    58,    59,    60,    -1,    -1,    63,
00400     54,    55,    56,    57,    58,    59,    60,    -1,    -1,    63,
00401     54,    55,    56,    57,    58,    59,    60,    -1,    -1,    63
00402 };
00403 /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
00404 #line 3 "/afs/bp.ncsu.edu/contrib/gnu/share/bison.simple"
00405 /* This file comes from bison-1.28.  */
00406 
00407 /* Skeleton output parser for bison,
00408    Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
00409 
00410    This program is free software; you can redistribute it and/or modify
00411    it under the terms of the GNU General Public License as published by
00412    the Free Software Foundation; either version 2, or (at your option)
00413    any later version.
00414 
00415    This program is distributed in the hope that it will be useful,
00416    but WITHOUT ANY WARRANTY; without even the implied warranty of
00417    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00418    GNU General Public License for more details.
00419 
00420    You should have received a copy of the GNU General Public License
00421    along with this program; if not, write to the Free Software
00422    Foundation, Inc., 59 Temple Place - Suite 330,
00423    Boston, MA 02111-1307, USA.  */
00424 
00425 /* As a special exception, when this file is copied by Bison into a
00426    Bison output file, you may use that output file without restriction.
00427    This special exception was added by the Free Software Foundation
00428    in version 1.24 of Bison.  */
00429 
00430 /* This is the parser code that is written into each bison parser
00431   when the %semantic_parser declaration is not specified in the grammar.
00432   It was written by Richard Stallman by simplifying the hairy parser
00433   used when %semantic_parser is specified.  */
00434 
00435 #ifndef YYSTACK_USE_ALLOCA
00436 #ifdef alloca
00437 #define YYSTACK_USE_ALLOCA
00438 #else /* alloca not defined */
00439 #ifdef __GNUC__
00440 #define YYSTACK_USE_ALLOCA
00441 #define alloca __builtin_alloca
00442 #else /* not GNU C.  */
00443 #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
00444 #define YYSTACK_USE_ALLOCA
00445 #include <alloca.h>
00446 #else /* not sparc */
00447 /* We think this test detects Watcom and Microsoft C.  */
00448 /* This used to test MSDOS, but that is a bad idea
00449    since that symbol is in the user namespace.  */
00450 #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
00451 #if 0 /* No need for malloc.h, which pollutes the namespace;
00452          instead, just don't use alloca.  */
00453 #include <malloc.h>
00454 #endif
00455 #else /* not MSDOS, or __TURBOC__ */
00456 #if defined(_AIX)
00457 /* I don't know what this was needed for, but it pollutes the namespace.
00458    So I turned it off.   rms, 2 May 1997.  */
00459 /* #include <malloc.h>  */
00460  #pragma alloca
00461 #define YYSTACK_USE_ALLOCA
00462 #else /* not MSDOS, or __TURBOC__, or _AIX */
00463 #if 0
00464 #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
00465                  and on HPUX 10.  Eventually we can turn this on.  */
00466 #define YYSTACK_USE_ALLOCA
00467 #define alloca __builtin_alloca
00468 #endif /* __hpux */
00469 #endif
00470 #endif /* not _AIX */
00471 #endif /* not MSDOS, or __TURBOC__ */
00472 #endif /* not sparc */
00473 #endif /* not GNU C */
00474 #endif /* alloca not defined */
00475 #endif /* YYSTACK_USE_ALLOCA not defined */
00476 
00477 #ifdef YYSTACK_USE_ALLOCA
00478 #define YYSTACK_ALLOC alloca
00479 #else
00480 #define YYSTACK_ALLOC malloc
00481 #endif
00482 
00483 /* Note: there must be only one dollar sign in this file.
00484    It is replaced by the list of actions, each action
00485    as one case of the switch.  */
00486 
00487 #define yyerrok         (yyerrstatus = 0)
00488 #define yyclearin       (yychar = YYEMPTY)
00489 #define YYEMPTY         -2
00490 #define YYEOF           0
00491 #define YYACCEPT        goto yyacceptlab
00492 #define YYABORT         goto yyabortlab
00493 #define YYERROR         goto yyerrlab1
00494 /* Like YYERROR except do call yyerror.
00495    This remains here temporarily to ease the
00496    transition to the new meaning of YYERROR, for GCC.
00497    Once GCC version 2 has supplanted version 1, this can go.  */
00498 #define YYFAIL          goto yyerrlab
00499 #define YYRECOVERING()  (!!yyerrstatus)
00500 #define YYBACKUP(token, value) \
00501 do                                                              \
00502   if (yychar == YYEMPTY && yylen == 1)                          \
00503     { yychar = (token), yylval = (value);                       \
00504       yychar1 = YYTRANSLATE (yychar);                           \
00505       YYPOPSTACK;                                               \
00506       goto yybackup;                                            \
00507     }                                                           \
00508   else                                                          \
00509     { yyerror ("syntax error: cannot back up"); YYERROR; }      \
00510 while (0)
00511 
00512 #define YYTERROR        1
00513 #define YYERRCODE       256
00514 
00515 #ifndef YYPURE
00516 #define YYLEX           yylex()
00517 #endif
00518 
00519 #ifdef YYPURE
00520 #ifdef YYLSP_NEEDED
00521 #ifdef YYLEX_PARAM
00522 #define YYLEX           yylex(&yylval, &yylloc, YYLEX_PARAM)
00523 #else
00524 #define YYLEX           yylex(&yylval, &yylloc)
00525 #endif
00526 #else /* not YYLSP_NEEDED */
00527 #ifdef YYLEX_PARAM
00528 #define YYLEX           yylex(&yylval, YYLEX_PARAM)
00529 #else
00530 #define YYLEX           yylex(&yylval)
00531 #endif
00532 #endif /* not YYLSP_NEEDED */
00533 #endif
00534 
00535 /* If nonreentrant, generate the variables here */
00536 
00537 #ifndef YYPURE
00538 
00539 int     yychar;                 /*  the lookahead symbol                */
00540 YYSTYPE yylval;                 /*  the semantic value of the           */
00541                                 /*  lookahead symbol                    */
00542 
00543 #ifdef YYLSP_NEEDED
00544 YYLTYPE yylloc;                 /*  location data for the lookahead     */
00545                                 /*  symbol                              */
00546 #endif
00547 
00548 int yynerrs;                    /*  number of parse errors so far       */
00549 #endif  /* not YYPURE */
00550 
00551 #if YYDEBUG != 0
00552 int yydebug;                    /*  nonzero means print parse trace     */
00553 /* Since this is uninitialized, it does not stop multiple parsers
00554    from coexisting.  */
00555 #endif
00556 
00557 /*  YYINITDEPTH indicates the initial size of the parser's stacks       */
00558 
00559 #ifndef YYINITDEPTH
00560 #define YYINITDEPTH 200
00561 #endif
00562 
00563 /*  YYMAXDEPTH is the maximum size the stacks can grow to
00564     (effective only if the built-in stack extension method is used).  */
00565 
00566 #if YYMAXDEPTH == 0
00567 #undef YYMAXDEPTH
00568 #endif
00569 
00570 #ifndef YYMAXDEPTH
00571 #define YYMAXDEPTH 10000
00572 #endif
00573 
00574 /* Define __yy_memcpy.  Note that the size argument
00575    should be passed with type unsigned int, because that is what the non-GCC
00576    definitions require.  With GCC, __builtin_memcpy takes an arg
00577    of type size_t, but it can handle unsigned int.  */
00578 
00579 #if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
00580 #define __yy_memcpy(TO,FROM,COUNT)      __builtin_memcpy(TO,FROM,COUNT)
00581 #else                           /* not GNU C or C++ */
00582 #ifndef __cplusplus
00583 
00584 /* This is the most reliable way to avoid incompatibilities
00585    in available built-in functions on various systems.  */
00586 static void
00587 __yy_memcpy (to, from, count)
00588      char *to;
00589      char *from;
00590      unsigned int count;
00591 {
00592   register char *f = from;
00593   register char *t = to;
00594   register int i = count;
00595 
00596   while (i-- > 0)
00597     *t++ = *f++;
00598 }
00599 
00600 #else /* __cplusplus */
00601 
00602 /* This is the most reliable way to avoid incompatibilities
00603    in available built-in functions on various systems.  */
00604 static void
00605 __yy_memcpy (char *to, char *from, unsigned int count)
00606 {
00607   register char *t = to;
00608   register char *f = from;
00609   register int i = count;
00610 
00611   while (i-- > 0)
00612     *t++ = *f++;
00613 }
00614 
00615 #endif
00616 #endif
00617 
00618 #line 217 "/afs/bp.ncsu.edu/contrib/gnu/share/bison.simple"
00619 
00620 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
00621    into yyparse.  The argument should have type void *.
00622    It should actually point to an object.
00623    Grammar actions can access the variable by casting it
00624    to the proper pointer type.  */
00625 
00626 #ifdef YYPARSE_PARAM
00627 #ifdef __cplusplus
00628 #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
00629 #define YYPARSE_PARAM_DECL
00630 #else /* not __cplusplus */
00631 #define YYPARSE_PARAM_ARG YYPARSE_PARAM
00632 #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
00633 #endif /* not __cplusplus */
00634 #else /* not YYPARSE_PARAM */
00635 #define YYPARSE_PARAM_ARG
00636 #define YYPARSE_PARAM_DECL
00637 #endif /* not YYPARSE_PARAM */
00638 
00639 /* Prevent warning if -Wstrict-prototypes.  */
00640 #ifdef __GNUC__
00641 #ifdef YYPARSE_PARAM
00642 int yyparse (void *);
00643 #else
00644 int yyparse (void);
00645 #endif
00646 #endif
00647 
00648 int
00649 yyparse(YYPARSE_PARAM_ARG)
00650      YYPARSE_PARAM_DECL
00651 {
00652   register int yystate;
00653   register int yyn;
00654   register short *yyssp;
00655   register YYSTYPE *yyvsp;
00656   int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
00657   int yychar1 = 0;              /*  lookahead token as an internal (translated) token number */
00658 
00659   short yyssa[YYINITDEPTH];     /*  the state stack                     */
00660   YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack            */
00661 
00662   short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
00663   YYSTYPE *yyvs = yyvsa;        /*  to allow yyoverflow to reallocate them elsewhere */
00664 
00665 #ifdef YYLSP_NEEDED
00666   YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack                  */
00667   YYLTYPE *yyls = yylsa;
00668   YYLTYPE *yylsp;
00669 
00670 #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
00671 #else
00672 #define YYPOPSTACK   (yyvsp--, yyssp--)
00673 #endif
00674 
00675   int yystacksize = YYINITDEPTH;
00676   int yyfree_stacks = 0;
00677 
00678 #ifdef YYPURE
00679   int yychar;
00680   YYSTYPE yylval;
00681   int yynerrs;
00682 #ifdef YYLSP_NEEDED
00683   YYLTYPE yylloc;
00684 #endif
00685 #endif
00686 
00687   YYSTYPE yyval;                /*  the variable used to return         */
00688                                 /*  semantic values from the action     */
00689                                 /*  routines                            */
00690 
00691   int yylen;
00692 
00693 #if YYDEBUG != 0
00694   if (yydebug)
00695     fprintf(stderr, "Starting parse\n");
00696 #endif
00697 
00698   yystate = 0;
00699   yyerrstatus = 0;
00700   yynerrs = 0;
00701   yychar = YYEMPTY;             /* Cause a token to be read.  */
00702 
00703   /* Initialize stack pointers.
00704      Waste one element of value and location stack
00705      so that they stay on the same level as the state stack.
00706      The wasted elements are never initialized.  */
00707 
00708   yyssp = yyss - 1;
00709   yyvsp = yyvs;
00710 #ifdef YYLSP_NEEDED
00711   yylsp = yyls;
00712 #endif
00713 
00714 /* Push a new state, which is found in  yystate  .  */
00715 /* In all cases, when you get here, the value and location stacks
00716    have just been pushed. so pushing a state here evens the stacks.  */
00717 yynewstate:
00718 
00719   *++yyssp = yystate;
00720 
00721   if (yyssp >= yyss + yystacksize - 1)
00722     {
00723       /* Give user a chance to reallocate the stack */
00724       /* Use copies of these so that the &'s don't force the real ones into memory. */
00725       YYSTYPE *yyvs1 = yyvs;
00726       short *yyss1 = yyss;
00727 #ifdef YYLSP_NEEDED
00728       YYLTYPE *yyls1 = yyls;
00729 #endif
00730 
00731       /* Get the current used size of the three stacks, in elements.  */
00732       int size = yyssp - yyss + 1;
00733 
00734 #ifdef yyoverflow
00735       /* Each stack pointer address is followed by the size of
00736          the data in use in that stack, in bytes.  */
00737 #ifdef YYLSP_NEEDED
00738       /* This used to be a conditional around just the two extra args,
00739          but that might be undefined if yyoverflow is a macro.  */
00740       yyoverflow("parser stack overflow",
00741                  &yyss1, size * sizeof (*yyssp),
00742                  &yyvs1, size * sizeof (*yyvsp),
00743                  &yyls1, size * sizeof (*yylsp),
00744                  &yystacksize);
00745 #else
00746       yyoverflow("parser stack overflow",
00747                  &yyss1, size * sizeof (*yyssp),
00748                  &yyvs1, size * sizeof (*yyvsp),
00749                  &yystacksize);
00750 #endif
00751 
00752       yyss = yyss1; yyvs = yyvs1;
00753 #ifdef YYLSP_NEEDED
00754       yyls = yyls1;
00755 #endif
00756 #else /* no yyoverflow */
00757       /* Extend the stack our own way.  */
00758       if (yystacksize >= YYMAXDEPTH)
00759         {
00760           yyerror("parser stack overflow");
00761           if (yyfree_stacks)
00762             {
00763               free (yyss);
00764               free (yyvs);
00765 #ifdef YYLSP_NEEDED
00766               free (yyls);
00767 #endif
00768             }
00769           return 2;
00770         }
00771       yystacksize *= 2;
00772       if (yystacksize > YYMAXDEPTH)
00773         yystacksize = YYMAXDEPTH;
00774 #ifndef YYSTACK_USE_ALLOCA
00775       yyfree_stacks = 1;
00776 #endif
00777       yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
00778       __yy_memcpy ((char *)yyss, (char *)yyss1,
00779                    size * (unsigned int) sizeof (*yyssp));
00780       yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
00781       __yy_memcpy ((char *)yyvs, (char *)yyvs1,
00782                    size * (unsigned int) sizeof (*yyvsp));
00783 #ifdef YYLSP_NEEDED
00784       yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
00785       __yy_memcpy ((char *)yyls, (char *)yyls1,
00786                    size * (unsigned int) sizeof (*yylsp));
00787 #endif
00788 #endif /* no yyoverflow */
00789 
00790       yyssp = yyss + size - 1;
00791       yyvsp = yyvs + size - 1;
00792 #ifdef YYLSP_NEEDED
00793       yylsp = yyls + size - 1;
00794 #endif
00795 
00796 #if YYDEBUG != 0
00797       if (yydebug)
00798         fprintf(stderr, "Stack size increased to %d\n", yystacksize);
00799 #endif
00800 
00801       if (yyssp >= yyss + yystacksize - 1)
00802         YYABORT;
00803     }
00804 
00805 #if YYDEBUG != 0
00806   if (yydebug)
00807     fprintf(stderr, "Entering state %d\n", yystate);
00808 #endif
00809 
00810   goto yybackup;
00811  yybackup:
00812 
00813 /* Do appropriate processing given the current state.  */
00814 /* Read a lookahead token if we need one and don't already have one.  */
00815 /* yyresume: */
00816 
00817   /* First try to decide what to do without reference to lookahead token.  */
00818 
00819   yyn = yypact[yystate];
00820   if (yyn == YYFLAG)
00821     goto yydefault;
00822 
00823   /* Not known => get a lookahead token if don't already have one.  */
00824 
00825   /* yychar is either YYEMPTY or YYEOF
00826      or a valid token in external form.  */
00827 
00828   if (yychar == YYEMPTY)
00829     {
00830 #if YYDEBUG != 0
00831       if (yydebug)
00832         fprintf(stderr, "Reading a token: ");
00833 #endif
00834       yychar = YYLEX;
00835     }
00836 
00837   /* Convert token to internal form (in yychar1) for indexing tables with */
00838 
00839   if (yychar <= 0)              /* This means end of input. */
00840     {
00841       yychar1 = 0;
00842       yychar = YYEOF;           /* Don't call YYLEX any more */
00843 
00844 #if YYDEBUG != 0
00845       if (yydebug)
00846         fprintf(stderr, "Now at end of input.\n");
00847 #endif
00848     }
00849   else
00850     {
00851       yychar1 = YYTRANSLATE(yychar);
00852 
00853 #if YYDEBUG != 0
00854       if (yydebug)
00855         {
00856           fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
00857           /* Give the individual parser a way to print the precise meaning
00858              of a token, for further debugging info.  */
00859 #ifdef YYPRINT
00860           YYPRINT (stderr, yychar, yylval);
00861 #endif
00862           fprintf (stderr, ")\n");
00863         }
00864 #endif
00865     }
00866 
00867   yyn += yychar1;
00868   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
00869     goto yydefault;
00870 
00871   yyn = yytable[yyn];
00872 
00873   /* yyn is what to do for this token type in this state.
00874      Negative => reduce, -yyn is rule number.
00875      Positive => shift, yyn is new state.
00876        New state is final state => don't bother to shift,
00877        just return success.
00878      0, or most negative number => error.  */
00879 
00880   if (yyn < 0)
00881     {
00882       if (yyn == YYFLAG)
00883         goto yyerrlab;
00884       yyn = -yyn;
00885       goto yyreduce;
00886     }
00887   else if (yyn == 0)
00888     goto yyerrlab;
00889 
00890   if (yyn == YYFINAL)
00891     YYACCEPT;
00892 
00893   /* Shift the lookahead token.  */
00894 
00895 #if YYDEBUG != 0
00896   if (yydebug)
00897     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
00898 #endif
00899 
00900   /* Discard the token being shifted unless it is eof.  */
00901   if (yychar != YYEOF)
00902     yychar = YYEMPTY;
00903 
00904   *++yyvsp = yylval;
00905 #ifdef YYLSP_NEEDED
00906   *++yylsp = yylloc;
00907 #endif
00908 
00909   /* count tokens shifted since error; after three, turn off error status.  */
00910   if (yyerrstatus) yyerrstatus--;
00911 
00912   yystate = yyn;
00913   goto yynewstate;
00914 
00915 /* Do the default action for the current state.  */
00916 yydefault:
00917 
00918   yyn = yydefact[yystate];
00919   if (yyn == 0)
00920     goto yyerrlab;
00921 
00922 /* Do a reduction.  yyn is the number of a rule to reduce with.  */
00923 yyreduce:
00924   yylen = yyr2[yyn];
00925   if (yylen > 0)
00926     yyval = yyvsp[1-yylen]; /* implement default value of the action */
00927 
00928 #if YYDEBUG != 0
00929   if (yydebug)
00930     {
00931       int i;
00932 
00933       fprintf (stderr, "Reducing via rule %d (line %d), ",
00934                yyn, yyrline[yyn]);
00935 
00936       /* Print the symbols being reduced, and their result.  */
00937       for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
00938         fprintf (stderr, "%s ", yytname[yyrhs[i]]);
00939       fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
00940     }
00941 #endif
00942 
00943 
00944   switch (yyn) {
00945 
00946 case 1:
00947 #line 60 "parser.y"
00948 { the_program = reverse_list_of_nodes(yyvsp[0].node);
00949           yyval.node = the_program; ;
00950     break;}
00951 case 2:
00952 #line 65 "parser.y"
00953 { yyval.node = node_create_string_constant(VARNAME_OPCODE, yyvsp[0].text); ;
00954     break;}
00955 case 3:
00956 #line 69 "parser.y"
00957 { yyval.node = node_create_string_constant(STRING_CONSTANT_OPCODE, yyvsp[0].text); ;
00958     break;}
00959 case 4:
00960 #line 73 "parser.y"
00961 { yyval.node = yyvsp[-1].node; ;
00962     break;}
00963 case 5:
00964 #line 76 "parser.y"
00965 { yyval.node = yyvsp[0].node; ;
00966     break;}
00967 case 6:
00968 #line 78 "parser.y"
00969 { yyval.node = node_create_string_constant(VARREF_OPCODE, yyvsp[0].text); ;
00970     break;}
00971 case 7:
00972 #line 81 "parser.y"
00973 { yyval.node = node_create_unary(NOT_OPCODE, yyvsp[0].node); ;
00974     break;}
00975 case 8:
00976 #line 84 "parser.y"
00977 { yyval.node = node_create_binary(PLUS_OPCODE, yyvsp[-2].node, yyvsp[0].node); ;
00978     break;}
00979 case 9:
00980 #line 86 "parser.y"
00981 { yyval.node = node_create_binary(OR_OPCODE, yyvsp[-2].node, yyvsp[0].node); ;
00982     break;}
00983 case 10:
00984 #line 88 "parser.y"
00985 { yyval.node = node_create_binary(AND_OPCODE, yyvsp[-2].node, yyvsp[0].node); ;
00986     break;}
00987 case 11:
00988 #line 90 "parser.y"
00989 { yyval.node = node_create_binary(EQ_OPCODE, yyvsp[-2].node, yyvsp[0].node); ;
00990     break;}
00991 case 12:
00992 #line 92 "parser.y"
00993 { yyval.node = node_create_binary(NEQ_OPCODE, yyvsp[-2].node, yyvsp[0].node); ;
00994     break;}
00995 case 13:
00996 #line 94 "parser.y"
00997 { yyval.node = node_create_binary(REGEQ_OPCODE, yyvsp[-2].node, yyvsp[0].node); ;
00998     break;}
00999 case 14:
01000 #line 96 "parser.y"
01001 { yyval.node = node_create_binary(REGNEQ_OPCODE, yyvsp[-2].node, yyvsp[0].node); ;
01002     break;}
01003 case 15:
01004 #line 99 "parser.y"
01005 { yyval.node = node_create_noary(BUFFER_OPCODE); ;
01006     break;}
01007 case 16:
01008 #line 102 "parser.y"
01009 { yyval.node = node_create_unary(SUBSTITUTE_OPCODE, yyvsp[-1].node); ;
01010     break;}
01011 case 17:
01012 #line 104 "parser.y"
01013 { yyval.node = node_create_unary(PROTECT_OPCODE, yyvsp[-1].node); ;
01014     break;}
01015 case 18:
01016 #line 106 "parser.y"
01017 { yyval.node = node_create_unary(VERBATIM_OPCODE, yyvsp[-1].node); ;
01018     break;}
01019 case 19:
01020 #line 108 "parser.y"
01021 { yyval.node = node_create_unary(GETENV_OPCODE, yyvsp[-1].node); ;
01022     break;}
01023 case 20:
01024 #line 110 "parser.y"
01025 { yyval.node = node_create_unary(UPCASE_OPCODE, yyvsp[-1].node); ;
01026     break;}
01027 case 21:
01028 #line 112 "parser.y"
01029 { yyval.node = node_create_unary(DOWNCASE_OPCODE, yyvsp[-1].node); ;
01030     break;}
01031 case 22:
01032 #line 114 "parser.y"
01033 { yyval.node = node_create_unary(JVAR_OPCODE, yyvsp[-1].node); ;
01034     break;}
01035 case 23:
01036 #line 116 "parser.y"
01037 { yyval.node = node_create_unary(GET_OPCODE, yyvsp[-1].node); ;
01038     break;}
01039 case 24:
01040 #line 119 "parser.y"
01041 { yyval.node = node_create_binary(LANY_OPCODE, yyvsp[-3].node, yyvsp[-1].node ); ;
01042     break;}
01043 case 25:
01044 #line 121 "parser.y"
01045 { yyval.node = node_create_binary(RANY_OPCODE, yyvsp[-3].node, yyvsp[-1].node ); ;
01046     break;}
01047 case 26:
01048 #line 123 "parser.y"
01049 { yyval.node = node_create_binary(LBREAK_OPCODE, yyvsp[-3].node, yyvsp[-1].node ); ;
01050     break;}
01051 case 27:
01052 #line 125 "parser.y"
01053 { yyval.node = node_create_binary(RBREAK_OPCODE, yyvsp[-3].node, yyvsp[-1].node ); ;
01054     break;}
01055 case 28:
01056 #line 127 "parser.y"
01057 { yyval.node = node_create_binary(LSPAN_OPCODE, yyvsp[-3].node, yyvsp[-1].node ); ;
01058     break;}
01059 case 29:
01060 #line 129 "parser.y"
01061 { yyval.node = node_create_binary(RSPAN_OPCODE, yyvsp[-3].node, yyvsp[-1].node ); ;
01062     break;}
01063 case 30:
01064 #line 131 "parser.y"
01065 { yyval.node = node_create_binary(PARAGRAPH_OPCODE, yyvsp[-3].node, yyvsp[-1].node ); ;
01066     break;}
01067 case 31:
01068 #line 135 "parser.y"
01069 { yyval.node = node_create_noary(NOOP_OPCODE); ;
01070     break;}
01071 case 32:
01072 #line 137 "parser.y"
01073 { yyval.node = node_create_binary(SET_OPCODE, yyvsp[-2].node, yyvsp[0].node); ;
01074     break;}
01075 case 33:
01076 #line 139 "parser.y"
01077 { yyval.node = node_create_unary(FIELDS_OPCODE,
01078                                        reverse_list_of_nodes(yyvsp[0].node)); ;
01079     break;}
01080 case 34:
01081 #line 146 "parser.y"
01082 { yyval.node = node_create_unary(PRINT_OPCODE,
01083                                        reverse_list_of_nodes(yyvsp[0].node)); ;
01084     break;}
01085 case 35:
01086 #line 149 "parser.y"
01087 { yyval.node = node_create_unary(PRINT_OPCODE,
01088                        node_create_unary(SUBSTITUTE_OPCODE,
01089                          node_create_string_constant(STRING_CONSTANT_OPCODE,
01090                                                      yyvsp[0].text))); ;
01091     break;}
01092 case 36:
01093 #line 154 "parser.y"
01094 { yyval.node = node_create_noary(CLEARBUF_OPCODE); ;
01095     break;}
01096 case 37:
01097 #line 160 "parser.y"
01098 { yyval.node = node_create_binary(APPENDPORT_OPCODE, yyvsp[-1].node, yyvsp[0].node); ;
01099     break;}
01100 case 38:
01101 #line 162 "parser.y"
01102 { yyvsp[-1].node->next = reverse_list_of_nodes(yyvsp[0].node);
01103                 yyval.node = node_create_binary(EXECPORT_OPCODE, yyvsp[-2].node, yyvsp[-1].node); ;
01104     break;}
01105 case 39:
01106 #line 165 "parser.y"
01107 { yyval.node = node_create_binary(INPUTPORT_OPCODE, yyvsp[-1].node, yyvsp[0].node); ;
01108     break;}
01109 case 40:
01110 #line 167 "parser.y"
01111 { yyval.node = node_create_binary(OUTPUTPORT_OPCODE, yyvsp[-1].node, yyvsp[0].node); ;
01112     break;}
01113 case 41:
01114 #line 169 "parser.y"
01115 { yyval.node = node_create_binary(PUT_OPCODE, yyvsp[-1].node,
01116                                         reverse_list_of_nodes(yyvsp[0].node)); ;
01117     break;}
01118 case 42:
01119 #line 172 "parser.y"
01120 { yyval.node = node_create_binary(PUT_OPCODE, 0, 0); ;
01121     break;}
01122 case 43:
01123 #line 174 "parser.y"
01124 { yyval.node = node_create_unary(CLOSEINPUT_OPCODE, yyvsp[0].node); ;
01125     break;}
01126 case 44:
01127 #line 176 "parser.y"
01128 { yyval.node = node_create_unary(CLOSEOUTPUT_OPCODE, yyvsp[0].node); ;
01129     break;}
01130 case 45:
01131 #line 178 "parser.y"
01132 { yyval.node = node_create_unary(CLOSEPORT_OPCODE, yyvsp[0].node); ;
01133     break;}
01134 case 46:
01135 #line 184 "parser.y"
01136 { yyvsp[-1].node->next = reverse_list_of_nodes(yyvsp[0].node);
01137                 yyval.node = node_create_unary(EXEC_OPCODE, yyvsp[-1].node); ;
01138     break;}
01139 case 47:
01140 #line 191 "parser.y"
01141 { Node *n = node_create_binary(IF_OPCODE, yyvsp[-4].node,
01142                                              reverse_list_of_nodes(yyvsp[-2].node));
01143                 n->next = yyvsp[-1].node;
01144                 yyval.node = node_create_unary(IF_STMT_OPCODE, n); ;
01145     break;}
01146 case 48:
01147 #line 196 "parser.y"
01148 { yyval.node = node_create_binary(CASE_OPCODE, yyvsp[-2].node,
01149                                         reverse_list_of_nodes(yyvsp[-1].node)); ;
01150     break;}
01151 case 49:
01152 #line 199 "parser.y"
01153 { yyval.node = node_create_binary(WHILE_OPCODE, yyvsp[-3].node,
01154                                         reverse_list_of_nodes(yyvsp[-1].node)); ;
01155     break;}
01156 case 50:
01157 #line 202 "parser.y"
01158 { yyval.node = node_create_noary(BREAK_OPCODE); ;
01159     break;}
01160 case 51:
01161 #line 204 "parser.y"
01162 { yyval.node = node_create_noary(EXIT_OPCODE); ;
01163     break;}
01164 case 52:
01165 #line 208 "parser.y"
01166 { yyval.node = reverse_list_of_nodes(yyvsp[0].node); ;
01167     break;}
01168 case 53:
01169 #line 210 "parser.y"
01170 { yyval.node = node_create_binary(ELSE_OPCODE, 0,
01171                                           reverse_list_of_nodes(yyvsp[0].node));
01172                   yyval.node->next = yyvsp[-2].node;
01173                   yyval.node = reverse_list_of_nodes(yyval.node); ;
01174     break;}
01175 case 54:
01176 #line 218 "parser.y"
01177 { yyval.node = 0; ;
01178     break;}
01179 case 55:
01180 #line 220 "parser.y"
01181 { yyval.node = node_create_binary(ELSEIF_OPCODE, yyvsp[-2].node,
01182                                           reverse_list_of_nodes(yyvsp[0].node));
01183                   yyval.node->next = yyvsp[-4].node; ;
01184     break;}
01185 case 56:
01186 #line 226 "parser.y"
01187 { yyval.node = node_create_binary(MATCHLIST_OPCODE,
01188                                           reverse_list_of_nodes(yyvsp[-1].node),
01189                                           reverse_list_of_nodes(yyvsp[0].node)); ;
01190     break;}
01191 case 57:
01192 #line 230 "parser.y"
01193 { yyval.node = node_create_binary(DEFAULT_OPCODE, 0,
01194                                           reverse_list_of_nodes(yyvsp[0].node)); ;
01195     break;}
01196 case 58:
01197 #line 245 "parser.y"
01198 { yyval.node = 0; ;
01199     break;}
01200 case 59:
01201 #line 247 "parser.y"
01202 { yyval.node = yyvsp[0].node;
01203                yyval.node->next = yyvsp[-1].node; ;
01204     break;}
01205 case 60:
01206 #line 252 "parser.y"
01207 { yyval.node = yyvsp[0].node; ;
01208     break;}
01209 case 61:
01210 #line 254 "parser.y"
01211 { yyval.node = yyvsp[0].node;
01212                    yyval.node->next = yyvsp[-2].node; ;
01213     break;}
01214 case 62:
01215 #line 259 "parser.y"
01216 { yyval.node = 0; ;
01217     break;}
01218 case 63:
01219 #line 261 "parser.y"
01220 { yyval.node = yyvsp[0].node;
01221                yyval.node->next = yyvsp[-1].node; ;
01222     break;}
01223 case 64:
01224 #line 266 "parser.y"
01225 { yyval.node = 0; ;
01226     break;}
01227 case 65:
01228 #line 268 "parser.y"
01229 { yyval.node = yyvsp[0].node;
01230                   yyval.node->next = yyvsp[-1].node; ;
01231     break;}
01232 case 66:
01233 #line 273 "parser.y"
01234 { yyval.node = 0; ;
01235     break;}
01236 case 67:
01237 #line 275 "parser.y"
01238 { yyval.node = yyvsp[0].node;
01239           yyval.node->next = yyvsp[-1].node; ;
01240     break;}
01241 }
01242    /* the action file gets copied in in place of this dollarsign */
01243 #line 543 "/afs/bp.ncsu.edu/contrib/gnu/share/bison.simple"
01244 
01245   yyvsp -= yylen;
01246   yyssp -= yylen;
01247 #ifdef YYLSP_NEEDED
01248   yylsp -= yylen;
01249 #endif
01250 
01251 #if YYDEBUG != 0
01252   if (yydebug)
01253     {
01254       short *ssp1 = yyss - 1;
01255       fprintf (stderr, "state stack now");
01256       while (ssp1 != yyssp)
01257         fprintf (stderr, " %d", *++ssp1);
01258       fprintf (stderr, "\n");
01259     }
01260 #endif
01261 
01262   *++yyvsp = yyval;
01263 
01264 #ifdef YYLSP_NEEDED
01265   yylsp++;
01266   if (yylen == 0)
01267     {
01268       yylsp->first_line = yylloc.first_line;
01269       yylsp->first_column = yylloc.first_column;
01270       yylsp->last_line = (yylsp-1)->last_line;
01271       yylsp->last_column = (yylsp-1)->last_column;
01272       yylsp->text = 0;
01273     }
01274   else
01275     {
01276       yylsp->last_line = (yylsp+yylen-1)->last_line;
01277       yylsp->last_column = (yylsp+yylen-1)->last_column;
01278     }
01279 #endif
01280 
01281   /* Now "shift" the result of the reduction.
01282      Determine what state that goes to,
01283      based on the state we popped back to
01284      and the rule number reduced by.  */
01285 
01286   yyn = yyr1[yyn];
01287 
01288   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
01289   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
01290     yystate = yytable[yystate];
01291   else
01292     yystate = yydefgoto[yyn - YYNTBASE];
01293 
01294   goto yynewstate;
01295 
01296 yyerrlab:   /* here on detecting error */
01297 
01298   if (! yyerrstatus)
01299     /* If not already recovering from an error, report this error.  */
01300     {
01301       ++yynerrs;
01302 
01303 #ifdef YYERROR_VERBOSE
01304       yyn = yypact[yystate];
01305 
01306       if (yyn > YYFLAG && yyn < YYLAST)
01307         {
01308           int size = 0;
01309           char *msg;
01310           int x, count;
01311 
01312           count = 0;
01313           /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
01314           for (x = (yyn < 0 ? -yyn : 0);
01315                x < (sizeof(yytname) / sizeof(char *)); x++)
01316             if (yycheck[x + yyn] == x)
01317               size += strlen(yytname[x]) + 15, count++;
01318           msg = (char *) malloc(size + 15);
01319           if (msg != 0)
01320             {
01321               strcpy(msg, "parse error");
01322 
01323               if (count < 5)
01324                 {
01325                   count = 0;
01326                   for (x = (yyn < 0 ? -yyn : 0);
01327                        x < (sizeof(yytname) / sizeof(char *)); x++)
01328                     if (yycheck[x + yyn] == x)
01329                       {
01330                         strcat(msg, count == 0 ? ", expecting `" : " or `");
01331                         strcat(msg, yytname[x]);
01332                         strcat(msg, "'");
01333                         count++;
01334                       }
01335                 }
01336               yyerror(msg);
01337               free(msg);
01338             }
01339           else
01340             yyerror ("parse error; also virtual memory exceeded");
01341         }
01342       else
01343 #endif /* YYERROR_VERBOSE */
01344         yyerror("parse error");
01345     }
01346 
01347   goto yyerrlab1;
01348 yyerrlab1:   /* here on error raised explicitly by an action */
01349 
01350   if (yyerrstatus == 3)
01351     {
01352       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
01353 
01354       /* return failure if at end of input */
01355       if (yychar == YYEOF)
01356         YYABORT;
01357 
01358 #if YYDEBUG != 0
01359       if (yydebug)
01360         fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
01361 #endif
01362 
01363       yychar = YYEMPTY;
01364     }
01365 
01366   /* Else will try to reuse lookahead token
01367      after shifting the error token.  */
01368 
01369   yyerrstatus = 3;              /* Each real token shifted decrements this */
01370 
01371   goto yyerrhandle;
01372 
01373 yyerrdefault:  /* current state does not do anything special for the error token. */
01374 
01375 #if 0
01376   /* This is wrong; only states that explicitly want error tokens
01377      should shift them.  */
01378   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
01379   if (yyn) goto yydefault;
01380 #endif
01381 
01382 yyerrpop:   /* pop the current state because it cannot handle the error token */
01383 
01384   if (yyssp == yyss) YYABORT;
01385   yyvsp--;
01386   yystate = *--yyssp;
01387 #ifdef YYLSP_NEEDED
01388   yylsp--;
01389 #endif
01390 
01391 #if YYDEBUG != 0
01392   if (yydebug)
01393     {
01394       short *ssp1 = yyss - 1;
01395       fprintf (stderr, "Error: state stack now");
01396       while (ssp1 != yyssp)
01397         fprintf (stderr, " %d", *++ssp1);
01398       fprintf (stderr, "\n");
01399     }
01400 #endif
01401 
01402 yyerrhandle:
01403 
01404   yyn = yypact[yystate];
01405   if (yyn == YYFLAG)
01406     goto yyerrdefault;
01407 
01408   yyn += YYTERROR;
01409   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
01410     goto yyerrdefault;
01411 
01412   yyn = yytable[yyn];
01413   if (yyn < 0)
01414     {
01415       if (yyn == YYFLAG)
01416         goto yyerrpop;
01417       yyn = -yyn;
01418       goto yyreduce;
01419     }
01420   else if (yyn == 0)
01421     goto yyerrpop;
01422 
01423   if (yyn == YYFINAL)
01424     YYACCEPT;
01425 
01426 #if YYDEBUG != 0
01427   if (yydebug)
01428     fprintf(stderr, "Shifting error token, ");
01429 #endif
01430 
01431   *++yyvsp = yylval;
01432 #ifdef YYLSP_NEEDED
01433   *++yylsp = yylloc;
01434 #endif
01435 
01436   yystate = yyn;
01437   goto yynewstate;
01438 
01439  yyacceptlab:
01440   /* YYACCEPT comes here.  */
01441   if (yyfree_stacks)
01442     {
01443       free (yyss);
01444       free (yyvs);
01445 #ifdef YYLSP_NEEDED
01446       free (yyls);
01447 #endif
01448     }
01449   return 0;
01450 
01451  yyabortlab:
01452   /* YYABORT comes here.  */
01453   if (yyfree_stacks)
01454     {
01455       free (yyss);
01456       free (yyvs);
01457 #ifdef YYLSP_NEEDED
01458       free (yyls);
01459 #endif
01460     }
01461   return 1;
01462 }
01463 #line 279 "parser.y"
01464 
01465 
01466 /*
01467  * error_occured - Set to true when a parse error is reported.  If it is false
01468  *                 at the time a parse error is reported, a message is
01469  *                 printed on stderr.  See report_parse_error for more
01470  *                 details.
01471  */
01472 
01473 static int error_occured = 0;
01474 
01475 /*
01476  *  Parser-Lexer Internal Routine:
01477  *
01478  *    void report_parse_error(char *error_message, int line_number)
01479  *        Modifies: error_occured, stderr
01480  *        Effects: This routine is called to report a parser or lexer
01481  *                 error.  Error_message is the error message and line_number
01482  *                 the line number it occured on.  The reported error message
01483  *                 is of the form "....<error_message> on line <line #>.\n".
01484  *                 This routine sets error_occured (local to parser.y) to
01485  *                 true.  If it was previously false, the error message
01486  *                 is reported to the user via stderr. 
01487  */
01488 
01489 void report_parse_error(error_message, line_number)
01490      char *error_message;
01491      int line_number;
01492 {
01493     if (error_occured)
01494       return;
01495     error_occured = 1;
01496 
01497     fprintf(stderr, "jwgc: error in description file: %s on line %d.\n",
01498             error_message, line_number);
01499     fflush(stderr);
01500 }
01501 
01502 /*
01503  *  yyerror - internal routine - used by yacc to report syntax errors and
01504  *            stack overflow errors.
01505  */
01506  
01507 static void yyerror(message)
01508      char *message;
01509 {
01510     report_parse_error(message, yylineno);
01511 }
01512 
01513 /*
01514  *    struct _Node *parse_file(FILE *input_file)
01515  *        Requires: input_file is opened for reading, no pointers to
01516  *                  existing nodes will ever be dereferened.
01517  *        Modifies: *input_file, stderr, all existing nodes
01518  *        Effects: First this routine destroys all nodes.  Then it parses
01519  *                 input_file as a jwgc description langauge file.  If
01520  *                 an error is encountered, an error message is printed
01521  *                 on stderr and NULL is returned.  If no error is
01522  *                 encountered, a pointer to the node representation of
01523  *                 the parsed program is returned, suitable for passing to
01524  *                 exec.c.  Note that NULL will also be returned for a
01525  *                 empty file & is a valid program.  Either way, input_file
01526  *                 is closed before this routine returns.
01527  */
01528 
01529 struct _Node *parse_file(input_file)
01530      FILE *input_file;
01531 {
01532     the_program = NULL;
01533     error_occured = 0;
01534     node_DestroyAllNodes();
01535 
01536     lex_open(input_file);
01537     yyparse();
01538     fclose(input_file);
01539 
01540     if (error_occured) {
01541         node_DestroyAllNodes();
01542         the_program = NULL;
01543     }
01544 
01545     return(the_program);
01546 }
01547 
01548 struct _Node *parse_buffer(input_buffer)
01549      char *input_buffer;
01550 {
01551     the_program = NULL;
01552     error_occured = 0;
01553     node_DestroyAllNodes();
01554 
01555     lex_open_buffer(input_buffer);
01556     yyparse();
01557 
01558     if (error_occured) {
01559         node_DestroyAllNodes();
01560         the_program = NULL;
01561     }
01562 
01563     return(the_program);
01564 }


Last updated at Tue Dec 18 21:07:42 PST 2007. This site and project hosted by...SourceForge.net Logo
Source Perspective by Fisheye