mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 00:33:03 +00:00
Copy BYacc's nice way to report the grammar.
* src/gram.h, src/gram.c (grammar_rhs_print, grammar_rules_print): New. Don't print the rules' location, it is confusing and useless. (rule_print): Use grammar_rhs_print. * src/print.c (print_grammar): Use grammar_rules_print.
This commit is contained in:
@@ -130,6 +130,8 @@ AT_CLEANUP
|
||||
|
||||
AT_SETUP([Unresolved SR Conflicts])
|
||||
|
||||
AT_KEYWORDS([report])
|
||||
|
||||
AT_DATA([input.y],
|
||||
[[%token NUM OP
|
||||
%%
|
||||
@@ -147,10 +149,10 @@ AT_CHECK([cat input.output], [],
|
||||
|
||||
Grammar
|
||||
|
||||
Number, Line, Rule
|
||||
0 3 $axiom -> exp $
|
||||
1 3 exp -> exp OP exp
|
||||
2 3 exp -> NUM
|
||||
0 $axiom: exp $
|
||||
|
||||
1 exp: exp OP exp
|
||||
2 | NUM
|
||||
|
||||
|
||||
Terminals, with rules where they appear
|
||||
@@ -241,6 +243,8 @@ AT_CLEANUP
|
||||
|
||||
AT_SETUP([Solved SR Conflicts])
|
||||
|
||||
AT_KEYWORDS([report])
|
||||
|
||||
AT_DATA([input.y],
|
||||
[[%token NUM OP
|
||||
%right OP
|
||||
@@ -254,10 +258,10 @@ AT_CHECK([bison input.y -o input.c --report=all], 0, [], [])
|
||||
AT_CHECK([cat input.output], [],
|
||||
[[Grammar
|
||||
|
||||
Number, Line, Rule
|
||||
0 4 $axiom -> exp $
|
||||
1 4 exp -> exp OP exp
|
||||
2 4 exp -> NUM
|
||||
0 $axiom: exp $
|
||||
|
||||
1 exp: exp OP exp
|
||||
2 | NUM
|
||||
|
||||
|
||||
Terminals, with rules where they appear
|
||||
|
||||
Reference in New Issue
Block a user