mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
CONFIG: update lemon code to version from 2019-09-11
This commit is contained in:
committed by
Andrew Heather
parent
07ac8aa916
commit
80daea6017
@ -535,15 +535,18 @@ static YYACTIONTYPE yy_find_shift_action(
|
|||||||
do{
|
do{
|
||||||
i = yy_shift_ofst[stateno];
|
i = yy_shift_ofst[stateno];
|
||||||
assert( i>=0 );
|
assert( i>=0 );
|
||||||
/* assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD ); */
|
assert( i<=YY_ACTTAB_COUNT );
|
||||||
|
assert( i+YYNTOKEN<=(int)YY_NLOOKAHEAD );
|
||||||
assert( iLookAhead!=YYNOCODE );
|
assert( iLookAhead!=YYNOCODE );
|
||||||
assert( iLookAhead < YYNTOKEN );
|
assert( iLookAhead < YYNTOKEN );
|
||||||
i += iLookAhead;
|
i += iLookAhead;
|
||||||
if( i>=YY_NLOOKAHEAD || yy_lookahead[i]!=iLookAhead ){
|
assert( i<(int)YY_NLOOKAHEAD );
|
||||||
|
if( yy_lookahead[i]!=iLookAhead ){
|
||||||
#ifdef YYFALLBACK
|
#ifdef YYFALLBACK
|
||||||
YYCODETYPE iFallback; /* Fallback token */
|
YYCODETYPE iFallback; /* Fallback token */
|
||||||
if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
|
assert( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0]) );
|
||||||
&& (iFallback = yyFallback[iLookAhead])!=0 ){
|
iFallback = yyFallback[iLookAhead];
|
||||||
|
if( iFallback!=0 ){
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if( yyTraceFILE ){
|
if( yyTraceFILE ){
|
||||||
fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
|
fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
|
||||||
@ -558,16 +561,8 @@ static YYACTIONTYPE yy_find_shift_action(
|
|||||||
#ifdef YYWILDCARD
|
#ifdef YYWILDCARD
|
||||||
{
|
{
|
||||||
int j = i - iLookAhead + YYWILDCARD;
|
int j = i - iLookAhead + YYWILDCARD;
|
||||||
if(
|
assert( j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) );
|
||||||
#if YY_SHIFT_MIN+YYWILDCARD<0
|
if( yy_lookahead[j]==YYWILDCARD && iLookAhead>0 ){
|
||||||
j>=0 &&
|
|
||||||
#endif
|
|
||||||
#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT
|
|
||||||
j<YY_ACTTAB_COUNT &&
|
|
||||||
#endif
|
|
||||||
j<(int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0])) &&
|
|
||||||
yy_lookahead[j]==YYWILDCARD && iLookAhead>0
|
|
||||||
){
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if( yyTraceFILE ){
|
if( yyTraceFILE ){
|
||||||
fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
|
fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
|
||||||
@ -1086,9 +1081,8 @@ void Parse(
|
|||||||
%namespace_begin
|
%namespace_begin
|
||||||
int ParseFallback(int iToken){
|
int ParseFallback(int iToken){
|
||||||
#ifdef YYFALLBACK
|
#ifdef YYFALLBACK
|
||||||
if( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) ){
|
assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) );
|
||||||
return yyFallback[iToken];
|
return yyFallback[iToken];
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
(void)iToken;
|
(void)iToken;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* Part of check-in [https://www.sqlite.org/src/info/2da0eea02d128c37]
|
* Part of check-in [https://www.sqlite.org/src/info/980be1730dc1239c]
|
||||||
* artifact:
|
* artifact:
|
||||||
* https://www.sqlite.org/src/raw/tool/lemon.c?name=cc43148d2793ab93668e74a6a6319bb71c2e65c1ffcd6deeaa59e12be9362a43
|
* https://www.sqlite.org/src/raw/tool/lemon.c?name=61d5f0af1eff8f754b75ddca668c9897fd30759e389bfffb42ce9e4d38fd4746
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** This file contains all sources (including headers) to the LEMON
|
** This file contains all sources (including headers) to the LEMON
|
||||||
** LALR(1) parser generator. The sources have been combined into a
|
** LALR(1) parser generator. The sources have been combined into a
|
||||||
@ -4244,6 +4243,7 @@ void ReportTable(
|
|||||||
struct rule *rp;
|
struct rule *rp;
|
||||||
struct acttab *pActtab;
|
struct acttab *pActtab;
|
||||||
int i, j, n, sz;
|
int i, j, n, sz;
|
||||||
|
int nLookAhead;
|
||||||
int szActionType; /* sizeof(YYACTIONTYPE) */
|
int szActionType; /* sizeof(YYACTIONTYPE) */
|
||||||
int szCodeType; /* sizeof(YYCODETYPE) */
|
int szCodeType; /* sizeof(YYCODETYPE) */
|
||||||
const char *name;
|
const char *name;
|
||||||
@ -4495,13 +4495,29 @@ void ReportTable(
|
|||||||
if( la<0 ) la = lemp->nsymbol;
|
if( la<0 ) la = lemp->nsymbol;
|
||||||
if( j==0 ) fprintf(out," /* %5d */ ", i);
|
if( j==0 ) fprintf(out," /* %5d */ ", i);
|
||||||
fprintf(out, " %4d,", la);
|
fprintf(out, " %4d,", la);
|
||||||
if( j==9 || i==n-1 ){
|
if( j==9 ){
|
||||||
fprintf(out, "\n"); lineno++;
|
fprintf(out, "\n"); lineno++;
|
||||||
j = 0;
|
j = 0;
|
||||||
}else{
|
}else{
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* Add extra entries to the end of the yy_lookahead[] table so that
|
||||||
|
** yy_shift_ofst[]+iToken will always be a valid index into the array,
|
||||||
|
** even for the largest possible value of yy_shift_ofst[] and iToken. */
|
||||||
|
nLookAhead = lemp->nterminal + lemp->nactiontab;
|
||||||
|
while( i<nLookAhead ){
|
||||||
|
if( j==0 ) fprintf(out," /* %5d */ ", i);
|
||||||
|
fprintf(out, " %4d,", lemp->nterminal);
|
||||||
|
if( j==9 ){
|
||||||
|
fprintf(out, "\n"); lineno++;
|
||||||
|
j = 0;
|
||||||
|
}else{
|
||||||
|
j++;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
if( j>0 ){ fprintf(out, "\n"); lineno++; }
|
||||||
fprintf(out, "};\n"); lineno++;
|
fprintf(out, "};\n"); lineno++;
|
||||||
|
|
||||||
/* Output the yy_shift_ofst[] table */
|
/* Output the yy_shift_ofst[] table */
|
||||||
@ -4581,7 +4597,9 @@ void ReportTable(
|
|||||||
*/
|
*/
|
||||||
if( lemp->has_fallback ){
|
if( lemp->has_fallback ){
|
||||||
int mx = lemp->nterminal - 1;
|
int mx = lemp->nterminal - 1;
|
||||||
while( mx>0 && lemp->symbols[mx]->fallback==0 ){ mx--; }
|
/* 2019-08-28: Generate fallback entries for every token to avoid
|
||||||
|
** having to do a range check on the index */
|
||||||
|
/* while( mx>0 && lemp->symbols[mx]->fallback==0 ){ mx--; } */
|
||||||
lemp->tablesize += (mx+1)*szCodeType;
|
lemp->tablesize += (mx+1)*szCodeType;
|
||||||
for(i=0; i<=mx; i++){
|
for(i=0; i<=mx; i++){
|
||||||
struct symbol *p = lemp->symbols[i];
|
struct symbol *p = lemp->symbols[i];
|
||||||
|
|||||||
Reference in New Issue
Block a user