[EMAIL PROTECTED] writes:

> minor flaw in handling of @@ in bison current cvs version?
>
> something like  `@@$.start.file' does not generate
> warning message and non-compilable output is written.
>
> should this be seen as a bug?

I wouldn't call it a bug, since Bison isn't responsible for checking C
syntax.  However, Bison should warn if it sees '@' or '$' that is just
being copied through, since it's probably an error and it may run
afoul of future extensions we're thinking of.

I installed this patch.  Thanks for reporting the problem.

2005-10-13  Paul Eggert  <[EMAIL PROTECTED]>

        * NEWS: Bison now warns if it finds a stray `$' or `@' in an action.
        * src/scan-gram.l (<SC_BRACED_CODE>[EMAIL PROTECTED]): Implement this.

--- NEWS        5 Oct 2005 06:57:16 -0000       1.128
+++ NEWS        13 Oct 2005 19:35:51 -0000
@@ -3,7 +3,7 @@ Bison News
 
 Changes in version 2.1a:
 
-* DJGPP support added.
+* Bison now warns if it finds a stray `$' or `@' in an action.
 
 * %require "VERSION"
   To specify that the grammar file depends on features implemented in
@@ -22,6 +22,8 @@ Changes in version 2.1a:
 
   If you wish to update, then make sure older version of Bison will
   fail using `%require "2.1a"'.
+
+* DJGPP support added.
 
 Changes in version 2.1, 2005-09-16:
 
--- src/scan-gram.l     11 Oct 2005 05:06:16 -0000      1.77
+++ src/scan-gram.l     13 Oct 2005 19:35:52 -0000
@@ -618,6 +618,15 @@ splice      (\\[ \f\t\v]*\n)*
   "$"("<"{tag}">")?(-?[0-9]+|"$")  handle_dollar (token_type, yytext, *loc);
   "@"(-?[0-9]+|"$")               handle_at (token_type, yytext, *loc);
 
+  "$"  {
+    warn_at (*loc, _("stray `$'"));
+    obstack_sgrow (&obstack_for_string, "$][");
+  }
+  "@"  {
+    warn_at (*loc, _("stray `@'"));
+    obstack_sgrow (&obstack_for_string, "@@");
+  }
+
   <<EOF>>  unexpected_eof (code_start, "}"); BEGIN INITIAL;
 }
 


Reply via email to