]> git.saurik.com Git - bison.git/commitdiff
* tests/sets.at (Broken Closure): Add the ending `;'.
authorAkim Demaille <akim@epita.fr>
Mon, 4 Mar 2002 14:57:46 +0000 (14:57 +0000)
committerAkim Demaille <akim@epita.fr>
Mon, 4 Mar 2002 14:57:46 +0000 (14:57 +0000)
* 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.

ChangeLog
NEWS
src/reader.c
tests/input.at
tests/output.at
tests/regression.at
tests/sets.at

index 0ab08595659e763c9fcdcee17c5adcdb6ec032b1..506b80def43d31433c86f9a2c7b0c534b424f981 100644 (file)
--- 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 09f35fecb2a29e43218f4b1df3242a1e58f297a5..a30792b1084b376c70835222c5c567b4ce60104d 100644 (file)
--- 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.
index 529cebe99efa8849280a59473610b1d824fbe523..ad9469e7f1c1885b306d0b797663a22f86b6a883 100644 (file)
@@ -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
index 117af98674f0292b7abb09aa619209b85ff46ca9..199d05df82dd4bd3201745b1ced4cf95878621a9 100644 (file)
@@ -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], [],
index 4332372dd781f839c940e615a5bfe0e4b2e4bb8e..147e8b28addf0d9f43ea902604163a6b9ddf65a1 100644 (file)
@@ -26,7 +26,7 @@ m4_define([AT_CHECK_OUTPUT],
 AT_DATA([$1],
 [[$2
 %%
-foo: {}
+foo: {};
 ]])
 
 AT_CHECK([bison $3 $1], 0)
index 372dbee657edc48029804f5a2509e922b846ea32..6d4cd2a281c8998042bc9d87ef94350a02104834 100644 (file)
@@ -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, [], [])
index 7fa8d1f73f3c123be9f6526ed13634d46396bfc4..a5451d4d1ed5fc33869d1cde2ba55a9aea80d0a2 100644 (file)
@@ -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 |