mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
Display items as we display rules.
* src/gram.h, src/gram.c (rule_lhs_print): New. * src/gram.c (grammar_rules_partial_print): Use it. * src/print.c (print_core): Likewise. * tests/conflicts.at (Defaulted Conflicted Reduction), (Unresolved SR Conflicts): Adjust. (Unresolved SR Conflicts): Adjust and rename as... (Resolved SR Conflicts): this, as was meant. * tests/regression.at (Web2c Report): Adjust.
This commit is contained in:
13
ChangeLog
13
ChangeLog
@@ -1,3 +1,16 @@
|
|||||||
|
2002-06-30 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
Display items as we display rules.
|
||||||
|
|
||||||
|
* src/gram.h, src/gram.c (rule_lhs_print): New.
|
||||||
|
* src/gram.c (grammar_rules_partial_print): Use it.
|
||||||
|
* src/print.c (print_core): Likewise.
|
||||||
|
* tests/conflicts.at (Defaulted Conflicted Reduction),
|
||||||
|
(Unresolved SR Conflicts): Adjust.
|
||||||
|
(Unresolved SR Conflicts): Adjust and rename as...
|
||||||
|
(Resolved SR Conflicts): this, as was meant.
|
||||||
|
* tests/regression.at (Web2c Report): Adjust.
|
||||||
|
|
||||||
2002-06-30 Akim Demaille <akim@epita.fr>
|
2002-06-30 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* src/print.c (state_default_rule_compute): New, extracted from...
|
* src/print.c (state_default_rule_compute): New, extracted from...
|
||||||
|
|||||||
49
src/gram.c
49
src/gram.c
@@ -47,6 +47,30 @@ int glr_parser = 0;
|
|||||||
int pure_parser = 0;
|
int pure_parser = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------.
|
||||||
|
| Print this RULE's number and lhs on OUT. If a PREVIOUS_LHS was |
|
||||||
|
| already displayed (by a previous call for another rule), avoid |
|
||||||
|
| useless repetitions. |
|
||||||
|
`----------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void
|
||||||
|
rule_lhs_print (rule_t *rule, symbol_t *previous_lhs, FILE *out)
|
||||||
|
{
|
||||||
|
fprintf (out, " %3d ", rule->number - 1);
|
||||||
|
if (previous_lhs != rule->lhs)
|
||||||
|
{
|
||||||
|
fprintf (out, "%s:", symbol_tag_get (rule->lhs));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
for (n = strlen (symbol_tag_get (previous_lhs)); n > 0; --n)
|
||||||
|
fputc (' ', out);
|
||||||
|
fputc ('|', out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*--------------------------------------.
|
/*--------------------------------------.
|
||||||
| Return the number of symbols in RHS. |
|
| Return the number of symbols in RHS. |
|
||||||
`--------------------------------------*/
|
`--------------------------------------*/
|
||||||
@@ -139,39 +163,22 @@ ritem_longest_rhs (void)
|
|||||||
| (exclusive) on OUT under TITLE. |
|
| (exclusive) on OUT under TITLE. |
|
||||||
`----------------------------------------------------------------*/
|
`----------------------------------------------------------------*/
|
||||||
|
|
||||||
static inline void
|
|
||||||
blanks_print (unsigned n, FILE *out)
|
|
||||||
{
|
|
||||||
for (/* Nothing*/; n > 0; --n)
|
|
||||||
fputc (' ', out);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
grammar_rules_partial_print (FILE *out, const char *title,
|
grammar_rules_partial_print (FILE *out, const char *title,
|
||||||
rule_number_t begin, rule_number_t end)
|
rule_number_t begin, rule_number_t end)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
symbol_t *last_lhs = NULL;
|
symbol_t *previous_lhs = NULL;
|
||||||
|
|
||||||
/* rule # : LHS -> RHS */
|
/* rule # : LHS -> RHS */
|
||||||
fprintf (out, "%s\n\n", title);
|
fprintf (out, "%s\n\n", title);
|
||||||
for (r = begin; r < end; r++)
|
for (r = begin; r < end; r++)
|
||||||
{
|
{
|
||||||
if (last_lhs && last_lhs != rules[r].lhs)
|
if (previous_lhs && previous_lhs != rules[r].lhs)
|
||||||
fputc ('\n', out);
|
fputc ('\n', out);
|
||||||
|
rule_lhs_print (&rules[r], previous_lhs, out);
|
||||||
fprintf (out, " %3d ", r - 1);
|
|
||||||
if (last_lhs != rules[r].lhs)
|
|
||||||
{
|
|
||||||
last_lhs = rules[r].lhs;
|
|
||||||
fprintf (out, "%s:", symbol_tag_get (last_lhs));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
blanks_print (strlen (symbol_tag_get (last_lhs)), out);
|
|
||||||
fputc ('|', out);
|
|
||||||
}
|
|
||||||
rule_rhs_print (&rules[r], out);
|
rule_rhs_print (&rules[r], out);
|
||||||
|
previous_lhs = rules[r].lhs;
|
||||||
}
|
}
|
||||||
fputs ("\n\n", out);
|
fputs ("\n\n", out);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,6 +193,11 @@ extern int glr_parser;
|
|||||||
|
|
||||||
extern int pure_parser;
|
extern int pure_parser;
|
||||||
|
|
||||||
|
/* Print this RULE's number and lhs on OUT. If a PREVIOUS_LHS was
|
||||||
|
already displayed (by a previous call for another rule), avoid
|
||||||
|
useless repetitions. */
|
||||||
|
void rule_lhs_print PARAMS ((rule_t *rule, symbol_t *previous_lhs, FILE *out));
|
||||||
|
|
||||||
/* Return the length of the RHS. */
|
/* Return the length of the RHS. */
|
||||||
int rule_rhs_length PARAMS ((rule_t *rule));
|
int rule_rhs_length PARAMS ((rule_t *rule));
|
||||||
|
|
||||||
|
|||||||
48
src/print.c
48
src/print.c
@@ -58,6 +58,7 @@ print_core (FILE *out, state_t *state)
|
|||||||
int i;
|
int i;
|
||||||
item_number_t *sitems = state->items;
|
item_number_t *sitems = state->items;
|
||||||
int snritems = state->nitems;
|
int snritems = state->nitems;
|
||||||
|
symbol_t *previous_lhs = NULL;
|
||||||
|
|
||||||
/* Output all the items of a state, not only its kernel. */
|
/* Output all the items of a state, not only its kernel. */
|
||||||
if (report_flag & report_itemsets)
|
if (report_flag & report_itemsets)
|
||||||
@@ -67,40 +68,39 @@ print_core (FILE *out, state_t *state)
|
|||||||
snritems = nritemset;
|
snritems = nritemset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (snritems)
|
if (!snritems)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0; i < snritems; i++)
|
||||||
{
|
{
|
||||||
for (i = 0; i < snritems; i++)
|
item_number_t *sp;
|
||||||
{
|
item_number_t *sp1;
|
||||||
item_number_t *sp;
|
int rule;
|
||||||
item_number_t *sp1;
|
|
||||||
int rule;
|
|
||||||
|
|
||||||
sp1 = sp = ritem + sitems[i];
|
sp1 = sp = ritem + sitems[i];
|
||||||
|
|
||||||
while (*sp >= 0)
|
while (*sp >= 0)
|
||||||
sp++;
|
sp++;
|
||||||
|
|
||||||
rule = -(*sp);
|
rule = -(*sp);
|
||||||
fprintf (out, " %s -> ", symbol_tag_get (rules[rule].lhs));
|
|
||||||
|
|
||||||
for (sp = rules[rule].rhs; sp < sp1; sp++)
|
rule_lhs_print (&rules[rule], previous_lhs, out);
|
||||||
fprintf (out, "%s ", symbol_tag_get (symbols[*sp]));
|
previous_lhs = rules[rule].lhs;
|
||||||
|
|
||||||
fputc ('.', out);
|
for (sp = rules[rule].rhs; sp < sp1; sp++)
|
||||||
|
fprintf (out, " %s", symbol_tag_get (symbols[*sp]));
|
||||||
|
fputs (" .", out);
|
||||||
|
for (/* Nothing */; *sp >= 0; ++sp)
|
||||||
|
fprintf (out, " %s", symbol_tag_get (symbols[*sp]));
|
||||||
|
|
||||||
for (/* Nothing */; *sp >= 0; ++sp)
|
/* Display the lookaheads? */
|
||||||
fprintf (out, " %s", symbol_tag_get (symbols[*sp]));
|
if (report_flag & report_lookaheads)
|
||||||
|
state_rule_lookaheads_print (state, &rules[rule], out);
|
||||||
/* Display the lookaheads? */
|
|
||||||
if (report_flag & report_lookaheads)
|
|
||||||
state_rule_lookaheads_print (state, &rules[rule], out);
|
|
||||||
|
|
||||||
fprintf (out, _(" (rule %d)"), rule - 1);
|
|
||||||
fputc ('\n', out);
|
|
||||||
}
|
|
||||||
|
|
||||||
fputc ('\n', out);
|
fputc ('\n', out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fputc ('\n', out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -174,9 +174,9 @@ exp (6)
|
|||||||
|
|
||||||
state 0
|
state 0
|
||||||
|
|
||||||
$axiom -> . exp $ (rule 0)
|
0 $axiom: . exp $
|
||||||
exp -> . exp OP exp (rule 1)
|
1 exp: . exp OP exp
|
||||||
exp -> . NUM (rule 2)
|
2 | . NUM
|
||||||
|
|
||||||
NUM shift, and go to state 1
|
NUM shift, and go to state 1
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ state 0
|
|||||||
|
|
||||||
state 1
|
state 1
|
||||||
|
|
||||||
exp -> NUM . (rule 2)
|
2 exp: NUM .
|
||||||
|
|
||||||
$default reduce using rule 2 (exp)
|
$default reduce using rule 2 (exp)
|
||||||
|
|
||||||
@@ -194,8 +194,8 @@ state 1
|
|||||||
|
|
||||||
state 2
|
state 2
|
||||||
|
|
||||||
$axiom -> exp . $ (rule 0)
|
0 $axiom: exp . $
|
||||||
exp -> exp . OP exp (rule 1)
|
1 exp: exp . OP exp
|
||||||
|
|
||||||
$ shift, and go to state 3
|
$ shift, and go to state 3
|
||||||
OP shift, and go to state 4
|
OP shift, and go to state 4
|
||||||
@@ -204,16 +204,16 @@ state 2
|
|||||||
|
|
||||||
state 3
|
state 3
|
||||||
|
|
||||||
$axiom -> exp $ . (rule 0)
|
0 $axiom: exp $ .
|
||||||
|
|
||||||
$default accept
|
$default accept
|
||||||
|
|
||||||
|
|
||||||
state 4
|
state 4
|
||||||
|
|
||||||
exp -> . exp OP exp (rule 1)
|
1 exp: . exp OP exp
|
||||||
exp -> exp OP . exp (rule 1)
|
1 | exp OP . exp
|
||||||
exp -> . NUM (rule 2)
|
2 | . NUM
|
||||||
|
|
||||||
NUM shift, and go to state 1
|
NUM shift, and go to state 1
|
||||||
|
|
||||||
@@ -223,8 +223,8 @@ state 4
|
|||||||
|
|
||||||
state 5
|
state 5
|
||||||
|
|
||||||
exp -> exp . OP exp [$, OP] (rule 1)
|
1 exp: exp . OP exp [$, OP]
|
||||||
exp -> exp OP exp . [$, OP] (rule 1)
|
1 | exp OP exp . [$, OP]
|
||||||
|
|
||||||
OP shift, and go to state 4
|
OP shift, and go to state 4
|
||||||
|
|
||||||
@@ -238,30 +238,27 @@ state 5
|
|||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
## ------------------------- ##
|
|
||||||
## Unresolved SR Conflicts. ##
|
|
||||||
## ------------------------- ##
|
|
||||||
|
|
||||||
AT_SETUP([Unresolved SR Conflicts])
|
## ----------------------- ##
|
||||||
|
## Resolved SR Conflicts. ##
|
||||||
|
## ----------------------- ##
|
||||||
|
|
||||||
|
AT_SETUP([Resolved SR Conflicts])
|
||||||
|
|
||||||
AT_KEYWORDS([report])
|
AT_KEYWORDS([report])
|
||||||
|
|
||||||
AT_DATA([input.y],
|
AT_DATA([input.y],
|
||||||
[[%token NUM OP
|
[[%token NUM OP
|
||||||
|
%left OP
|
||||||
%%
|
%%
|
||||||
exp: exp OP exp | NUM;
|
exp: exp OP exp | NUM;
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CHECK([bison input.y -o input.c --report=all], 0, [],
|
AT_CHECK([bison input.y -o input.c --report=all])
|
||||||
[input.y contains 1 shift/reduce conflict.
|
|
||||||
])
|
|
||||||
|
|
||||||
# Check the contents of the report.
|
# Check the contents of the report.
|
||||||
AT_CHECK([cat input.output], [],
|
AT_CHECK([cat input.output], [],
|
||||||
[[State 5 contains 1 shift/reduce conflict.
|
[[Grammar
|
||||||
|
|
||||||
|
|
||||||
Grammar
|
|
||||||
|
|
||||||
0 $axiom: exp $
|
0 $axiom: exp $
|
||||||
|
|
||||||
@@ -287,9 +284,9 @@ exp (6)
|
|||||||
|
|
||||||
state 0
|
state 0
|
||||||
|
|
||||||
$axiom -> . exp $ (rule 0)
|
0 $axiom: . exp $
|
||||||
exp -> . exp OP exp (rule 1)
|
1 exp: . exp OP exp
|
||||||
exp -> . NUM (rule 2)
|
2 | . NUM
|
||||||
|
|
||||||
NUM shift, and go to state 1
|
NUM shift, and go to state 1
|
||||||
|
|
||||||
@@ -299,7 +296,7 @@ state 0
|
|||||||
|
|
||||||
state 1
|
state 1
|
||||||
|
|
||||||
exp -> NUM . (rule 2)
|
2 exp: NUM .
|
||||||
|
|
||||||
$default reduce using rule 2 (exp)
|
$default reduce using rule 2 (exp)
|
||||||
|
|
||||||
@@ -307,8 +304,8 @@ state 1
|
|||||||
|
|
||||||
state 2
|
state 2
|
||||||
|
|
||||||
$axiom -> exp . $ (rule 0)
|
0 $axiom: exp . $
|
||||||
exp -> exp . OP exp (rule 1)
|
1 exp: exp . OP exp
|
||||||
|
|
||||||
$ shift, and go to state 3
|
$ shift, and go to state 3
|
||||||
OP shift, and go to state 4
|
OP shift, and go to state 4
|
||||||
@@ -317,16 +314,16 @@ state 2
|
|||||||
|
|
||||||
state 3
|
state 3
|
||||||
|
|
||||||
$axiom -> exp $ . (rule 0)
|
0 $axiom: exp $ .
|
||||||
|
|
||||||
$default accept
|
$default accept
|
||||||
|
|
||||||
|
|
||||||
state 4
|
state 4
|
||||||
|
|
||||||
exp -> . exp OP exp (rule 1)
|
1 exp: . exp OP exp
|
||||||
exp -> exp OP . exp (rule 1)
|
1 | exp OP . exp
|
||||||
exp -> . NUM (rule 2)
|
2 | . NUM
|
||||||
|
|
||||||
NUM shift, and go to state 1
|
NUM shift, and go to state 1
|
||||||
|
|
||||||
@@ -336,14 +333,13 @@ state 4
|
|||||||
|
|
||||||
state 5
|
state 5
|
||||||
|
|
||||||
exp -> exp . OP exp [$, OP] (rule 1)
|
1 exp: exp . OP exp [$, OP]
|
||||||
exp -> exp OP exp . [$, OP] (rule 1)
|
1 | exp OP exp . [$, OP]
|
||||||
|
|
||||||
OP shift, and go to state 4
|
|
||||||
|
|
||||||
OP [reduce using rule 1 (exp)]
|
|
||||||
$default reduce using rule 1 (exp)
|
$default reduce using rule 1 (exp)
|
||||||
|
|
||||||
|
Conflict between rule 2 and token OP resolved as shift (%left OP).
|
||||||
|
|
||||||
|
|
||||||
]])
|
]])
|
||||||
@@ -351,7 +347,6 @@ state 5
|
|||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## -------------------------------- ##
|
## -------------------------------- ##
|
||||||
## Defaulted Conflicted Reduction. ##
|
## Defaulted Conflicted Reduction. ##
|
||||||
## -------------------------------- ##
|
## -------------------------------- ##
|
||||||
@@ -430,11 +425,11 @@ id (7)
|
|||||||
|
|
||||||
state 0
|
state 0
|
||||||
|
|
||||||
$axiom -> . exp $ (rule 0)
|
0 $axiom: . exp $
|
||||||
exp -> . num (rule 1)
|
1 exp: . num
|
||||||
exp -> . id (rule 2)
|
2 | . id
|
||||||
num -> . '0' (rule 3)
|
3 num: . '0'
|
||||||
id -> . '0' (rule 4)
|
4 id: . '0'
|
||||||
|
|
||||||
'0' shift, and go to state 1
|
'0' shift, and go to state 1
|
||||||
|
|
||||||
@@ -446,8 +441,8 @@ state 0
|
|||||||
|
|
||||||
state 1
|
state 1
|
||||||
|
|
||||||
num -> '0' . [$] (rule 3)
|
3 num: '0' . [$]
|
||||||
id -> '0' . [$] (rule 4)
|
4 id: '0' . [$]
|
||||||
|
|
||||||
$ reduce using rule 3 (num)
|
$ reduce using rule 3 (num)
|
||||||
$ [reduce using rule 4 (id)]
|
$ [reduce using rule 4 (id)]
|
||||||
@@ -457,7 +452,7 @@ state 1
|
|||||||
|
|
||||||
state 2
|
state 2
|
||||||
|
|
||||||
$axiom -> exp . $ (rule 0)
|
0 $axiom: exp . $
|
||||||
|
|
||||||
$ shift, and go to state 5
|
$ shift, and go to state 5
|
||||||
|
|
||||||
@@ -465,7 +460,7 @@ state 2
|
|||||||
|
|
||||||
state 3
|
state 3
|
||||||
|
|
||||||
exp -> num . (rule 1)
|
1 exp: num .
|
||||||
|
|
||||||
$default reduce using rule 1 (exp)
|
$default reduce using rule 1 (exp)
|
||||||
|
|
||||||
@@ -473,7 +468,7 @@ state 3
|
|||||||
|
|
||||||
state 4
|
state 4
|
||||||
|
|
||||||
exp -> id . (rule 2)
|
2 exp: id .
|
||||||
|
|
||||||
$default reduce using rule 2 (exp)
|
$default reduce using rule 2 (exp)
|
||||||
|
|
||||||
@@ -481,7 +476,7 @@ state 4
|
|||||||
|
|
||||||
state 5
|
state 5
|
||||||
|
|
||||||
$axiom -> exp $ . (rule 0)
|
0 $axiom: exp $ .
|
||||||
|
|
||||||
$default accept
|
$default accept
|
||||||
|
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ expr (7)
|
|||||||
|
|
||||||
state 0
|
state 0
|
||||||
|
|
||||||
$axiom -> . expr $ (rule 0)
|
0 $axiom: . expr $
|
||||||
|
|
||||||
'a' shift, and go to state 1
|
'a' shift, and go to state 1
|
||||||
|
|
||||||
@@ -197,7 +197,7 @@ state 0
|
|||||||
|
|
||||||
state 1
|
state 1
|
||||||
|
|
||||||
expr -> 'a' . @1 'b' (rule 2)
|
2 expr: 'a' . @1 'b'
|
||||||
|
|
||||||
$default reduce using rule 1 (@1)
|
$default reduce using rule 1 (@1)
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ state 1
|
|||||||
|
|
||||||
state 2
|
state 2
|
||||||
|
|
||||||
$axiom -> expr . $ (rule 0)
|
0 $axiom: expr . $
|
||||||
|
|
||||||
$ shift, and go to state 5
|
$ shift, and go to state 5
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ state 2
|
|||||||
|
|
||||||
state 3
|
state 3
|
||||||
|
|
||||||
expr -> @2 . 'c' (rule 4)
|
4 expr: @2 . 'c'
|
||||||
|
|
||||||
'c' shift, and go to state 6
|
'c' shift, and go to state 6
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ state 3
|
|||||||
|
|
||||||
state 4
|
state 4
|
||||||
|
|
||||||
expr -> 'a' @1 . 'b' (rule 2)
|
2 expr: 'a' @1 . 'b'
|
||||||
|
|
||||||
'b' shift, and go to state 7
|
'b' shift, and go to state 7
|
||||||
|
|
||||||
@@ -231,14 +231,14 @@ state 4
|
|||||||
|
|
||||||
state 5
|
state 5
|
||||||
|
|
||||||
$axiom -> expr $ . (rule 0)
|
0 $axiom: expr $ .
|
||||||
|
|
||||||
$default accept
|
$default accept
|
||||||
|
|
||||||
|
|
||||||
state 6
|
state 6
|
||||||
|
|
||||||
expr -> @2 'c' . (rule 4)
|
4 expr: @2 'c' .
|
||||||
|
|
||||||
$default reduce using rule 4 (expr)
|
$default reduce using rule 4 (expr)
|
||||||
|
|
||||||
@@ -246,7 +246,7 @@ state 6
|
|||||||
|
|
||||||
state 7
|
state 7
|
||||||
|
|
||||||
expr -> 'a' @1 'b' . (rule 2)
|
2 expr: 'a' @1 'b' .
|
||||||
|
|
||||||
$default reduce using rule 2 (expr)
|
$default reduce using rule 2 (expr)
|
||||||
|
|
||||||
@@ -375,12 +375,11 @@ CONST_DEC:
|
|||||||
{ } undef_id_tok '=' const_id_tok ';'
|
{ } undef_id_tok '=' const_id_tok ';'
|
||||||
;
|
;
|
||||||
%%
|
%%
|
||||||
|
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CHECK([bison -v input.y])
|
AT_CHECK([bison -v input.y])
|
||||||
|
sed -n 's/ *$//;/^$/!p' input.output >input.report
|
||||||
AT_CHECK([sed -n 's/ *$//;/^$/!p' input.output], 0,
|
AT_CHECK([cat input.report], 0,
|
||||||
[[Grammar
|
[[Grammar
|
||||||
0 $axiom: CONST_DEC_PART $
|
0 $axiom: CONST_DEC_PART $
|
||||||
1 CONST_DEC_PART: CONST_DEC_LIST
|
1 CONST_DEC_PART: CONST_DEC_LIST
|
||||||
@@ -407,45 +406,45 @@ CONST_DEC (10)
|
|||||||
@1 (11)
|
@1 (11)
|
||||||
on left: 4, on right: 5
|
on left: 4, on right: 5
|
||||||
state 0
|
state 0
|
||||||
$axiom -> . CONST_DEC_PART $ (rule 0)
|
0 $axiom: . CONST_DEC_PART $
|
||||||
$default reduce using rule 4 (@1)
|
$default reduce using rule 4 (@1)
|
||||||
CONST_DEC_PART go to state 1
|
CONST_DEC_PART go to state 1
|
||||||
CONST_DEC_LIST go to state 2
|
CONST_DEC_LIST go to state 2
|
||||||
CONST_DEC go to state 3
|
CONST_DEC go to state 3
|
||||||
@1 go to state 4
|
@1 go to state 4
|
||||||
state 1
|
state 1
|
||||||
$axiom -> CONST_DEC_PART . $ (rule 0)
|
0 $axiom: CONST_DEC_PART . $
|
||||||
$ shift, and go to state 5
|
$ shift, and go to state 5
|
||||||
state 2
|
state 2
|
||||||
CONST_DEC_PART -> CONST_DEC_LIST . (rule 1)
|
1 CONST_DEC_PART: CONST_DEC_LIST .
|
||||||
CONST_DEC_LIST -> CONST_DEC_LIST . CONST_DEC (rule 3)
|
3 CONST_DEC_LIST: CONST_DEC_LIST . CONST_DEC
|
||||||
undef_id_tok reduce using rule 4 (@1)
|
undef_id_tok reduce using rule 4 (@1)
|
||||||
$default reduce using rule 1 (CONST_DEC_PART)
|
$default reduce using rule 1 (CONST_DEC_PART)
|
||||||
CONST_DEC go to state 6
|
CONST_DEC go to state 6
|
||||||
@1 go to state 4
|
@1 go to state 4
|
||||||
state 3
|
state 3
|
||||||
CONST_DEC_LIST -> CONST_DEC . (rule 2)
|
2 CONST_DEC_LIST: CONST_DEC .
|
||||||
$default reduce using rule 2 (CONST_DEC_LIST)
|
$default reduce using rule 2 (CONST_DEC_LIST)
|
||||||
state 4
|
state 4
|
||||||
CONST_DEC -> @1 . undef_id_tok '=' const_id_tok ';' (rule 5)
|
5 CONST_DEC: @1 . undef_id_tok '=' const_id_tok ';'
|
||||||
undef_id_tok shift, and go to state 7
|
undef_id_tok shift, and go to state 7
|
||||||
state 5
|
state 5
|
||||||
$axiom -> CONST_DEC_PART $ . (rule 0)
|
0 $axiom: CONST_DEC_PART $ .
|
||||||
$default accept
|
$default accept
|
||||||
state 6
|
state 6
|
||||||
CONST_DEC_LIST -> CONST_DEC_LIST CONST_DEC . (rule 3)
|
3 CONST_DEC_LIST: CONST_DEC_LIST CONST_DEC .
|
||||||
$default reduce using rule 3 (CONST_DEC_LIST)
|
$default reduce using rule 3 (CONST_DEC_LIST)
|
||||||
state 7
|
state 7
|
||||||
CONST_DEC -> @1 undef_id_tok . '=' const_id_tok ';' (rule 5)
|
5 CONST_DEC: @1 undef_id_tok . '=' const_id_tok ';'
|
||||||
'=' shift, and go to state 8
|
'=' shift, and go to state 8
|
||||||
state 8
|
state 8
|
||||||
CONST_DEC -> @1 undef_id_tok '=' . const_id_tok ';' (rule 5)
|
5 CONST_DEC: @1 undef_id_tok '=' . const_id_tok ';'
|
||||||
const_id_tok shift, and go to state 9
|
const_id_tok shift, and go to state 9
|
||||||
state 9
|
state 9
|
||||||
CONST_DEC -> @1 undef_id_tok '=' const_id_tok . ';' (rule 5)
|
5 CONST_DEC: @1 undef_id_tok '=' const_id_tok . ';'
|
||||||
';' shift, and go to state 10
|
';' shift, and go to state 10
|
||||||
state 10
|
state 10
|
||||||
CONST_DEC -> @1 undef_id_tok '=' const_id_tok ';' . (rule 5)
|
5 CONST_DEC: @1 undef_id_tok '=' const_id_tok ';' .
|
||||||
$default reduce using rule 5 (CONST_DEC)
|
$default reduce using rule 5 (CONST_DEC)
|
||||||
]])
|
]])
|
||||||
|
|
||||||
@@ -491,7 +490,9 @@ AT_CHECK([bison -v input.y -o input.c])
|
|||||||
|
|
||||||
# Check only the tables. We don't use --no-parser, because it is
|
# Check only the tables. We don't use --no-parser, because it is
|
||||||
# still to be implemented in the experimental branch of Bison.
|
# still to be implemented in the experimental branch of Bison.
|
||||||
AT_CHECK([[sed -n 's/ *$//;/^static const.*\[\] =/,/^}/p' input.c]], 0,
|
[sed -n 's/ *$//;/^static const.*\[\] =/,/^}/p' input.c >tables.c]
|
||||||
|
|
||||||
|
AT_CHECK([[cat tables.c]], 0,
|
||||||
[[static const unsigned char yytranslate[] =
|
[[static const unsigned char yytranslate[] =
|
||||||
{
|
{
|
||||||
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||||
|
|||||||
Reference in New Issue
Block a user