mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-31 04:20:34 +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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1474
tools/lemon/lempar.c
1474
tools/lemon/lempar.c
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue