/[bison]/bison/src/reader.c
ViewVC logotype

Diff of /bison/src/reader.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.134 by akim, Sat Dec 29 14:17:18 2001 UTC revision 1.135 by akim, Sat Dec 29 14:17:43 2001 UTC
# Line 1451  readgram (void) Line 1451  readgram (void)
1451          t = lex ();          t = lex ();
1452        }        }
1453    
1454      /* grammar has been read.  Do some checking */
1455    
1456      if (nrules == 0)
1457        fatal (_("no rules in the input grammar"));
1458    
1459      /* Report any undefined symbols and consider them nonterminals.  */
1460    
1461      for (bp = firstsymbol; bp; bp = bp->next)
1462        if (bp->class == unknown_sym)
1463          {
1464            complain (_
1465                      ("symbol %s is used, but is not defined as a token and has no rules"),
1466                      bp->tag);
1467            bp->class = nterm_sym;
1468            bp->value = nvars++;
1469          }
1470    
1471    /* Insert the initial rule, which line is that of the first rule    /* Insert the initial rule, which line is that of the first rule
1472       (not that of the start symbol):       (not that of the start symbol):
1473    
# Line 1466  readgram (void) Line 1483  readgram (void)
1483    grammar = p;    grammar = p;
1484    startval = axiom;    startval = axiom;
1485    
   /* grammar has been read.  Do some checking */  
   
1486    if (nsyms > MAXSHORT)    if (nsyms > MAXSHORT)
1487      fatal (_("too many symbols (tokens plus nonterminals); maximum %d"),      fatal (_("too many symbols (tokens plus nonterminals); maximum %d"),
1488             MAXSHORT);             MAXSHORT);
   if (nrules == 0)  
     fatal (_("no rules in the input grammar"));  
   
   /* Report any undefined symbols and consider them nonterminals.  */  
   
   for (bp = firstsymbol; bp; bp = bp->next)  
     if (bp->class == unknown_sym)  
       {  
         complain (_  
                   ("symbol %s is used, but is not defined as a token and has no rules"),  
                   bp->tag);  
         bp->class = nterm_sym;  
         bp->value = nvars++;  
       }  
1489    
1490    ntokens = nsyms - nvars;    ntokens = nsyms - nvars;
1491  }  }

Legend:
Removed from v.1.134  
changed lines
  Added in v.1.135

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26