mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-12-01 08:21:46 +00:00
Lemon update 2010-01-06 13:07:31 on branch trunk
- Fix an issue with lemon generating incorrect grammars. This issue does not effect SQLite. (user: drh)
This commit is contained in:
parent
1c592c9601
commit
961188bc81
1 changed files with 6 additions and 4 deletions
|
@ -495,6 +495,7 @@ void acttab_action(acttab *p, int lookahead, int action){
|
||||||
*/
|
*/
|
||||||
int acttab_insert(acttab *p){
|
int acttab_insert(acttab *p){
|
||||||
int i, j, k, n;
|
int i, j, k, n;
|
||||||
|
int nActtab; /* Number of slots in the p->aAction[] table */
|
||||||
assert( p->nLookahead>0 );
|
assert( p->nLookahead>0 );
|
||||||
|
|
||||||
/* Make sure we have enough space to hold the expanded action table
|
/* Make sure we have enough space to hold the expanded action table
|
||||||
|
@ -502,7 +503,8 @@ int acttab_insert(acttab *p){
|
||||||
** must be appended to the current action table
|
** must be appended to the current action table
|
||||||
*/
|
*/
|
||||||
n = p->mxLookahead + 1;
|
n = p->mxLookahead + 1;
|
||||||
if( p->nAction + n >= p->nActionAlloc ){
|
nActtab = p->nAction + n;
|
||||||
|
if( nActtab >= p->nActionAlloc ){
|
||||||
int oldAlloc = p->nActionAlloc;
|
int oldAlloc = p->nActionAlloc;
|
||||||
p->nActionAlloc = p->nAction + n + p->nActionAlloc + 20;
|
p->nActionAlloc = p->nAction + n + p->nActionAlloc + 20;
|
||||||
p->aAction = realloc( p->aAction,
|
p->aAction = realloc( p->aAction,
|
||||||
|
@ -520,11 +522,11 @@ int acttab_insert(acttab *p){
|
||||||
/* Scan the existing action table looking for an offset where we can
|
/* Scan the existing action table looking for an offset where we can
|
||||||
** insert the current transaction set. Fall out of the loop when that
|
** insert the current transaction set. Fall out of the loop when that
|
||||||
** offset is found. In the worst case, we fall out of the loop when
|
** offset is found. In the worst case, we fall out of the loop when
|
||||||
** i reaches p->nAction, which means we append the new transaction set.
|
** i reaches nActtab, which means we append the new transaction set.
|
||||||
**
|
**
|
||||||
** i is the index in p->aAction[] where p->mnLookahead is inserted.
|
** i is the index in p->aAction[] where p->mnLookahead is inserted.
|
||||||
*/
|
*/
|
||||||
for(i=p->nAction-1; i>=0; i--){
|
for(i=nActtab-1; i>=0; i--){
|
||||||
/* First look for an existing action table entry that can be reused */
|
/* First look for an existing action table entry that can be reused */
|
||||||
if( p->aAction[i].lookahead==p->mnLookahead ){
|
if( p->aAction[i].lookahead==p->mnLookahead ){
|
||||||
if( p->aAction[i].action!=p->mnAction ) continue;
|
if( p->aAction[i].action!=p->mnAction ) continue;
|
||||||
|
@ -547,7 +549,7 @@ int acttab_insert(acttab *p){
|
||||||
}
|
}
|
||||||
if( i<0 ){
|
if( i<0 ){
|
||||||
/* If no reusable entry is found, look for an empty slot */
|
/* If no reusable entry is found, look for an empty slot */
|
||||||
for(i=0; i<p->nAction; i++){
|
for(i=0; i<nActtab; i++){
|
||||||
if( p->aAction[i].lookahead<0 ){
|
if( p->aAction[i].lookahead<0 ){
|
||||||
for(j=0; j<p->nLookahead; j++){
|
for(j=0; j<p->nLookahead; j++){
|
||||||
k = p->aLookahead[j].lookahead - p->mnLookahead + i;
|
k = p->aLookahead[j].lookahead - p->mnLookahead + i;
|
||||||
|
|
Loading…
Reference in a new issue