diff options
author | Luis Ontanon <luis.ontanon@gmail.com> | 2007-01-16 05:38:55 +0000 |
---|---|---|
committer | Luis Ontanon <luis.ontanon@gmail.com> | 2007-01-16 05:38:55 +0000 |
commit | 74ed71d648386ba9fced3846095100a52c2fae51 (patch) | |
tree | 4daf358f455218ecf7a34825a658eeb58bf5fe2e /tools/lemon | |
parent | 2d760bf075e54cf148d0bc145d20ac994c887791 (diff) |
update to lemon.c 1.43
svn path=/trunk/; revision=20447
Diffstat (limited to 'tools/lemon')
-rw-r--r-- | tools/lemon/lemon.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/lemon/lemon.c b/tools/lemon/lemon.c index d8e0903161..249c9e6981 100644 --- a/tools/lemon/lemon.c +++ b/tools/lemon/lemon.c @@ -407,8 +407,6 @@ static int actioncmp(const void *ap1_arg, const void *ap2_arg) rc = ap1->sp->index - ap2->sp->index; if( rc==0 ) rc = (int)ap1->type - (int)ap2->type; if( rc==0 ){ - assert( ap1->type==REDUCE || ap1->type==RD_RESOLVED || ap1->type==CONFLICT); - assert( ap2->type==REDUCE || ap2->type==RD_RESOLVED || ap2->type==CONFLICT); rc = ap1->x.rp->index - ap2->x.rp->index; } return rc; @@ -1044,6 +1042,10 @@ static int resolve_conflict( struct symbol *spx, *spy; int errcnt = 0; assert( apx->sp==apy->sp ); /* Otherwise there would be no conflict */ + if( apx->type==SHIFT && apy->type==SHIFT ){ + apy->type = CONFLICT; + errcnt++; + } if( apx->type==SHIFT && apy->type==REDUCE ){ spx = apx->sp; spy = apy->x.rp->precsym; @@ -3245,10 +3247,8 @@ PRIVATE void translate_code(struct lemon *lemp, struct rule *rp){ for(i=0; i<rp->nrhs; i++) used[i] = 0; lhsused = 0; - if (! rp->code) rp->code = "\n"; - append_str(0,0,0,0); - for(cp=rp->code; *cp; cp++){ + for(cp=(rp->code?rp->code:""); *cp; cp++){ if( safe_isalpha(*cp) && (cp==rp->code || (!safe_isalnum(cp[-1]) && cp[-1]!='_')) ){ char saved; for(xp= &cp[1]; safe_isalnum(*xp) || *xp=='_'; xp++); @@ -3672,7 +3672,7 @@ void ReportTable( n = acttab_size(pActtab); for(i=j=0; i<n; i++){ int action = acttab_yyaction(pActtab, i); - if( action<0 ) action = lemp->nsymbol + lemp->nrule + 2; + if( action<0 ) action = lemp->nstate + lemp->nrule + 2; if( j==0 ) fprintf(out," /* %5d */ ", i); fprintf(out, " %4d,", action); if( j==9 || i==n-1 ){ |