/[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.125 by akim, Thu Dec 27 18:05:42 2001 UTC revision 1.126 by akim, Thu Dec 27 18:06:06 2001 UTC
# Line 40  typedef struct symbol_list Line 40  typedef struct symbol_list
40    struct symbol_list *next;    struct symbol_list *next;
41    bucket *sym;    bucket *sym;
42    int line;    int line;
43    
44    /* The action is attached to the LHS of a rule. */    /* The action is attached to the LHS of a rule. */
45    const char *action;    const char *action;
46    int action_line;    int action_line;
47    
48      /* The guard is attached to the LHS of a rule. */
49      const char *guard;
50      int guard_line;
51    bucket *ruleprec;    bucket *ruleprec;
52  } symbol_list;  } symbol_list;
53    
# Line 76  symbol_list_new (bucket *sym) Line 81  symbol_list_new (bucket *sym)
81    res->line = lineno;    res->line = lineno;
82    res->action = NULL;    res->action = NULL;
83    res->action_line = 0;    res->action_line = 0;
84      res->guard = NULL;
85      res->guard_line = 0;
86    res->ruleprec = NULL;    res->ruleprec = NULL;
87    return res;    return res;
88  }  }
# Line 1088  copy_action (symbol_list *rule, int stac Line 1095  copy_action (symbol_list *rule, int stac
1095    count = 1;    count = 1;
1096    c = getc (finput);    c = getc (finput);
1097    
1098      rule->action_line = lineno;
1099    
1100    while (count > 0)    while (count > 0)
1101      {      {
1102        while (c != '}')        while (c != '}')
# Line 1144  copy_action (symbol_list *rule, int stac Line 1153  copy_action (symbol_list *rule, int stac
1153    
1154    obstack_1grow (&action_obstack, '\0');    obstack_1grow (&action_obstack, '\0');
1155    rule->action = obstack_finish (&action_obstack);    rule->action = obstack_finish (&action_obstack);
   rule->action_line = lineno;  
1156  }  }
1157    
1158  /*-------------------------------------------------------------------.  /*-------------------------------------------------------------------.
# Line 1167  copy_guard (symbol_list *rule, int stack Line 1175  copy_guard (symbol_list *rule, int stack
1175    if (semantic_parser)    if (semantic_parser)
1176      stack_offset = 0;      stack_offset = 0;
1177    
1178    obstack_fgrow1 (&guard_obstack, "\ncase %d:\n", nrules);    rule->guard_line = lineno;
   if (!no_lines_flag)  
     obstack_fgrow2 (&guard_obstack, muscle_find ("linef"),  
                     lineno, quotearg_style (c_quoting_style,  
                                             muscle_find ("filename")));  
   obstack_1grow (&guard_obstack, '{');  
1179    
1180    count = 0;    count = 0;
1181    c = getc (finput);    c = getc (finput);
# Line 1231  copy_guard (symbol_list *rule, int stack Line 1234  copy_guard (symbol_list *rule, int stack
1234          c = getc (finput);          c = getc (finput);
1235      }      }
1236    
1237    c = skip_white_space ();    obstack_1grow (&guard_obstack, '\0');
1238      rule->guard = obstack_finish (&guard_obstack);
   obstack_sgrow (&guard_obstack, ";\n    break;}");  
   if (c == '{')  
     copy_action (rule, stack_offset);  
   else if (c == '=')  
     {  
       c = getc (finput);        /* why not skip_white_space -wjh */  
       if (c == '{')  
         copy_action (rule, stack_offset);  
     }  
   else  
     ungetc (c, finput);  
1239  }  }
1240    
1241    
# Line 1466  readgram (void) Line 1458  readgram (void)
1458              crule->ruleprec = symval;              crule->ruleprec = symval;
1459              t = lex ();              t = lex ();
1460            }            }
1461    
1462          if (t == tok_guard)          if (t == tok_guard)
1463            {            {
1464              if (!semantic_parser)              if (!semantic_parser)
# Line 1474  readgram (void) Line 1467  readgram (void)
1467              copy_guard (crule, rulelength);              copy_guard (crule, rulelength);
1468              t = lex ();              t = lex ();
1469            }            }
1470          else if (t == tok_left_curly)  
1471            if (t == tok_left_curly)
1472            {            {
1473              /* This case never occurs -wjh */              /* This case never occurs -wjh */
1474              if (action_flag)              if (action_flag)
# Line 1781  packgram (void) Line 1775  packgram (void)
1775        rule_table[ruleno].useful = TRUE;        rule_table[ruleno].useful = TRUE;
1776        rule_table[ruleno].action = p->action;        rule_table[ruleno].action = p->action;
1777        rule_table[ruleno].action_line = p->action_line;        rule_table[ruleno].action_line = p->action_line;
1778          rule_table[ruleno].guard = p->guard;
1779          rule_table[ruleno].guard_line = p->guard_line;
1780    
1781        p = p->next;        p = p->next;
1782        while (p && p->sym)        while (p && p->sym)

Legend:
Removed from v.1.125  
changed lines
  Added in v.1.126

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