mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-28 06:42:09 +00:00
Lemon update 2015-11-10 14:51:22 on branch trunk
- Improved output formatting for "PRAGMA parser_trace=ON;". (user: drh)
This commit is contained in:
parent
e9501e8688
commit
be870502fd
1 changed files with 19 additions and 10 deletions
|
@ -548,15 +548,13 @@ static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
static void yyTraceShift(yyParser *yypParser, int yyNewState){
|
static void yyTraceShift(yyParser *yypParser, int yyNewState){
|
||||||
if( yyTraceFILE ){
|
if( yyTraceFILE ){
|
||||||
int i;
|
|
||||||
if( yyNewState<YYNSTATE ){
|
if( yyNewState<YYNSTATE ){
|
||||||
fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState);
|
fprintf(yyTraceFILE,"%sShift '%s', go to state %d\n",
|
||||||
fprintf(yyTraceFILE,"%sStack:",yyTracePrompt);
|
yyTracePrompt,yyTokenName[yypParser->yystack[yypParser->yyidx].major],
|
||||||
for(i=1; i<=yypParser->yyidx; i++)
|
yyNewState);
|
||||||
fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]);
|
|
||||||
fprintf(yyTraceFILE,"\n");
|
|
||||||
}else{
|
}else{
|
||||||
fprintf(yyTraceFILE,"%sShift *\n",yyTracePrompt);
|
fprintf(yyTraceFILE,"%sShift '%s'\n",
|
||||||
|
yyTracePrompt,yyTokenName[yypParser->yystack[yypParser->yyidx].major]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -632,7 +630,7 @@ static void yy_reduce(
|
||||||
if( yyTraceFILE && yyruleno>=0
|
if( yyTraceFILE && yyruleno>=0
|
||||||
&& yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
|
&& yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
|
||||||
yysize = yyRuleInfo[yyruleno].nrhs;
|
yysize = yyRuleInfo[yyruleno].nrhs;
|
||||||
fprintf(yyTraceFILE, "%sReduce [%s] -> state %d.\n", yyTracePrompt,
|
fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt,
|
||||||
yyRuleName[yyruleno], yymsp[-yysize].stateno);
|
yyRuleName[yyruleno], yymsp[-yysize].stateno);
|
||||||
}
|
}
|
||||||
#endif /* NDEBUG */
|
#endif /* NDEBUG */
|
||||||
|
@ -789,6 +787,12 @@ void Parse(
|
||||||
yypParser->yyerrcnt = -1;
|
yypParser->yyerrcnt = -1;
|
||||||
yypParser->yystack[0].stateno = 0;
|
yypParser->yystack[0].stateno = 0;
|
||||||
yypParser->yystack[0].major = 0;
|
yypParser->yystack[0].major = 0;
|
||||||
|
#ifndef NDEBUG
|
||||||
|
if( yyTraceFILE ){
|
||||||
|
fprintf(yyTraceFILE,"%sInitialize. Empty stack. State 0\n",
|
||||||
|
yyTracePrompt);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
yyminorunion.yy0 = yyminor;
|
yyminorunion.yy0 = yyminor;
|
||||||
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
|
#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY)
|
||||||
|
@ -798,7 +802,7 @@ void Parse(
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if( yyTraceFILE ){
|
if( yyTraceFILE ){
|
||||||
fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]);
|
fprintf(yyTraceFILE,"%sInput '%s'\n",yyTracePrompt,yyTokenName[yymajor]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -912,7 +916,12 @@ void Parse(
|
||||||
}while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
|
}while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if( yyTraceFILE ){
|
if( yyTraceFILE ){
|
||||||
fprintf(yyTraceFILE,"%sReturn\n",yyTracePrompt);
|
int i;
|
||||||
|
fprintf(yyTraceFILE,"%sReturn. Stack=",yyTracePrompt);
|
||||||
|
for(i=1; i<=yypParser->yyidx; i++)
|
||||||
|
fprintf(yyTraceFILE,"%c%s", i==1 ? '[' : ' ',
|
||||||
|
yyTokenName[yypParser->yystack[i].major]);
|
||||||
|
fprintf(yyTraceFILE,"]\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue