mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 05:21:16 +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 index; /* An index number for this rule */
|
||||||
int iRule; /* Rule number as used in the generated tables */
|
int iRule; /* Rule number as used in the generated tables */
|
||||||
Boolean canReduce; /* True if this rule is ever reduced */
|
Boolean canReduce; /* True if this rule is ever reduced */
|
||||||
|
#if 0
|
||||||
Boolean doesReduce; /* Reduce actions occur after optimization */
|
Boolean doesReduce; /* Reduce actions occur after optimization */
|
||||||
|
#endif
|
||||||
struct rule *nextlhs; /* Next rule with the same LHS */
|
struct rule *nextlhs; /* Next rule with the same LHS */
|
||||||
struct rule *next; /* Next rule in the global list */
|
struct rule *next; /* Next rule in the global list */
|
||||||
};
|
};
|
||||||
|
@ -4156,6 +4158,7 @@ void ReportTable(
|
||||||
}
|
}
|
||||||
free(ax);
|
free(ax);
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* Mark rules that are actually used for reduce actions after all
|
/* Mark rules that are actually used for reduce actions after all
|
||||||
** optimizations have been applied
|
** optimizations have been applied
|
||||||
*/
|
*/
|
||||||
|
@ -4168,6 +4171,7 @@ void ReportTable(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Finish rendering the constants now that the action table has
|
/* Finish rendering the constants now that the action table has
|
||||||
** been computed */
|
** been computed */
|
||||||
|
@ -4462,12 +4466,16 @@ void ReportTable(
|
||||||
assert( rp->noCode );
|
assert( rp->noCode );
|
||||||
fprintf(out," /* (%d) ", rp->iRule);
|
fprintf(out," /* (%d) ", rp->iRule);
|
||||||
writeRuleText(out, rp);
|
writeRuleText(out, rp);
|
||||||
|
#if 0
|
||||||
if( rp->doesReduce ){
|
if( rp->doesReduce ){
|
||||||
|
#endif
|
||||||
fprintf(out, " */ yytestcase(yyruleno==%d);\n", rp->iRule); lineno++;
|
fprintf(out, " */ yytestcase(yyruleno==%d);\n", rp->iRule); lineno++;
|
||||||
|
#if 0
|
||||||
}else{
|
}else{
|
||||||
fprintf(out, " (OPTIMIZED OUT) */ assert(yyruleno!=%d);\n",
|
fprintf(out, " (OPTIMIZED OUT) */ assert(yyruleno!=%d);\n",
|
||||||
rp->iRule); lineno++;
|
rp->iRule); lineno++;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
fprintf(out," break;\n"); lineno++;
|
fprintf(out," break;\n"); lineno++;
|
||||||
tplt_xfer(lemp->name,in,out,&lineno);
|
tplt_xfer(lemp->name,in,out,&lineno);
|
||||||
|
|
|
@ -308,6 +308,7 @@ static int yyGrowStack(yyParser *p){
|
||||||
if( yyTraceFILE ){
|
if( yyTraceFILE ){
|
||||||
fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
|
fprintf(yyTraceFILE,"%sStack grows from %d to %d entries.\n",
|
||||||
yyTracePrompt, p->yystksz, newSize);
|
yyTracePrompt, p->yystksz, newSize);
|
||||||
|
fflush(yyTraceFILE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
p->yystksz = newSize;
|
p->yystksz = newSize;
|
||||||
|
@ -410,6 +411,7 @@ static void yy_pop_parser_stack(yyParser *pParser){
|
||||||
fprintf(yyTraceFILE,"%sPopping %s\n",
|
fprintf(yyTraceFILE,"%sPopping %s\n",
|
||||||
yyTracePrompt,
|
yyTracePrompt,
|
||||||
yyTokenName[yytos->major]);
|
yyTokenName[yytos->major]);
|
||||||
|
fflush(yyTraceFILE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
yy_destructor(pParser, yytos->major, &yytos->minor);
|
yy_destructor(pParser, yytos->major, &yytos->minor);
|
||||||
|
@ -474,6 +476,7 @@ static unsigned int yy_find_shift_action(
|
||||||
if( yyTraceFILE ){
|
if( yyTraceFILE ){
|
||||||
fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
|
fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
|
||||||
yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
|
yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
|
||||||
|
fflush(yyTraceFILE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
assert( yyFallback[iFallback]==0 ); /* Fallback loop must terminate */
|
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",
|
fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
|
||||||
yyTracePrompt, yyTokenName[iLookAhead],
|
yyTracePrompt, yyTokenName[iLookAhead],
|
||||||
yyTokenName[YYWILDCARD]);
|
yyTokenName[YYWILDCARD]);
|
||||||
|
fflush(yyTraceFILE);
|
||||||
}
|
}
|
||||||
#endif /* NDEBUG */
|
#endif /* NDEBUG */
|
||||||
return yy_action[j];
|
return yy_action[j];
|
||||||
|
@ -551,6 +555,7 @@ static void yyStackOverflow(yyParser *yypParser){
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if( yyTraceFILE ){
|
if( yyTraceFILE ){
|
||||||
fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
|
fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
|
||||||
|
fflush(yyTraceFILE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
|
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",
|
fprintf(yyTraceFILE,"%sShift '%s'\n",
|
||||||
yyTracePrompt,yyTokenName[yypParser->yytos->major]);
|
yyTracePrompt,yyTokenName[yypParser->yytos->major]);
|
||||||
}
|
}
|
||||||
|
fflush(yyTraceFILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -653,6 +659,7 @@ static void yy_reduce(
|
||||||
yysize = yyRuleInfo[yyruleno].nrhs;
|
yysize = yyRuleInfo[yyruleno].nrhs;
|
||||||
fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt,
|
fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt,
|
||||||
yyRuleName[yyruleno], yymsp[-yysize].stateno);
|
yyRuleName[yyruleno], yymsp[-yysize].stateno);
|
||||||
|
fflush(yyTraceFILE);
|
||||||
}
|
}
|
||||||
#endif /* NDEBUG */
|
#endif /* NDEBUG */
|
||||||
|
|
||||||
|
@ -726,6 +733,7 @@ static void yy_parse_failed(
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if( yyTraceFILE ){
|
if( yyTraceFILE ){
|
||||||
fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
|
fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
|
||||||
|
fflush(yyTraceFILE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
|
while( yypParser->yytos>yypParser->yystack ) yy_pop_parser_stack(yypParser);
|
||||||
|
@ -764,12 +772,17 @@ static void yy_accept(
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if( yyTraceFILE ){
|
if( yyTraceFILE ){
|
||||||
fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
|
fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
|
||||||
|
fflush(yyTraceFILE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifndef YYNOERRORRECOVERY
|
#ifndef YYNOERRORRECOVERY
|
||||||
yypParser->yyerrcnt = -1;
|
yypParser->yyerrcnt = -1;
|
||||||
#endif
|
#endif
|
||||||
|
#if 0
|
||||||
assert( yypParser->yytos==yypParser->yystack );
|
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
|
/* Here code is inserted which will be executed whenever the
|
||||||
** parser accepts */
|
** parser accepts */
|
||||||
/*********** Begin %parse_accept code *****************************************/
|
/*********** Begin %parse_accept code *****************************************/
|
||||||
|
@ -823,6 +836,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]);
|
||||||
|
fflush(yyTraceFILE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -845,6 +859,7 @@ void Parse(
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if( yyTraceFILE ){
|
if( yyTraceFILE ){
|
||||||
fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
|
fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
|
||||||
|
fflush(yyTraceFILE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef YYERRORSYMBOL
|
#ifdef YYERRORSYMBOL
|
||||||
|
@ -876,6 +891,7 @@ void Parse(
|
||||||
if( yyTraceFILE ){
|
if( yyTraceFILE ){
|
||||||
fprintf(yyTraceFILE,"%sDiscard input token %s\n",
|
fprintf(yyTraceFILE,"%sDiscard input token %s\n",
|
||||||
yyTracePrompt,yyTokenName[yymajor]);
|
yyTracePrompt,yyTokenName[yymajor]);
|
||||||
|
fflush(yyTraceFILE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
|
yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion);
|
||||||
|
@ -949,6 +965,7 @@ void Parse(
|
||||||
cDiv = ' ';
|
cDiv = ' ';
|
||||||
}
|
}
|
||||||
fprintf(yyTraceFILE,"]\n");
|
fprintf(yyTraceFILE,"]\n");
|
||||||
|
fflush(yyTraceFILE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue