mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-21 19:51:27 +00:00
Lemon update 2016-02-16 01:01:43 on branch trunk
- Improve the Lemon parser template (lempar.c) so that it avoids unnecessary work when the grammer defines YYNOERRORRECOVERY (as SQLite does). Slightly smaller and faster code results. (user: drh)
This commit is contained in:
parent
be870502fd
commit
7306279a87
1 changed files with 6 additions and 0 deletions
|
@ -221,7 +221,9 @@ struct yyParser {
|
||||||
#ifdef YYTRACKMAXSTACKDEPTH
|
#ifdef YYTRACKMAXSTACKDEPTH
|
||||||
int yyidxMax; /* Maximum value of yyidx */
|
int yyidxMax; /* Maximum value of yyidx */
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef YYNOERRORRECOVERY
|
||||||
int yyerrcnt; /* Shifts left before out of the error */
|
int yyerrcnt; /* Shifts left before out of the error */
|
||||||
|
#endif
|
||||||
ParseARG_SDECL /* A place to hold %extra_argument */
|
ParseARG_SDECL /* A place to hold %extra_argument */
|
||||||
#if YYSTACKDEPTH<=0
|
#if YYSTACKDEPTH<=0
|
||||||
int yystksz; /* Current side of the stack */
|
int yystksz; /* Current side of the stack */
|
||||||
|
@ -784,7 +786,9 @@ void Parse(
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
yypParser->yyidx = 0;
|
yypParser->yyidx = 0;
|
||||||
|
#ifndef YYNOERRORRECOVERY
|
||||||
yypParser->yyerrcnt = -1;
|
yypParser->yyerrcnt = -1;
|
||||||
|
#endif
|
||||||
yypParser->yystack[0].stateno = 0;
|
yypParser->yystack[0].stateno = 0;
|
||||||
yypParser->yystack[0].major = 0;
|
yypParser->yystack[0].major = 0;
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
@ -811,7 +815,9 @@ void Parse(
|
||||||
if( yyact <= YY_MAX_SHIFTREDUCE ){
|
if( yyact <= YY_MAX_SHIFTREDUCE ){
|
||||||
if( yyact > YY_MAX_SHIFT ) yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
|
if( yyact > YY_MAX_SHIFT ) yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
|
||||||
yy_shift(yypParser,yyact,yymajor,&yyminorunion);
|
yy_shift(yypParser,yyact,yymajor,&yyminorunion);
|
||||||
|
#ifndef YYNOERRORRECOVERY
|
||||||
yypParser->yyerrcnt--;
|
yypParser->yyerrcnt--;
|
||||||
|
#endif
|
||||||
yymajor = YYNOCODE;
|
yymajor = YYNOCODE;
|
||||||
}else if( yyact <= YY_MAX_REDUCE ){
|
}else if( yyact <= YY_MAX_REDUCE ){
|
||||||
yy_reduce(yypParser,yyact-YY_MIN_REDUCE);
|
yy_reduce(yypParser,yyact-YY_MIN_REDUCE);
|
||||||
|
|
Loading…
Reference in a new issue