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 File Reference

#include <sysdep.h>
#include <stdio.h>
#include "lexer.h"
#include "node.h"
#include "main.h"

Go to the source code of this file.

Data Structures

union  YYSTYPE

Defines

#define YYBISON   1
#define ERROR   257
#define VARNAME   258
#define VARREF   259
#define STRING   260
#define SHOW   261
#define APPENDPORT   262
#define BUFFER   263
#define BREAK   264
#define CLOSEINPUT   265
#define CLOSEOUTPUT   266
#define CLOSEPORT   267
#define CASE   268
#define CLEARBUF   269
#define DEFAULT   270
#define DISPLAY   271
#define DO   272
#define DOWNCASE   273
#define ELSE   274
#define ELSEIF   275
#define ENDCASE   276
#define ENDIF   277
#define ENDWHILE   278
#define EXEC   279
#define EXECPORT   280
#define EXIT   281
#define FIELDS   282
#define GET   283
#define GETENV   284
#define IF   285
#define INPUTPORT   286
#define LANY   287
#define LBREAK   288
#define LSPAN   289
#define MATCH   290
#define NOOP   291
#define NOT   292
#define OUTPUTPORT   293
#define PRINT   294
#define PROTECT   295
#define VERBATIM   296
#define PUT   297
#define RANY   298
#define RBREAK   299
#define RSPAN   300
#define SET   301
#define SUBSTITUTE   302
#define THEN   303
#define UPCASE   304
#define WHILE   305
#define JVAR   306
#define PARAGRAPH   307
#define EQ   308
#define NEQ   309
#define REGEQ   310
#define REGNEQ   311
#define const
#define YYFINAL   176
#define YYFLAG   -32768
#define YYNTBASE   66
#define YYTRANSLATE(x)   ((unsigned)(x) <= 311 ? yytranslate[x] : 79)
#define YYLAST   540
#define YYSTACK_ALLOC   malloc
#define yyerrok   (yyerrstatus = 0)
#define yyclearin   (yychar = YYEMPTY)
#define YYEMPTY   -2
#define YYEOF   0
#define YYACCEPT   goto yyacceptlab
#define YYABORT   goto yyabortlab
#define YYERROR   goto yyerrlab1
#define YYFAIL   goto yyerrlab
#define YYRECOVERING()   (!!yyerrstatus)
#define YYBACKUP(token, value)
#define YYTERROR   1
#define YYERRCODE   256
#define YYLEX   yylex()
#define YYINITDEPTH   200
#define YYMAXDEPTH   10000
#define YYPARSE_PARAM_ARG
#define YYPARSE_PARAM_DECL
#define YYPOPSTACK   (yyvsp--, yyssp--)

Functions

int yyparse ()
int yyparse (YYPARSE_PARAM_ARG)
void report_parse_error (char *error_message, int line_number)
_Nodeparse_file (FILE *input_file)
_Nodeparse_buffer (char *input_buffer)

Variables

int yychar
YYSTYPE yylval
int yynerrs


Define Documentation

#define APPENDPORT   262
 

Definition at line 12 of file parser.c.

#define BREAK   264
 

Definition at line 14 of file parser.c.

#define BUFFER   263
 

Definition at line 13 of file parser.c.

#define CASE   268
 

Definition at line 18 of file parser.c.

#define CLEARBUF   269
 

Definition at line 19 of file parser.c.

#define CLOSEINPUT   265
 

Definition at line 15 of file parser.c.

#define CLOSEOUTPUT   266
 

Definition at line 16 of file parser.c.

#define CLOSEPORT   267
 

Definition at line 17 of file parser.c.

#define const
 

Definition at line 97 of file parser.c.

#define DEFAULT   270
 

Definition at line 20 of file parser.c.

#define DISPLAY   271
 

Definition at line 21 of file parser.c.

#define DO   272
 

Definition at line 22 of file parser.c.

#define DOWNCASE   273
 

Definition at line 23 of file parser.c.

#define ELSE   274
 

Definition at line 24 of file parser.c.

#define ELSEIF   275
 

Definition at line 25 of file parser.c.

#define ENDCASE   276
 

Definition at line 26 of file parser.c.

#define ENDIF   277
 

Definition at line 27 of file parser.c.

#define ENDWHILE   278
 

Definition at line 28 of file parser.c.

#define EQ   308
 

Definition at line 58 of file parser.c.

#define ERROR   257
 

Definition at line 7 of file parser.c.

#define EXEC   279
 

Definition at line 29 of file parser.c.

#define EXECPORT   280
 

Definition at line 30 of file parser.c.

#define EXIT   281
 

Definition at line 31 of file parser.c.

#define FIELDS   282
 

Definition at line 32 of file parser.c.

#define GET   283
 

Definition at line 33 of file parser.c.

#define GETENV   284
 

Definition at line 34 of file parser.c.

#define IF   285
 

Definition at line 35 of file parser.c.

#define INPUTPORT   286
 

Definition at line 36 of file parser.c.

#define JVAR   306
 

Definition at line 56 of file parser.c.

#define LANY   287
 

Definition at line 37 of file parser.c.

#define LBREAK   288
 

Definition at line 38 of file parser.c.

#define LSPAN   289
 

Definition at line 39 of file parser.c.

#define MATCH   290
 

Definition at line 40 of file parser.c.

#define NEQ   309
 

Definition at line 59 of file parser.c.

#define NOOP   291
 

Definition at line 41 of file parser.c.

#define NOT   292
 

Definition at line 42 of file parser.c.

#define OUTPUTPORT   293
 

Definition at line 43 of file parser.c.

#define PARAGRAPH   307
 

Definition at line 57 of file parser.c.

#define PRINT   294
 

Definition at line 44 of file parser.c.

#define PROTECT   295
 

Definition at line 45 of file parser.c.

#define PUT   297
 

Definition at line 47 of file parser.c.

#define RANY   298
 

Definition at line 48 of file parser.c.

#define RBREAK   299
 

Definition at line 49 of file parser.c.

#define REGEQ   310
 

Definition at line 60 of file parser.c.

#define REGNEQ   311
 

Definition at line 61 of file parser.c.

#define RSPAN   300
 

Definition at line 50 of file parser.c.

#define SET   301
 

Definition at line 51 of file parser.c.

#define SHOW   261
 

Definition at line 11 of file parser.c.

#define STRING   260
 

Definition at line 10 of file parser.c.

#define SUBSTITUTE   302
 

Definition at line 52 of file parser.c.

#define THEN   303
 

Definition at line 53 of file parser.c.

#define UPCASE   304
 

Definition at line 54 of file parser.c.

#define VARNAME   258
 

Definition at line 8 of file parser.c.

#define VARREF   259
 

Definition at line 9 of file parser.c.

#define VERBATIM   296
 

Definition at line 46 of file parser.c.

#define WHILE   305
 

Definition at line 55 of file parser.c.

#define YYABORT   goto yyabortlab
 

Definition at line 492 of file parser.c.

#define YYACCEPT   goto yyacceptlab
 

Definition at line 491 of file parser.c.

#define YYBACKUP token,
value   ) 
 

Value:

do                                                              \
  if (yychar == YYEMPTY && yylen == 1)                          \
    { yychar = (token), yylval = (value);                       \
      yychar1 = YYTRANSLATE (yychar);                           \
      YYPOPSTACK;                                               \
      goto yybackup;                                            \
    }                                                           \
  else                                                          \
    { yyerror ("syntax error: cannot back up"); YYERROR; }      \
while (0)

Definition at line 500 of file parser.c.

#define YYBISON   1
 

Definition at line 5 of file parser.c.

#define yyclearin   (yychar = YYEMPTY)
 

Definition at line 488 of file parser.c.

#define YYEMPTY   -2
 

Definition at line 489 of file parser.c.

#define YYEOF   0
 

Definition at line 490 of file parser.c.

#define YYERRCODE   256
 

Definition at line 513 of file parser.c.

#define yyerrok   (yyerrstatus = 0)
 

Definition at line 487 of file parser.c.

#define YYERROR   goto yyerrlab1
 

Definition at line 493 of file parser.c.

#define YYFAIL   goto yyerrlab
 

Definition at line 498 of file parser.c.

#define YYFINAL   176
 

Definition at line 103 of file parser.c.

#define YYFLAG   -32768
 

Definition at line 104 of file parser.c.

Referenced by yyparse().

#define YYINITDEPTH   200
 

Definition at line 560 of file parser.c.

#define YYLAST   540
 

Definition at line 287 of file parser.c.

Referenced by yyparse().

#define YYLEX   yylex()
 

Definition at line 516 of file parser.c.

#define YYMAXDEPTH   10000
 

Definition at line 571 of file parser.c.

#define YYNTBASE   66
 

Definition at line 105 of file parser.c.

#define YYPARSE_PARAM_ARG
 

Definition at line 635 of file parser.c.

#define YYPARSE_PARAM_DECL
 

Definition at line 636 of file parser.c.

#define YYPOPSTACK   (yyvsp--, yyssp--)
 

 
#define YYRECOVERING  )     (!!yyerrstatus)
 

Definition at line 499 of file parser.c.

#define YYSTACK_ALLOC   malloc
 

Definition at line 480 of file parser.c.

Referenced by yyparse().

#define YYTERROR   1
 

Definition at line 512 of file parser.c.

#define YYTRANSLATE  )     ((unsigned)(x) <= 311 ? yytranslate[x] : 79)
 

Definition at line 107 of file parser.c.

Referenced by yyparse().


Function Documentation

struct _Node* parse_buffer char *  input_buffer  ) 
 

Definition at line 1548 of file parser.c.

References lex_open_buffer(), node_DestroyAllNodes(), and yyparse().

Referenced by read_in_description_file().

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 }

struct _Node* parse_file FILE *  input_file  ) 
 

Definition at line 1529 of file parser.c.

References lex_open(), node_DestroyAllNodes(), and yyparse().

Referenced by read_in_description_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 }

void report_parse_error char *  error_message,
int  line_number
 

Definition at line 1489 of file parser.c.

Referenced by yylex().

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 }

int yyparse YYPARSE_PARAM_ARG   ) 
 

Definition at line 649 of file parser.c.

References AND_OPCODE, APPENDPORT_OPCODE, BREAK_OPCODE, BUFFER_OPCODE, CASE_OPCODE, CLEARBUF_OPCODE, CLOSEINPUT_OPCODE, CLOSEOUTPUT_OPCODE, CLOSEPORT_OPCODE, DEFAULT_OPCODE, DOWNCASE_OPCODE, ELSE_OPCODE, ELSEIF_OPCODE, EQ_OPCODE, EXEC_OPCODE, EXECPORT_OPCODE, EXIT_OPCODE, FIELDS_OPCODE, GET_OPCODE, GETENV_OPCODE, IF_OPCODE, IF_STMT_OPCODE, INPUTPORT_OPCODE, JVAR_OPCODE, LANY_OPCODE, LBREAK_OPCODE, LSPAN_OPCODE, MATCHLIST_OPCODE, NEQ_OPCODE, _Node::next, Node, YYSTYPE::node, node_create_binary(), node_create_noary(), node_create_string_constant(), node_create_unary(), NOOP_OPCODE, NOT_OPCODE, OR_OPCODE, OUTPUTPORT_OPCODE, PARAGRAPH_OPCODE, PLUS_OPCODE, PRINT_OPCODE, PROTECT_OPCODE, PUT_OPCODE, RANY_OPCODE, RBREAK_OPCODE, REGEQ_OPCODE, REGNEQ_OPCODE, reverse_list_of_nodes(), RSPAN_OPCODE, SET_OPCODE, STRING_CONSTANT_OPCODE, SUBSTITUTE_OPCODE, YYSTYPE::text, UPCASE_OPCODE, VARNAME_OPCODE, VARREF_OPCODE, VERBATIM_OPCODE, WHILE_OPCODE, yychar, YYFLAG, YYLAST, yylval, yynerrs, YYSTACK_ALLOC, and YYTRANSLATE.

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 }

int yyparse  ) 
 

Referenced by parse_buffer(), and parse_file().


Variable Documentation

int yychar
 

Definition at line 539 of file parser.c.

Referenced by yyparse().

YYSTYPE yylval
 

Definition at line 540 of file parser.c.

Referenced by yylex(), and yyparse().

int yynerrs
 

Definition at line 548 of file parser.c.

Referenced by yyparse().



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

Source Perspective by Fisheye