From bfcf1f3af044b8aa2193a4271a065085f7868777 Mon Sep 17 00:00:00 2001
From: Akim Demaille <akim@epita.fr>
Date: Mon, 4 Mar 2002 16:23:35 +0000
Subject: [PATCH] * tests/input.at (Invalid $n, Invalid @n): Add the ending
 `;'. * tests/output.at (AT_CHECK_OUTPUT): Likewise. * tests/headers.at
 (AT_TEST_CPP_GUARD_H): Ditto. * tests/semantic.at (Parsing Guards):
 Similarly. * src/reader.at (readgram): Complain if the last rule is not ended
 with a semi-colon.

---
 ChangeLog           | 11 +++++++++++
 src/reader.c        |  2 ++
 tests/headers.at    |  2 +-
 tests/input.at      |  4 ++--
 tests/output.at     |  2 +-
 tests/regression.at |  4 ++--
 tests/semantic.at   |  2 +-
 7 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8b1988d4..e05aaa51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2002-03-04  Akim Demaille  <akim@epita.fr>
+
+	* tests/input.at (Invalid $n, Invalid @n): Add the ending `;'.
+	* tests/output.at (AT_CHECK_OUTPUT): Likewise.
+	* tests/headers.at (AT_TEST_CPP_GUARD_H): Ditto.
+	* tests/semantic.at (Parsing Guards): Similarly.
+	* src/reader.at (readgram): Complain if the last rule is not ended
+	with a semi-colon.
+
 2002-03-04  Akim Demaille  <akim@epita.fr>
 
 	* src/warshall.h, src/warshall.c (bitmatrix_print): Move to...
@@ -5750,3 +5759,5 @@
 1987-12-16  Richard Stallman  <rms@gnu.org>
 
 	* REFERENCES: entered into RCS
+
+	$Revision$ $Date$
diff --git a/src/reader.c b/src/reader.c
index 5f2419ff..ce9c34f0 100644
--- a/src/reader.c
+++ b/src/reader.c
@@ -1445,6 +1445,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 ();
       }
diff --git a/tests/headers.at b/tests/headers.at
index fb043015..122e5846 100644
--- a/tests/headers.at
+++ b/tests/headers.at
@@ -57,7 +57,7 @@ AS_MKDIR_P([$dirname])
 
 AT_DATA([$1.y],
 [%%
-dummy:
+dummy:;
 ])
 
 AT_CHECK([bison --defines=$1.h $1.y])
diff --git a/tests/input.at b/tests/input.at
index 978affc5..2ee59f29 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 d0e75151..7517b931 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/semantic.at b/tests/semantic.at
index b03329d3..9f88352b 100644
--- a/tests/semantic.at
+++ b/tests/semantic.at
@@ -38,7 +38,7 @@ AT_DATA([input.y],
 %%
 exp: exp '+' exp { $$ = $1 + $3 }
    | exp '/' exp %guard { if ($3 == 0) yyerror = 1 } { $$ = $1 / $3 }
-   | INT
+   | INT;
 %%
 ]])
 
-- 
2.47.2