mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-27 06:22:23 +00:00
Fixed: XLAT would not parse
- Disable the changes from commit 96afce241d
because it appears to not recognize default rules that reduce as
reducing.
- When tracing a parser, flush after every line output in case an
assert is hit so you can actually see what it did up to that point.
This commit is contained in:
parent
2e882a41a3
commit
f23e5d2677
2 changed files with 25 additions and 0 deletions
|
@ -199,7 +199,9 @@ struct rule {
|
|||
int index; /* An index number for this rule */
|
||||
int iRule; /* Rule number as used in the generated tables */
|
||||
Boolean canReduce; /* True if this rule is ever reduced */
|
||||
#if 0
|
||||
Boolean doesReduce; /* Reduce actions occur after optimization */
|
||||
#endif
|
||||
struct rule *nextlhs; /* Next rule with the same LHS */
|
||||
struct rule *next; /* Next rule in the global list */
|
||||
};
|
||||
|
@ -4156,6 +4158,7 @@ void ReportTable(
|
|||
}
|
||||
free(ax);
|
||||
|
||||
#if 0
|
||||
/* Mark rules that are actually used for reduce actions after all
|
||||
** optimizations have been applied
|
||||
*/
|
||||
|
@ -4168,6 +4171,7 @@ void ReportTable(
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Finish rendering the constants now that the action table has
|
||||
** been computed */
|
||||
|
@ -4462,12 +4466,16 @@ void ReportTable(
|
|||
assert( rp->noCode );
|
||||
fprintf(out," /* (%d) ", rp->iRule);
|
||||
writeRuleText(out, rp);
|
||||
#if 0
|
||||
if( rp->doesReduce ){
|
||||
#endif
|
||||
fprintf(out, " */ yytestcase(yyruleno==%d);\n", rp->iRule); lineno++;
|
||||
#if 0
|
||||
}else{
|
||||
fprintf(out, " (OPTIMIZED OUT) */ assert(yyruleno!=%d);\n",
|
||||
rp->iRule); lineno++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
fprintf(out," break;\n"); lineno++;
|
||||
tplt_xfer(lemp->name,in,out,&lineno);
|
||||
|
|
|
@ -308,6 +308,7 @@ static int yyGrowStack(yyParser *p){
|
|||
if( yyTraceFILE ){
|
||||
fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
|
||||
yyTracePrompt, p->yystksz, newSize);
|
||||
fflush(yyTraceFILE);
|
||||
}
|
||||
#endif
|
||||
p->yystksz = newSize;
|
||||
|
@ -410,6 +411,7 @@ static void yy_pop_parser_stack(yyParser *pParser){
|
|||
fprintf(yyTraceFILE,"%sPopping %s\n",
|
||||
yyTracePrompt,
|
||||
yyTokenName[yytos->major]);
|
||||
fflush(yyTraceFILE);
|
||||
}
|
||||
#endif
|
||||
yy_destructor(pParser, yytos->major, &yytos->minor);
|
||||
|
@ -474,6 +476,7 @@ static unsigned int yy_find_shift_action(
|
|||
if( yyTraceFILE ){
|
||||
fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
|
||||
yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
|
||||
fflush(yyTraceFILE);
|
||||
}
|
||||
#endif
|
||||
assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */
|
||||
|
@ -498,6 +501,7 @@ static unsigned int yy_find_shift_action(
|
|||
fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
|
||||
yyTracePrompt, yyTokenName[iLookAhead],
|
||||
yyTokenName[YYWILDCARD]);
|
||||
fflush(yyTraceFILE);
|
||||
}
|
||||
#endif /* NDEBUG */
|
||||
return yy_action[j];
|
||||
|
@ -551,6 +555,7 @@ static void yyStackOverflow(yyParser *yypParser){
|
|||
#ifndef NDEBUG
|
||||
if( yyTraceFILE ){
|
||||
fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
|
||||
fflush(yyTraceFILE);
|
||||
}
|
||||
#endif
|
||||
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
|
||||
|
@ -576,6 +581,7 @@ static void yyTraceShift(yyParser *yypParser, int yyNewState){
|
|||
fprintf(yyTraceFILE,"%sShift '%s'\n",
|
||||
yyTracePrompt,yyTokenName[yypParser->yytos->major]);
|
||||
}
|
||||
fflush(yyTraceFILE);
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
@ -653,6 +659,7 @@ static void yy_reduce(
|
|||
yysize = yyRuleInfo[yyruleno].nrhs;
|
||||
fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt,
|
||||
yyRuleName[yyruleno], yymsp[-yysize].stateno);
|
||||
fflush(yyTraceFILE);
|
||||
}
|
||||
#endif /* NDEBUG */
|
||||
|
||||
|
@ -726,6 +733,7 @@ static void yy_parse_failed(
|
|||
#ifndef NDEBUG
|
||||
if( yyTraceFILE ){
|
||||
fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
|
||||
fflush(yyTraceFILE);
|
||||
}
|
||||
#endif
|
||||
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
|
||||
|
@ -764,12 +772,17 @@ static void yy_accept(
|
|||
#ifndef NDEBUG
|
||||
if( yyTraceFILE ){
|
||||
fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
|
||||
fflush(yyTraceFILE);
|
||||
}
|
||||
#endif
|
||||
#ifndef YYNOERRORRECOVERY
|
||||
yypParser->yyerrcnt = -1;
|
||||
#endif
|
||||
#if 0
|
||||
assert( yypParser->yytos==yypParser->yystack );
|
||||
#else
|
||||
while (yypParser->yytos>yypParser->yystack) yy_pop_parser_stack(yypParser);
|
||||
#endif
|
||||
/* Here code is inserted which will be executed whenever the
|
||||
** parser accepts */
|
||||
/*********** Begin %parse_accept code *****************************************/
|
||||
|
@ -823,6 +836,7 @@ void Parse(
|
|||
#ifndef NDEBUG
|
||||
if( yyTraceFILE ){
|
||||
fprintf(yyTraceFILE,"%sInput '%s'\n",yyTracePrompt,yyTokenName[yymajor]);
|
||||
fflush(yyTraceFILE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -845,6 +859,7 @@ void Parse(
|
|||
#ifndef NDEBUG
|
||||
if( yyTraceFILE ){
|
||||
fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
|
||||
fflush(yyTraceFILE);
|
||||
}
|
||||
#endif
|
||||
#ifdef YYERRORSYMBOL
|
||||
|
@ -876,6 +891,7 @@ void Parse(
|
|||
if( yyTraceFILE ){
|
||||
fprintf(yyTraceFILE,"%sDiscard input token %s\n",
|
||||
yyTracePrompt,yyTokenName[yymajor]);
|
||||
fflush(yyTraceFILE);
|
||||
}
|
||||
#endif
|
||||
yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
|
||||
|
@ -949,6 +965,7 @@ void Parse(
|
|||
cDiv = ' ';
|
||||
}
|
||||
fprintf(yyTraceFILE,"]\n");
|
||||
fflush(yyTraceFILE);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue