1 /* Driver template for the LEMON parser generator.
2 ** The author disclaims copyright to this source code.
4 /* First off, code is included that follows the "include" declaration
5 ** in the input grammar file. */
8 /* Next is all token values, in a form suitable for use by makeheaders.
9 ** This section will be null unless lemon is run with the -m switch.
12 ** These constants (all generated automatically by the parser generator)
13 ** specify the various kinds of tokens (terminals) that the parser
16 ** Each symbol here is a terminal symbol in the grammar.
19 /* Make sure the INTERFACE macro is defined.
27 /* The next thing included is series of defines which control
28 ** various aspects of the generated parser.
29 ** YYCODETYPE is the data type used for storing terminal
30 ** and nonterminal numbers. "unsigned char" is
31 ** used if there are fewer than 250 terminals
32 ** and nonterminals. "int" is used otherwise.
33 ** YYNOCODE is a number of type YYCODETYPE which corresponds
34 ** to no legal terminal or nonterminal number. This
35 ** number is used to fill in empty slots of the hash
37 ** YYFALLBACK If defined, this indicates that one or more tokens
38 ** have fall-back values which should be used if the
39 ** original value of the token will not parse.
40 ** YYACTIONTYPE is the data type used for storing terminal
41 ** and nonterminal numbers. "unsigned char" is
42 ** used if there are fewer than 250 rules and
43 ** states combined. "int" is used otherwise.
44 ** ParseTOKENTYPE is the data type used for minor tokens given
45 ** directly to the parser from the tokenizer.
46 ** YYMINORTYPE is the data type used for all minor tokens.
47 ** This is typically a union of many types, one of
48 ** which is ParseTOKENTYPE. The entry in the union
49 ** for base tokens is called "yy0".
50 ** YYSTACKDEPTH is the maximum depth of the parser's stack. If
51 ** zero the stack is dynamically sized using realloc()
52 ** ParseARG_SDECL A static variable declaration for the %extra_argument
53 ** ParseARG_PDECL A parameter declaration for the %extra_argument
54 ** ParseARG_STORE Code to store %extra_argument into yypParser
55 ** ParseARG_FETCH Code to extract %extra_argument from yypParser
56 ** YYNSTATE the combined number of states.
57 ** YYNRULE the number of rules in the grammar
58 ** YYERRORSYMBOL is the code number of the error symbol. If not
59 ** defined, then do no error processing.
62 #define YY_NO_ACTION (YYNSTATE+YYNRULE+2)
63 #define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1)
64 #define YY_ERROR_ACTION (YYNSTATE+YYNRULE)
66 /* The yyzerominor constant is used to initialize instances of
67 ** YYMINORTYPE objects to zero. */
68 static const YYMINORTYPE yyzerominor = { 0 };
70 /* Define the yytestcase() macro to be a no-op if is not already defined
73 ** Applications can choose to define yytestcase() in the %include section
74 ** to a macro that can assist in verifying code coverage. For production
75 ** code the yytestcase() macro should be turned off. But it is useful
79 # define yytestcase(X)
83 /* Next are the tables used to determine what action to take based on the
84 ** current state and lookahead token. These tables are used to implement
85 ** functions that take a state number and lookahead value and return an
88 ** Suppose the action integer is N. Then the action is determined as
91 ** 0 <= N < YYNSTATE Shift N. That is, push the lookahead
92 ** token onto the stack and goto state N.
94 ** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE.
96 ** N == YYNSTATE+YYNRULE A syntax error has occurred.
98 ** N == YYNSTATE+YYNRULE+1 The parser accepts its input.
100 ** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused
101 ** slots in the yy_action[] table.
103 ** The action table is constructed as a single large table named yy_action[].
104 ** Given state S and lookahead X, the action is computed as
106 ** yy_action[ yy_shift_ofst[S] + X ]
108 ** If the index value yy_shift_ofst[S]+X is out of range or if the value
109 ** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
110 ** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
111 ** and that yy_default[S] should be used instead.
113 ** The formula above is for computing the action when the lookahead is
114 ** a terminal symbol. If the lookahead is a non-terminal (as occurs after
115 ** a reduce action) then the yy_reduce_ofst[] array is used in place of
116 ** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
117 ** YY_SHIFT_USE_DFLT.
119 ** The following are the tables generated in this section:
121 ** yy_action[] A single table containing all actions.
122 ** yy_lookahead[] A table containing the lookahead for each entry in
123 ** yy_action. Used to detect hash collisions.
124 ** yy_shift_ofst[] For each state, the offset into yy_action for
125 ** shifting terminals.
126 ** yy_reduce_ofst[] For each state, the offset into yy_action for
127 ** shifting non-terminals after a reduce.
128 ** yy_default[] Default action for each state.
132 /* The next table maps tokens into fallback tokens. If a construct
133 ** like the following:
135 ** %fallback ID X Y Z.
137 ** appears in the grammar, then ID becomes a fallback token for X, Y,
138 ** and Z. Whenever one of the tokens X, Y, or Z is input to the parser
139 ** but it does not parse, the type of the token is changed to ID and
140 ** the parse is retried before an error is thrown.
143 static const YYCODETYPE yyFallback[] = {
146 #endif /* YYFALLBACK */
148 /* The following structure represents a single element of the
149 ** parser's stack. Information stored includes:
151 ** + The state number for the parser at this level of the stack.
153 ** + The value of the token stored at this level of the stack.
154 ** (In other words, the "major" token.)
156 ** + The semantic value stored at this level of the stack. This is
157 ** the information used by the action routines in the grammar.
158 ** It is sometimes called the "minor" token.
160 struct yyStackEntry {
161 YYACTIONTYPE stateno; /* The state-number */
162 YYCODETYPE major; /* The major token value. This is the code
163 ** number for the token at this stack level */
164 YYMINORTYPE minor; /* The user-supplied minor token value. This
165 ** is the value of the token */
167 typedef struct yyStackEntry yyStackEntry;
169 /* The state of the parser is completely contained in an instance of
170 ** the following structure */
172 int yyidx; /* Index of top element in stack */
173 #ifdef YYTRACKMAXSTACKDEPTH
174 int yyidxMax; /* Maximum value of yyidx */
176 int yyerrcnt; /* Shifts left before out of the error */
177 ParseARG_SDECL /* A place to hold %extra_argument */
179 int yystksz; /* Current side of the stack */
180 yyStackEntry *yystack; /* The parser's stack */
182 yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */
185 typedef struct yyParser yyParser;
189 static FILE *yyTraceFILE = 0;
190 static char *yyTracePrompt = 0;
195 ** Turn parser tracing on by giving a stream to which to write the trace
196 ** and a prompt to preface each trace message. Tracing is turned off
197 ** by making either argument NULL
201 ** <li> A FILE* to which trace output should be written.
202 ** If NULL, then tracing is turned off.
203 ** <li> A prefix string written at the beginning of every
204 ** line of trace output. If NULL, then tracing is
211 void ParseTrace(FILE *TraceFILE, char *zTracePrompt){
212 yyTraceFILE = TraceFILE;
213 yyTracePrompt = zTracePrompt;
214 if( yyTraceFILE==0 ) yyTracePrompt = 0;
215 else if( yyTracePrompt==0 ) yyTraceFILE = 0;
220 /* For tracing shifts, the names of all terminals and nonterminals
221 ** are required. The following table supplies these names */
222 static const char *const yyTokenName[] = {
228 /* For tracing reduce actions, the names of all rules are required.
230 static const char *const yyRuleName[] = {
238 ** Try to increase the size of the parser stack.
240 static void yyGrowStack(yyParser *p){
244 newSize = p->yystksz*2 + 100;
245 pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
248 p->yystksz = newSize;
251 fprintf(yyTraceFILE,"%sStack grows to %d entries!\n",
252 yyTracePrompt, p->yystksz);
260 ** This function allocates a new parser.
261 ** The only argument is a pointer to a function which works like
265 ** A pointer to the function used to allocate memory.
268 ** A pointer to a parser. This pointer is used in subsequent calls
269 ** to Parse and ParseFree.
271 void *ParseAlloc(void *(*mallocProc)(size_t)){
273 pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) );
276 #ifdef YYTRACKMAXSTACKDEPTH
277 pParser->yyidxMax = 0;
280 pParser->yystack = NULL;
281 pParser->yystksz = 0;
282 yyGrowStack(pParser);
288 /* The following function deletes the value associated with a
289 ** symbol. The symbol can be either a terminal or nonterminal.
290 ** "yymajor" is the symbol code, and "yypminor" is a pointer to
293 static void yy_destructor(
294 yyParser *yypParser, /* The parser */
295 YYCODETYPE yymajor, /* Type code for object to destroy */
296 YYMINORTYPE *yypminor /* The object to be destroyed */
300 /* Here is inserted the actions which take place when a
301 ** terminal or non-terminal is destroyed. This can happen
302 ** when the symbol is popped from the stack during a
303 ** reduce or during error processing or when a parser is
304 ** being destroyed before it is finished parsing.
306 ** Note: during a reduce, the only symbols destroyed are those
307 ** which appear on the RHS of the rule, but which are not used
308 ** inside the C code.
311 default: break; /* If no destructor action specified: do nothing */
316 ** Pop the parser's stack once.
318 ** If there is a destructor routine associated with the token which
319 ** is popped from the stack, then call it.
321 ** Return the major token number for the symbol popped.
323 static int yy_pop_parser_stack(yyParser *pParser){
325 yyStackEntry *yytos = &pParser->yystack[pParser->yyidx];
327 if( pParser->yyidx<0 ) return 0;
329 if( yyTraceFILE && pParser->yyidx>=0 ){
330 fprintf(yyTraceFILE,"%sPopping %s\n",
332 yyTokenName[yytos->major]);
335 yymajor = yytos->major;
336 yy_destructor(pParser, yymajor, &yytos->minor);
342 ** Deallocate and destroy a parser. Destructors are all called for
343 ** all stack elements before shutting the parser down.
347 ** <li> A pointer to the parser. This should be a pointer
348 ** obtained from ParseAlloc.
349 ** <li> A pointer to a function used to reclaim memory obtained
354 void *p, /* The parser to be deleted */
355 void (*freeProc)(void*) /* Function used to reclaim memory */
357 yyParser *pParser = (yyParser*)p;
358 if( pParser==0 ) return;
359 while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser);
361 free(pParser->yystack);
363 (*freeProc)((void*)pParser);
367 ** Return the peak depth of the stack for a parser.
369 #ifdef YYTRACKMAXSTACKDEPTH
370 int ParseStackPeak(void *p){
371 yyParser *pParser = (yyParser*)p;
372 return pParser->yyidxMax;
377 ** Find the appropriate action for a parser given the terminal
378 ** look-ahead token iLookAhead.
380 ** If the look-ahead token is YYNOCODE, then check to see if the action is
381 ** independent of the look-ahead. If it is, return the action, otherwise
382 ** return YY_NO_ACTION.
384 static int yy_find_shift_action(
385 yyParser *pParser, /* The parser */
386 YYCODETYPE iLookAhead /* The look-ahead token */
389 int stateno = pParser->yystack[pParser->yyidx].stateno;
391 if( stateno>YY_SHIFT_COUNT
392 || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){
393 return yy_default[stateno];
395 assert( iLookAhead!=YYNOCODE );
397 if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
400 YYCODETYPE iFallback; /* Fallback token */
401 if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
402 && (iFallback = yyFallback[iLookAhead])!=0 ){
405 fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
406 yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
409 return yy_find_shift_action(pParser, iFallback);
414 int j = i - iLookAhead + YYWILDCARD;
416 #if YY_SHIFT_MIN+YYWILDCARD<0
419 #if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT
422 yy_lookahead[j]==YYWILDCARD
426 fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
427 yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]);
433 #endif /* YYWILDCARD */
435 return yy_default[stateno];
442 ** Find the appropriate action for a parser given the non-terminal
443 ** look-ahead token iLookAhead.
445 ** If the look-ahead token is YYNOCODE, then check to see if the action is
446 ** independent of the look-ahead. If it is, return the action, otherwise
447 ** return YY_NO_ACTION.
449 static int yy_find_reduce_action(
450 int stateno, /* Current state number */
451 YYCODETYPE iLookAhead /* The look-ahead token */
455 if( stateno>YY_REDUCE_COUNT ){
456 return yy_default[stateno];
459 assert( stateno<=YY_REDUCE_COUNT );
461 i = yy_reduce_ofst[stateno];
462 assert( i!=YY_REDUCE_USE_DFLT );
463 assert( iLookAhead!=YYNOCODE );
466 if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){
467 return yy_default[stateno];
470 assert( i>=0 && i<YY_ACTTAB_COUNT );
471 assert( yy_lookahead[i]==iLookAhead );
477 ** The following routine is called if the stack overflows.
479 static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
484 fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
487 while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
488 /* Here code is inserted which will execute if the parser
489 ** stack every overflows */
491 ParseARG_STORE; /* Suppress warning about unused %extra_argument var */
495 ** Perform a shift action.
497 static void yy_shift(
498 yyParser *yypParser, /* The parser to be shifted */
499 int yyNewState, /* The new state to shift in */
500 int yyMajor, /* The major token to shift in */
501 YYMINORTYPE *yypMinor /* Pointer to the minor token to shift in */
505 #ifdef YYTRACKMAXSTACKDEPTH
506 if( yypParser->yyidx>yypParser->yyidxMax ){
507 yypParser->yyidxMax = yypParser->yyidx;
511 if( yypParser->yyidx>=YYSTACKDEPTH ){
512 yyStackOverflow(yypParser, yypMinor);
516 if( yypParser->yyidx>=yypParser->yystksz ){
517 yyGrowStack(yypParser);
518 if( yypParser->yyidx>=yypParser->yystksz ){
519 yyStackOverflow(yypParser, yypMinor);
524 yytos = &yypParser->yystack[yypParser->yyidx];
525 yytos->stateno = (YYACTIONTYPE)yyNewState;
526 yytos->major = (YYCODETYPE)yyMajor;
527 yytos->minor = *yypMinor;
529 if( yyTraceFILE && yypParser->yyidx>0 ){
531 fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState);
532 fprintf(yyTraceFILE,"%sStack:",yyTracePrompt);
533 for(i=1; i<=yypParser->yyidx; i++)
534 fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]);
535 fprintf(yyTraceFILE,"\n");
540 /* The following table contains information about every rule that
541 ** is used during the reduce.
543 static const struct {
544 YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
545 unsigned char nrhs; /* Number of right-hand side symbols in the rule */
550 static void yy_accept(yyParser*); /* Forward Declaration */
553 ** Perform a reduce action and the shift that must immediately
554 ** follow the reduce.
556 static void yy_reduce(
557 yyParser *yypParser, /* The parser */
558 int yyruleno /* Number of the rule by which to reduce */
560 int yygoto; /* The next state */
561 int yyact; /* The next action */
562 YYMINORTYPE yygotominor; /* The LHS of the rule reduced */
563 yyStackEntry *yymsp; /* The top of the parser's stack */
564 int yysize; /* Amount to pop the stack */
566 yymsp = &yypParser->yystack[yypParser->yyidx];
568 if( yyTraceFILE && yyruleno>=0
569 && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
570 fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
571 yyRuleName[yyruleno]);
575 /* Silence complaints from purify about yygotominor being uninitialized
576 ** in some cases when it is copied into the stack after the following
577 ** switch. yygotominor is uninitialized when a rule reduces that does
578 ** not set the value of its left-hand side nonterminal. Leaving the
579 ** value of the nonterminal uninitialized is utterly harmless as long
580 ** as the value is never used. So really the only thing this code
581 ** accomplishes is to quieten purify.
583 ** 2007-01-16: The wireshark project (www.wireshark.org) reports that
584 ** without this code, their parser segfaults. I'm not sure what there
585 ** parser is doing to make this happen. This is the second bug report
586 ** from wireshark this week. Clearly they are stressing Lemon in ways
587 ** that it has not been previously stressed... (SQLite ticket #2172)
589 /*memset(&yygotominor, 0, sizeof(yygotominor));*/
590 yygotominor = yyzerominor;
594 /* Beginning here are the reduction cases. A typical example
597 ** #line <lineno> <grammarfile>
598 ** { ... } // User supplied code
599 ** #line <lineno> <thisfile>
604 yygoto = yyRuleInfo[yyruleno].lhs;
605 yysize = yyRuleInfo[yyruleno].nrhs;
606 yypParser->yyidx -= yysize;
607 yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);
608 if( yyact < YYNSTATE ){
610 /* If we are not debugging and the reduce action popped at least
611 ** one element off the stack, then we can push the new element back
612 ** onto the stack here, and skip the stack overflow test in yy_shift().
613 ** That gives a significant speed improvement. */
617 yymsp->stateno = (YYACTIONTYPE)yyact;
618 yymsp->major = (YYCODETYPE)yygoto;
619 yymsp->minor = yygotominor;
623 yy_shift(yypParser,yyact,yygoto,&yygotominor);
626 assert( yyact == YYNSTATE + YYNRULE + 1 );
627 yy_accept(yypParser);
632 ** The following code executes when the parse fails
634 #ifndef YYNOERRORRECOVERY
635 static void yy_parse_failed(
636 yyParser *yypParser /* The parser */
641 fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
644 while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
645 /* Here code is inserted which will be executed whenever the
648 ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
650 #endif /* YYNOERRORRECOVERY */
653 ** The following code executes when a syntax error first occurs.
655 static void yy_syntax_error(
656 yyParser *yypParser, /* The parser */
657 int yymajor, /* The major type of the error token */
658 YYMINORTYPE yyminor /* The minor type of the error token */
661 #define TOKEN (yyminor.yy0)
663 ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
667 ** The following is executed when the parser accepts
669 static void yy_accept(
670 yyParser *yypParser /* The parser */
675 fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
678 while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
679 /* Here code is inserted which will be executed whenever the
682 ParseARG_STORE; /* Suppress warning about unused %extra_argument variable */
685 /* The main parser program.
686 ** The first argument is a pointer to a structure obtained from
687 ** "ParseAlloc" which describes the current state of the parser.
688 ** The second argument is the major token number. The third is
689 ** the minor token. The fourth optional argument is whatever the
690 ** user wants (and specified in the grammar) and is available for
691 ** use by the action routines.
695 ** <li> A pointer to the parser (an opaque structure.)
696 ** <li> The major token number.
697 ** <li> The minor token number.
698 ** <li> An option argument of a grammar-specified type.
705 void *yyp, /* The parser */
706 int yymajor, /* The major token code number */
707 ParseTOKENTYPE yyminor /* The value for the token */
708 ParseARG_PDECL /* Optional %extra_argument parameter */
710 YYMINORTYPE yyminorunion;
711 int yyact; /* The parser action. */
712 int yyendofinput; /* True if we are at the end of input */
714 int yyerrorhit = 0; /* True if yymajor has invoked an error */
716 yyParser *yypParser; /* The parser */
718 /* (re)initialize the parser, if necessary */
719 yypParser = (yyParser*)yyp;
720 if( yypParser->yyidx<0 ){
722 if( yypParser->yystksz <=0 ){
723 /*memset(&yyminorunion, 0, sizeof(yyminorunion));*/
724 yyminorunion = yyzerominor;
725 yyStackOverflow(yypParser, &yyminorunion);
729 yypParser->yyidx = 0;
730 yypParser->yyerrcnt = -1;
731 yypParser->yystack[0].stateno = 0;
732 yypParser->yystack[0].major = 0;
734 yyminorunion.yy0 = yyminor;
735 yyendofinput = (yymajor==0);
740 fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]);
745 yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor);
746 if( yyact<YYNSTATE ){
747 assert( !yyendofinput ); /* Impossible to shift the $ token */
748 yy_shift(yypParser,yyact,yymajor,&yyminorunion);
749 yypParser->yyerrcnt--;
751 }else if( yyact < YYNSTATE + YYNRULE ){
752 yy_reduce(yypParser,yyact-YYNSTATE);
754 assert( yyact == YY_ERROR_ACTION );
760 fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
764 /* A syntax error has occurred.
765 ** The response to an error depends upon whether or not the
766 ** grammar defines an error token "ERROR".
768 ** This is what we do if the grammar does define ERROR:
770 ** * Call the %syntax_error function.
772 ** * Begin popping the stack until we enter a state where
773 ** it is legal to shift the error symbol, then shift
776 ** * Set the error count to three.
778 ** * Begin accepting and shifting new tokens. No new error
779 ** processing will occur until three tokens have been
780 ** shifted successfully.
783 if( yypParser->yyerrcnt<0 ){
784 yy_syntax_error(yypParser,yymajor,yyminorunion);
786 yymx = yypParser->yystack[yypParser->yyidx].major;
787 if( yymx==YYERRORSYMBOL || yyerrorhit ){
790 fprintf(yyTraceFILE,"%sDiscard input token %s\n",
791 yyTracePrompt,yyTokenName[yymajor]);
794 yy_destructor(yypParser, (YYCODETYPE)yymajor,&yyminorunion);
798 yypParser->yyidx >= 0 &&
799 yymx != YYERRORSYMBOL &&
800 (yyact = yy_find_reduce_action(
801 yypParser->yystack[yypParser->yyidx].stateno,
802 YYERRORSYMBOL)) >= YYNSTATE
804 yy_pop_parser_stack(yypParser);
806 if( yypParser->yyidx < 0 || yymajor==0 ){
807 yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
808 yy_parse_failed(yypParser);
810 }else if( yymx!=YYERRORSYMBOL ){
813 yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
816 yypParser->yyerrcnt = 3;
818 #elif defined(YYNOERRORRECOVERY)
819 /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to
820 ** do any kind of error recovery. Instead, simply invoke the syntax
821 ** error routine and continue going as if nothing had happened.
823 ** Applications can set this macro (for example inside %include) if
824 ** they intend to abandon the parse upon the first syntax error seen.
826 yy_syntax_error(yypParser,yymajor,yyminorunion);
827 yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
830 #else /* YYERRORSYMBOL is not defined */
831 /* This is what we do if the grammar does not define ERROR:
833 ** * Report an error message, and throw away the input token.
835 ** * If the input token is $, then fail the parse.
837 ** As before, subsequent error messages are suppressed until
838 ** three input tokens have been successfully shifted.
840 if( yypParser->yyerrcnt<=0 ){
841 yy_syntax_error(yypParser,yymajor,yyminorunion);
843 yypParser->yyerrcnt = 3;
844 yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion);
846 yy_parse_failed(yypParser);
851 }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );