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

Diff of /bison/src/print_graph.c

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

revision 1.36 by akim, Sun May 26 18:39:04 2002 UTC revision 1.37 by akim, Sat Jun 15 18:23:12 2002 UTC
# Line 38  Line 38 
38  static graph_t graph;  static graph_t graph;
39  static FILE *fgraph = NULL;  static FILE *fgraph = NULL;
40    
 static inline const char *  
 escape (const char *s)  
 {  
   return quotearg_n_style (1, escape_quoting_style, s);  
 }  
41    
42    /*----------------------------.
43    | Construct the node labels.  |
44    `----------------------------*/
45    
 /* This part will construct the label of nodes. */  
46  static void  static void
47  print_core (struct obstack *oout, state_t *state)  print_core (struct obstack *oout, state_t *state)
48  {  {
# Line 78  print_core (struct obstack *oout, state_ Line 75  print_core (struct obstack *oout, state_
75        if (i)        if (i)
76          obstack_1grow (oout, '\n');          obstack_1grow (oout, '\n');
77        obstack_fgrow1 (oout, " %s -> ",        obstack_fgrow1 (oout, " %s -> ",
78                        escape (rules[rule].lhs->tag));                        symbol_tag_get (rules[rule].lhs));
79    
80        for (sp = rules[rule].rhs; sp < sp1; sp++)        for (sp = rules[rule].rhs; sp < sp1; sp++)
81          obstack_fgrow1 (oout, "%s ", escape (symbols[*sp]->tag));          obstack_fgrow1 (oout, "%s ", symbol_tag_get (symbols[*sp]));
82    
83        obstack_1grow (oout, '.');        obstack_1grow (oout, '.');
84    
85        for (/* Nothing */; *sp >= 0; ++sp)        for (/* Nothing */; *sp >= 0; ++sp)
86          obstack_fgrow1 (oout, " %s", escape (symbols[*sp]->tag));          obstack_fgrow1 (oout, " %s", symbol_tag_get (symbols[*sp]));
87    
88        /* Experimental feature: display the lookaheads. */        /* Experimental feature: display the lookaheads. */
89        if (trace_flag && state->nlookaheads)        if (trace_flag && state->nlookaheads)
# Line 107  print_core (struct obstack *oout, state_ Line 104  print_core (struct obstack *oout, state_
104                    if (bitset_test (LA[state->lookaheadsp + j], k)                    if (bitset_test (LA[state->lookaheadsp + j], k)
105                        && LArule[state->lookaheadsp + j]->number == rule)                        && LArule[state->lookaheadsp + j]->number == rule)
106                      obstack_fgrow2 (oout, "%s%s",                      obstack_fgrow2 (oout, "%s%s",
107                                      quotearg_style (escape_quoting_style,                                      symbol_tag_get (symbols[k]),
                                                     symbols[k]->tag),  
108                                      --nlookaheads ? ", " : "");                                      --nlookaheads ? ", " : "");
109                obstack_sgrow (oout, "]");                obstack_sgrow (oout, "]");
110              }              }
# Line 156  print_actions (state_t *state, const cha Line 152  print_actions (state_t *state, const cha
152            edge.color = red;            edge.color = red;
153          else          else
154            edge.color = SHIFT_IS_SHIFT(shiftp, i) ? blue : green;            edge.color = SHIFT_IS_SHIFT(shiftp, i) ? blue : green;
155          edge.label = escape (symbols[symbol]->tag);          edge.label = symbol_tag_get (symbols[symbol]);
156          output_edge (&edge, fgraph);          output_edge (&edge, fgraph);
157          close_edge (fgraph);          close_edge (fgraph);
158        }        }

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.37

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