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

Diff of /bison/src/gram.c

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

revision 1.19 by akim, Sat Dec 29 14:20:13 2001 UTC revision 1.20 by akim, Sun Apr 7 17:36:38 2002 UTC
# Line 1  Line 1 
1  /* Allocate input grammar variables for bison,  /* Allocate input grammar variables for bison,
2     Copyright 1984, 1986, 1989, 2001 Free Software Foundation, Inc.     Copyright 1984, 1986, 1989, 2001, 2002 Free Software Foundation, Inc.
3    
4     This file is part of Bison, the GNU Compiler Compiler.     This file is part of Bison, the GNU Compiler Compiler.
5    
# Line 51  int pure_parser; Line 51  int pure_parser;
51  int error_token_number;  int error_token_number;
52    
53    
54    /*--------------------------------------.
55    | Return the number of symbols in RHS.  |
56    `--------------------------------------*/
57    
58    int
59    rule_rhs_length (rule_t *rule)
60    {
61      int res = 0;
62      short *rhsp;
63      for (rhsp = rule->rhs; *rhsp >= 0; ++rhsp)
64        ++res;
65      return res;
66    }
67    
68    
69  /*------------------------.  /*------------------------.
70  | Dump RITEM for traces.  |  | Dump RITEM for traces.  |
71  `------------------------*/  `------------------------*/
# Line 76  ritem_print (FILE *out) Line 91  ritem_print (FILE *out)
91  size_t  size_t
92  ritem_longest_rhs (void)  ritem_longest_rhs (void)
93  {  {
94    int length;    int max = 0;
   int max;  
95    int i;    int i;
96    
97    length = 0;    for (i = 1; i < nrules + 1; ++i)
98    max = 0;      {
99    for (i = 0; i < nritems; ++i)        int length = rule_rhs_length (&rules[i]);
100      if (ritem[i] >= 0)        if (length > max)
101        {          max = length;
102          length++;      }
       }  
     else  
       {  
         if (length > max)  
           max = length;  
         length = 0;  
       }  
103    
104    return max;    return max;
105  }  }

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

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