mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-06 23:20:53 +00:00
Forgot to update lempar.c with lemon.c, so here is version 1.23 from the SQLite CVS.
SVN r468 (trunk)
This commit is contained in:
parent
b06f4423b9
commit
323034af74
1 changed files with 735 additions and 717 deletions
|
@ -1,12 +1,9 @@
|
||||||
/* Driver template for the LEMON parser generator.
|
/* Driver template for the LEMON parser generator.
|
||||||
** The author disclaims copyright to this source code.
|
** The author disclaims copyright to this source code.
|
||||||
*/
|
*/
|
||||||
/* First off, code is include 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>
|
||||||
#ifndef NDEBUG
|
|
||||||
#include <string.h>
|
|
||||||
#endif
|
|
||||||
%%
|
%%
|
||||||
/* 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.
|
||||||
|
@ -110,7 +107,7 @@
|
||||||
** yy_default[] Default action for each state.
|
** yy_default[] Default action for each state.
|
||||||
*/
|
*/
|
||||||
%%
|
%%
|
||||||
#define YY_SZ_ACTTAB (sizeof(yy_action)/sizeof(yy_action[0]))
|
#define YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0]))
|
||||||
|
|
||||||
/* The next table maps tokens into fallback tokens. If a construct
|
/* The next table maps tokens into fallback tokens. If a construct
|
||||||
** like the following:
|
** like the following:
|
||||||
|
@ -324,7 +321,7 @@ void ParseFree(
|
||||||
*/
|
*/
|
||||||
static int yy_find_shift_action(
|
static int yy_find_shift_action(
|
||||||
yyParser *pParser, /* The parser */
|
yyParser *pParser, /* The parser */
|
||||||
int iLookAhead /* The look-ahead token */
|
YYCODETYPE iLookAhead /* The look-ahead token */
|
||||||
){
|
){
|
||||||
int i;
|
int i;
|
||||||
int stateno = pParser->yystack[pParser->yyidx].stateno;
|
int stateno = pParser->yystack[pParser->yyidx].stateno;
|
||||||
|
@ -337,19 +334,35 @@ static int yy_find_shift_action(
|
||||||
}
|
}
|
||||||
i += iLookAhead;
|
i += iLookAhead;
|
||||||
if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
|
if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
|
||||||
|
if( iLookAhead>0 ){
|
||||||
#ifdef YYFALLBACK
|
#ifdef YYFALLBACK
|
||||||
int iFallback; /* Fallback token */
|
int iFallback; /* Fallback token */
|
||||||
if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
|
if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
|
||||||
&& (iFallback = yyFallback[iLookAhead])!=0 ){
|
&& (iFallback = yyFallback[iLookAhead])!=0 ){
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
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]);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return yy_find_shift_action(pParser, iFallback);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return yy_find_shift_action(pParser, iFallback);
|
#ifdef YYWILDCARD
|
||||||
|
{
|
||||||
|
int j = i - iLookAhead + YYWILDCARD;
|
||||||
|
if( j>=0 && j<YY_SZ_ACTTAB && yy_lookahead[j]==YYWILDCARD ){
|
||||||
|
#ifndef NDEBUG
|
||||||
|
if( yyTraceFILE ){
|
||||||
|
fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
|
||||||
|
yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]);
|
||||||
|
}
|
||||||
|
#endif /* NDEBUG */
|
||||||
|
return yy_action[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /* YYWILDCARD */
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return yy_default[stateno];
|
return yy_default[stateno];
|
||||||
}else{
|
}else{
|
||||||
return yy_action[i];
|
return yy_action[i];
|
||||||
|
@ -366,7 +379,7 @@ static int yy_find_shift_action(
|
||||||
*/
|
*/
|
||||||
static int yy_find_reduce_action(
|
static int yy_find_reduce_action(
|
||||||
int stateno, /* Current state number */
|
int stateno, /* Current state number */
|
||||||
int iLookAhead /* The look-ahead token */
|
YYCODETYPE iLookAhead /* The look-ahead token */
|
||||||
){
|
){
|
||||||
int i;
|
int i;
|
||||||
/* int stateno = pParser->yystack[pParser->yyidx].stateno; */
|
/* int stateno = pParser->yystack[pParser->yyidx].stateno; */
|
||||||
|
@ -457,13 +470,12 @@ static void yy_reduce(
|
||||||
yymsp = &yypParser->yystack[yypParser->yyidx];
|
yymsp = &yypParser->yystack[yypParser->yyidx];
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if( yyTraceFILE && yyruleno>=0
|
if( yyTraceFILE && yyruleno>=0
|
||||||
&& yyruleno<sizeof(yyRuleName)/sizeof(yyRuleName[0]) ){
|
&& yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
|
||||||
fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
|
fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
|
||||||
yyRuleName[yyruleno]);
|
yyRuleName[yyruleno]);
|
||||||
}
|
}
|
||||||
#endif /* NDEBUG */
|
#endif /* NDEBUG */
|
||||||
|
|
||||||
#ifndef NDEBUG
|
|
||||||
/* Silence complaints from purify about yygotominor being uninitialized
|
/* Silence complaints from purify about yygotominor being uninitialized
|
||||||
** in some cases when it is copied into the stack after the following
|
** in some cases when it is copied into the stack after the following
|
||||||
** switch. yygotominor is uninitialized when a rule reduces that does
|
** switch. yygotominor is uninitialized when a rule reduces that does
|
||||||
|
@ -471,9 +483,15 @@ static void yy_reduce(
|
||||||
** value of the nonterminal uninitialized is utterly harmless as long
|
** value of the nonterminal uninitialized is utterly harmless as long
|
||||||
** as the value is never used. So really the only thing this code
|
** as the value is never used. So really the only thing this code
|
||||||
** accomplishes is to quieten purify.
|
** accomplishes is to quieten purify.
|
||||||
|
**
|
||||||
|
** 2007-01-16: The wireshark project (www.wireshark.org) reports that
|
||||||
|
** without this code, their parser segfaults. I'm not sure what there
|
||||||
|
** parser is doing to make this happen. This is the second bug report
|
||||||
|
** from wireshark this week. Clearly they are stressing Lemon in ways
|
||||||
|
** that it has not been previously stressed... (SQLite ticket #2172)
|
||||||
*/
|
*/
|
||||||
memset(&yygotominor, 0, sizeof(yygotominor));
|
memset(&yygotominor, 0, sizeof(yygotominor));
|
||||||
#endif
|
|
||||||
|
|
||||||
switch( yyruleno ){
|
switch( yyruleno ){
|
||||||
/* Beginning here are the reduction cases. A typical example
|
/* Beginning here are the reduction cases. A typical example
|
||||||
|
|
Loading…
Reference in a new issue