mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-07 07:21:01 +00:00
Fixed some lemon bugs:
* "Symbol name missing after %destructor keyword" error message displayed incorrectly. * Line numbers in the generated file for lines that came from the template were off. * The parser did not immediately reduce after a shift. There always needed to be another token input first before a reduce would occur, and then the token would sometimes be lost. SVN r469 (trunk)
This commit is contained in:
parent
323034af74
commit
e8495e90f5
2 changed files with 761 additions and 739 deletions
|
@ -2287,7 +2287,7 @@ to follow the previous rule.");
|
||||||
case WAITING_FOR_DESTRUCTOR_SYMBOL:
|
case WAITING_FOR_DESTRUCTOR_SYMBOL:
|
||||||
if( !isalpha(x[0]) ){
|
if( !isalpha(x[0]) ){
|
||||||
ErrorMsg(psp->filename,psp->tokenlineno,
|
ErrorMsg(psp->filename,psp->tokenlineno,
|
||||||
"Symbol name missing after %destructor keyword");
|
"Symbol name missing after %%destructor keyword");
|
||||||
psp->errorcnt++;
|
psp->errorcnt++;
|
||||||
psp->state = RESYNC_AFTER_DECL_ERROR;
|
psp->state = RESYNC_AFTER_DECL_ERROR;
|
||||||
}else{
|
}else{
|
||||||
|
@ -2300,7 +2300,7 @@ to follow the previous rule.");
|
||||||
case WAITING_FOR_DATATYPE_SYMBOL:
|
case WAITING_FOR_DATATYPE_SYMBOL:
|
||||||
if( !isalpha(x[0]) ){
|
if( !isalpha(x[0]) ){
|
||||||
ErrorMsg(psp->filename,psp->tokenlineno,
|
ErrorMsg(psp->filename,psp->tokenlineno,
|
||||||
"Symbol name missing after %destructor keyword");
|
"Symbol name missing after %%destructor keyword");
|
||||||
psp->errorcnt++;
|
psp->errorcnt++;
|
||||||
psp->state = RESYNC_AFTER_DECL_ERROR;
|
psp->state = RESYNC_AFTER_DECL_ERROR;
|
||||||
}else{
|
}else{
|
||||||
|
@ -2450,6 +2450,23 @@ static void preprocess_input(char *z){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int strip_crlf(filebuf, filesize)
|
||||||
|
char *filebuf;
|
||||||
|
int filesize;
|
||||||
|
{
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
for (i = j = 0; i < filesize; ++i, ++j)
|
||||||
|
{
|
||||||
|
if (filebuf[i] == '\r' && filebuf[i+1] == '\n')
|
||||||
|
{
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
filebuf[j] = filebuf[i];
|
||||||
|
}
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
|
||||||
/* In spite of its name, this function is really a scanner. It read
|
/* In spite of its name, this function is really a scanner. It read
|
||||||
** in the entire input file (all at once) then tokenizes it. Each
|
** in the entire input file (all at once) then tokenizes it. Each
|
||||||
** token is passed to the function "parseonetoken" which builds all
|
** token is passed to the function "parseonetoken" which builds all
|
||||||
|
@ -2498,6 +2515,7 @@ struct lemon *gp;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
filesize = strip_crlf(filebuf, filesize);
|
||||||
filebuf[filesize] = 0;
|
filebuf[filesize] = 0;
|
||||||
|
|
||||||
/* Make an initial pass through the file to handle %ifdef and %ifndef */
|
/* Make an initial pass through the file to handle %ifdef and %ifndef */
|
||||||
|
@ -3079,8 +3097,8 @@ int *lineno;
|
||||||
putc('\n',out);
|
putc('\n',out);
|
||||||
(*lineno)++;
|
(*lineno)++;
|
||||||
}
|
}
|
||||||
tplt_linedir(out,*lineno+2,lemp->outname);
|
tplt_linedir(out,*lineno+1,lemp->outname);
|
||||||
(*lineno)+=2;
|
(*lineno)+=1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
/* First off, code is included which follows the "include" declaration
|
/* First off, code is included which follows the "include" declaration
|
||||||
** in the input file. */
|
** in the input file. */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
%%
|
%%
|
||||||
/* Next is all token values, in a form suitable for use by makeheaders.
|
/* Next is all token values, in a form suitable for use by makeheaders.
|
||||||
** This section will be null unless lemon is run with the -m switch.
|
** This section will be null unless lemon is run with the -m switch.
|
||||||
|
@ -420,7 +421,7 @@ static void yy_shift(
|
||||||
#endif
|
#endif
|
||||||
while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
|
while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
|
||||||
/* Here code is inserted which will execute if the parser
|
/* Here code is inserted which will execute if the parser
|
||||||
** stack every overflows */
|
** stack ever overflows */
|
||||||
%%
|
%%
|
||||||
ParseARG_STORE; /* Suppress warning about unused %extra_argument var */
|
ParseARG_STORE; /* Suppress warning about unused %extra_argument var */
|
||||||
return;
|
return;
|
||||||
|
@ -641,6 +642,9 @@ void Parse(
|
||||||
yymajor = 0;
|
yymajor = 0;
|
||||||
}else{
|
}else{
|
||||||
yymajor = YYNOCODE;
|
yymajor = YYNOCODE;
|
||||||
|
while( yypParser->yyidx>= 0 && (yyact = yy_find_shift_action(yypParser,YYNOCODE)) < YYNSTATE + YYNRULE ){
|
||||||
|
yy_reduce(yypParser,yyact-YYNSTATE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}else if( yyact < YYNSTATE + YYNRULE ){
|
}else if( yyact < YYNSTATE + YYNRULE ){
|
||||||
yy_reduce(yypParser,yyact-YYNSTATE);
|
yy_reduce(yypParser,yyact-YYNSTATE);
|
||||||
|
|
Loading…
Reference in a new issue