3 /* YYERROR and YYCOST are set by guards. If yyerror is set to a
4 nonzero value by a guard, the reduction with which the guard is
5 associated is not performed, and the error recovery mechanism is
6 invoked. Yycost indicates the cost of performing the reduction
7 given the attributes of the symbols. */
11 /* YYMAXDEPTH indicates the size of the parser's state and value
15 # define YYMAXDEPTH 500
18 /* YYMAXRULES must be at least as large as the number of rules that
19 could be placed in the rule queue. That number could be determined
20 from the grammar and the size of the stack, but, as yet, it is not.
24 # define YYMAXRULES 100
28 # define YYMAXBACKUP 100
32 /* The state stack. */
33 static short yyss[YYMAXDEPTH];
34 /* The semantic value stack. */
35 static YYSTYPE yyvs[YYMAXDEPTH];
36 /* The location stack. */
37 static YYLTYPE yyls[YYMAXDEPTH];
39 static short yyrq[YYMAXRULES];
40 /* The lookahead symbol. */
43 /* the semantic value of the lookahead symbol. */
44 static YYSTYPE yylval;
46 /* the semantic value for the state at the top of the state stack. */
47 static YYSTYPE yytval;
49 /* the variable used to return semantic values from the action
53 /* location data for the lookahead symbol. */
54 static YYLTYPE yylloc;
56 /* location data for the state at the top of the state stack. */
57 static YYLTYPE yytloc;
60 static int yynunlexed;
61 static short yyunchar[YYMAXBACKUP];
62 static YYSTYPE yyunval[YYMAXBACKUP];
63 static YYLTYPE yyunloc[YYMAXBACKUP];
65 /* a pointer to the top of the state stack; only set during error
69 /* a pointer to the top of the value stack; only set during error
71 static YYSTYPE *yygvsp;
73 /* a pointer to the top of the location stack; only set during error
75 static YYLTYPE *yyglsp;
78 /*--------------------------------------------------------------------.
79 | Yyget is an interface between the parser and the lexical analyzer. |
80 | It is costly to provide such an interface, but it avoids requiring |
81 | the lexical analyzer to be able to back up the scan. |
82 `--------------------------------------------------------------------*/
90 yychar = yyunchar[yynunlexed];
91 yylval = yyunval[yynunlexed];
92 yylloc = yyunloc[yynunlexed];
102 yychar = YYTRANSLATE (yychar);
108 yyunlex (int chr, YYSTYPE val, YYLTYPE loc)
110 yyunchar[yynunlexed] = chr;
111 yyunval[yynunlexed] = val;
112 yyunloc[yynunlexed] = loc;
118 yyrestore (short *first, short *last)
127 yyunlex (yychar, yylval, yylloc);
130 while (first != last)
132 symbol = yystos[*ssp];
133 if (symbol < YYNTBASE)
135 yyunlex (symbol, yytval, yytloc);
143 first = yyrq + YYMAXRULES;
147 for (rp = yyrhs + yyprhs[*first]; symbol = *rp; rp++)
149 if (symbol < YYNTBASE)
150 state = yytable[yypact[*ssp] + symbol];
153 state = yypgoto[symbol - YYNTBASE] + *ssp;
155 if (state >= 0 && state <= YYLAST && yycheck[state] == *ssp)
156 state = yytable[state];
158 state = yydefgoto[symbol - YYNTBASE];
165 if (!tvalsaved && ssp > yyss)
167 yyunlex (yystos[*ssp], yytval, yytloc);
203 yychar = YYTRANSLATE (yychar);
207 if (yyssp >= yyss + YYMAXDEPTH - 1)
209 yyabort ("Parser Stack Overflow");
217 yyn = yypact[yystate];
222 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar)
237 while (yyptr != yyrq1)
244 yyguard (yyn, yyvsp, yylsp);
248 yyaction (yyn, yyvsp, yylsp);
254 yylsp->first_line = yytloc.first_line;
255 yylsp->first_column = yytloc.first_column;
256 yylsp->last_line = (yylsp - 1)->last_line;
257 yylsp->last_column = (yylsp - 1)->last_column;
262 yylsp->last_line = (yylsp + yylen - 1)->last_line;
263 yylsp->last_column = (yylsp + yylen - 1)->last_column;
266 if (yyptr == yyrq + YYMAXRULES)
270 if (yystate == YYFINAL)
286 yyn = yydefact[yystate];
294 if (yyrq0 == yyrq + YYMAXRULES)
299 yyabort ("Parser Rule Queue Overflow");
306 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
307 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
308 yystate = yytable[yystate];
310 yystate = yydefgoto[yyn - YYNTBASE];
324 yyrestore (yyrq0, yyrq2);