summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkim Demaille <akim@epita.fr>2002-03-04 14:57:46 +0000
committerAkim Demaille <akim@epita.fr>2002-03-04 14:57:46 +0000
commitbae3c8d20938d93fa4442c36e219b4bba5f6dec9 (patch)
tree0a49c75aea39074d083cbbc1918d8b30096fd299
parent6f8dd2075e2b58e024cb08a85b09402858e42dd6 (diff)
downloadbison-bae3c8d20938d93fa4442c36e219b4bba5f6dec9.tar.gz
* tests/sets.at (Broken Closure): Add the ending `;'.
* tests/input.at (Invalid $n, Invalid @n): Likewise. * tests/output.at (AT_CHECK_OUTPUT): Likewise. * src/reader.at (readgram): Complain if a rule is not ended with a semi-colon.
-rw-r--r--ChangeLog8
-rw-r--r--NEWS9
-rw-r--r--src/reader.c9
-rw-r--r--tests/input.at4
-rw-r--r--tests/output.at2
-rw-r--r--tests/regression.at4
-rw-r--r--tests/sets.at16
7 files changed, 36 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 0ab08595..506b80de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2002-03-04 Akim Demaille <akim@epita.fr>
+
+ * tests/sets.at (Broken Closure): Add the ending `;'.
+ * tests/input.at (Invalid $n, Invalid @n): Likewise.
+ * tests/output.at (AT_CHECK_OUTPUT): Likewise.
+ * src/reader.at (readgram): Complain if a rule is not ended with a
+ semi-colon.
+
2002-02-28 Akim Demaille <akim@epita.fr>
* tests/Makefile.am (check_SCRIPTS): New.
diff --git a/NEWS b/NEWS
index 09f35fec..a30792b1 100644
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,14 @@
Bison News
----------
-Changes in version 1.33a:
+Changes in version 1.33b:
+
+* A missing `;' ending a rule triggers a warning
+ In accordance with POSIX, and in agreement with other
+ Yacc implementations, Bison will mandate this semicolon in a near
+ future. This eases the implementation of a Bison parser of Bison
+ grammars by making this grammar LALR(1) instead of LR(2). To
+ facilitate the transition, this release introduces a warning.
* Revert the C++ namespace changes introduced in 1.31, as they caused too
many portability hassles.
diff --git a/src/reader.c b/src/reader.c
index 529cebe9..ad9469e7 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -1440,7 +1440,10 @@ readgram (void)
unlex (t1);
symval = ssave;
if (t1 == tok_colon)
- break;
+ {
+ complain (_("previous rule lacks an ending `;'"));
+ break;
+ }
if (!first_rhs) /* JF */
first_rhs = symval;
@@ -1549,6 +1552,8 @@ readgram (void)
/* Warn if there is no default for $$ but we need one. */
else if (!xactions && !first_rhs && lhs->type_name != 0)
complain (_("empty rule for typed nonterminal, and no action"));
+ if (t == tok_two_percents || t == tok_eof)
+ complain (_("previous rule lacks an ending `;'"));
if (t == tok_semicolon)
t = lex ();
}
@@ -1585,7 +1590,7 @@ readgram (void)
}
else if (t == tok_start)
{
- parse_start_decl ();
+ parse_start_decl (;)
t = lex ();
}
#endif
diff --git a/tests/input.at b/tests/input.at
index 117af986..199d05df 100644
--- a/tests/input.at
+++ b/tests/input.at
@@ -29,7 +29,7 @@ AT_SETUP([Invalid $n])
AT_DATA([input.y],
[[%%
-exp: { $$ = $1 ; }
+exp: { $$ = $1 ; };
]])
AT_CHECK([bison input.y], [1], [],
@@ -48,7 +48,7 @@ AT_SETUP([Invalid @n])
AT_DATA([input.y],
[[%%
-exp: { @$ = @1 ; }
+exp: { @$ = @1 ; };
]])
AT_CHECK([bison input.y], [1], [],
diff --git a/tests/output.at b/tests/output.at
index 4332372d..147e8b28 100644
--- a/tests/output.at
+++ b/tests/output.at
@@ -26,7 +26,7 @@ m4_define([AT_CHECK_OUTPUT],
AT_DATA([$1],
[[$2
%%
-foo: {}
+foo: {};
]])
AT_CHECK([bison $3 $1], 0)
diff --git a/tests/regression.at b/tests/regression.at
index 372dbee6..6d4cd2a2 100644
--- a/tests/regression.at
+++ b/tests/regression.at
@@ -103,7 +103,7 @@ AT_DATA([input.y],
[[/* Bison used to swallow the character after `}'. */
%%
-exp: { tests = {{{{{{{{{{}}}}}}}}}}; }
+exp: { tests = {{{{{{{{{{}}}}}}}}}}; };
%%
]])
@@ -382,7 +382,7 @@ expr:
{
-}
+};
]])
AT_CHECK([bison input.y -o input.c -v], 0, [], [])
diff --git a/tests/sets.at b/tests/sets.at
index 7fa8d1f7..a5451d4d 100644
--- a/tests/sets.at
+++ b/tests/sets.at
@@ -161,14 +161,14 @@ AT_SETUP([Broken Closure])
AT_DATA([input.y],
[[%%
-a: b
-b: c
-c: d
-d: e
-e: f
-f: g
-g: h
-h: 'h'
+a: b;
+b: c;
+c: d;
+d: e;
+e: f;
+f: g;
+g: h;
+h: 'h';
]])
AT_CHECK([bison --trace input.y 2>&1 |