1 %%{section} %%{body} %%".c" %%{yacc}
4 /* YYERROR and YYCOST are set by guards. If yyerror is set to a
5 nonzero value by a guard, the reduction with which the guard is
6 associated is not performed, and the error recovery mechanism is
7 invoked. Yycost indicates the cost of performing the reduction
8 given the attributes of the symbols. */
12 /* YYMAXDEPTH indicates the size of the parser's state and value
16 # define YYMAXDEPTH 500
19 /* YYMAXRULES must be at least as large as the number of rules that
20 could be placed in the rule queue. That number could be determined
21 from the grammar and the size of the stack, but, as yet, it is not.
25 # define YYMAXRULES 100
29 # define YYMAXBACKUP 100
33 /* The state stack. */
34 static short yyss[YYMAXDEPTH];
35 /* The semantic value stack. */
36 static YYSTYPE yyvs[YYMAXDEPTH];
37 /* The location stack. */
38 static YYLTYPE yyls[YYMAXDEPTH];
40 static short yyrq[YYMAXRULES];
41 /* The lookahead symbol. */
44 /* the semantic value of the lookahead symbol. */
45 static YYSTYPE yylval;
47 /* the semantic value for the state at the top of the state stack. */
48 static YYSTYPE yytval;
50 /* the variable used to return semantic values from the action
54 /* location data for the lookahead symbol. */
55 static YYLTYPE yylloc;
57 /* location data for the state at the top of the state stack. */
58 static YYLTYPE yytloc;
61 static int yynunlexed;
62 static short yyunchar[YYMAXBACKUP];
63 static YYSTYPE yyunval[YYMAXBACKUP];
64 static YYLTYPE yyunloc[YYMAXBACKUP];
66 /* a pointer to the top of the state stack; only set during error
70 /* a pointer to the top of the value stack; only set during error
72 static YYSTYPE *yygvsp;
74 /* a pointer to the top of the location stack; only set during error
76 static YYLTYPE *yyglsp;
79 /*--------------------------------------------------------------------.
80 | Yyget is an interface between the parser and the lexical analyzer. |
81 | It is costly to provide such an interface, but it avoids requiring |
82 | the lexical analyzer to be able to back up the scan. |
83 `--------------------------------------------------------------------*/
91 yychar = yyunchar[yynunlexed];
92 yylval = yyunval[yynunlexed];
93 yylloc = yyunloc[yynunlexed];
103 yychar = YYTRANSLATE (yychar);
109 yyunlex (int chr, YYSTYPE val, YYLTYPE loc)
111 yyunchar[yynunlexed] = chr;
112 yyunval[yynunlexed] = val;
113 yyunloc[yynunlexed] = loc;
119 yyrestore (short *first, short *last)
128 yyunlex (yychar, yylval, yylloc);
131 while (first != last)
133 symbol = yystos[*ssp];
134 if (symbol < YYNTBASE)
136 yyunlex (symbol, yytval, yytloc);
144 first = yyrq + YYMAXRULES;
148 for (rp = yyrhs + yyprhs[*first]; symbol = *rp; rp++)
150 if (symbol < YYNTBASE)
151 state = yytable[yypact[*ssp] + symbol];
154 state = yypgoto[symbol - YYNTBASE] + *ssp;
156 if (state >= 0 && state <= YYLAST && yycheck[state] == *ssp)
157 state = yytable[state];
159 state = yydefgoto[symbol - YYNTBASE];
166 if (!tvalsaved && ssp > yyss)
168 yyunlex (yystos[*ssp], yytval, yytloc);
204 yychar = YYTRANSLATE (yychar);
208 if (yyssp >= yyss + YYMAXDEPTH - 1)
210 yyabort ("Parser Stack Overflow");
218 yyn = yypact[yystate];
223 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar)
238 while (yyptr != yyrq1)
245 yyguard (yyn, yyvsp, yylsp);
249 yyaction (yyn, yyvsp, yylsp);
255 yylsp->first_line = yytloc.first_line;
256 yylsp->first_column = yytloc.first_column;
257 yylsp->last_line = (yylsp - 1)->last_line;
258 yylsp->last_column = (yylsp - 1)->last_column;
263 yylsp->last_line = (yylsp + yylen - 1)->last_line;
264 yylsp->last_column = (yylsp + yylen - 1)->last_column;
267 if (yyptr == yyrq + YYMAXRULES)
271 if (yystate == YYFINAL)
287 yyn = yydefact[yystate];
295 if (yyrq0 == yyrq + YYMAXRULES)
300 yyabort ("Parser Rule Queue Overflow");
307 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
308 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
309 yystate = yytable[yystate];
311 yystate = yydefgoto[yyn - YYNTBASE];
325 yyrestore (yyrq0, yyrq2);