* src/LR0.c (new_state): Display `nstates' as the name of the

newly created state.
Adjust to initialize first_state and last_state if needed.
Be sure to distinguish the initial from the final state.
(new_states): Create the itemset of the initial state, and use
new_state.
* src/closure.c (closure): Now that the initial state has its
items properly set, there is no need for a special case when
creating `ruleset'.
As a result, now the rule 0, reducing to $axiom, is visible in the
outputs.  Adjust the test suite.
* tests/conflicts.at (Solved SR Conflicts)
(Unresolved SR Conflicts): Adjust.
* tests/regression.at (Web2c Report, Rule Line Numbers): Idem.
* tests/conflicts.at (S/R in initial): New.
This commit is contained in:
Akim Demaille
2002-04-07 17:40:16 +00:00
parent b4c4ccc2b3
commit 643a599471
7 changed files with 81 additions and 23 deletions

View File

@@ -55,7 +55,7 @@ TESTSUITE_AT = \
TESTSUITE = $(srcdir)/testsuite
AUTOTEST = $(AUTOM4TE) --language=autotest
$(srcdir)/$(TESTSUITE): package.m4 $(TESTSUITE_AT)
$(TESTSUITE): package.m4 $(TESTSUITE_AT)
$(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp
mv $@.tmp $@

View File

@@ -1,5 +1,5 @@
# Exercising Bison on conflicts. -*- Autotest -*-
# Copyright 2002 Free Software Foundation, Inc.
# Copyright (C) 2002 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -19,6 +19,28 @@
AT_BANNER([[Conflicts.]])
## ---------------- ##
## S/R in initial. ##
## ---------------- ##
# I once hacked Bison in such a way that it lost its reductions on the
# initial state (because it was confusing it with the last state). It
# took me a while to strip down my failures to this simple case. So
# make sure it finds the s/r conflict below.
AT_SETUP([S/R in initial])
AT_DATA([[input.y]],
[[%expect 1
%%
exp: e 'e';
e: 'e' | /* Nothing. */;
]])
AT_CHECK([bison input.y -o input.c])
AT_CLEANUP
## ------------------- ##
## %nonassoc and eof. ##
## ------------------- ##
@@ -143,6 +165,8 @@ exp (6)
state 0
$axiom -> . exp $ (rule 0)
NUM shift, and go to state 1
exp go to state 2
@@ -247,6 +271,8 @@ exp (6)
state 0
$axiom -> . exp $ (rule 0)
NUM shift, and go to state 1
exp go to state 2

View File

@@ -139,6 +139,8 @@ expr (7)
state 0
$axiom -> . expr $ (rule 0)
'a' shift, and go to state 1
$default reduce using rule 3 (@2)
@@ -348,6 +350,7 @@ CONST_DEC (10)
@1 (11)
on left: 4, on right: 5
state 0
$axiom -> . CONST_DEC_PART $ (rule 0)
$default reduce using rule 4 (@1)
CONST_DEC_PART go to state 1
CONST_DEC_LIST go to state 2