[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
@$ implies %locations
From: |
Joel E. Denny |
Subject: |
@$ implies %locations |
Date: |
Sat, 10 Feb 2007 17:28:23 -0500 (EST) |
I committed this.
Index: ChangeLog
===================================================================
RCS file: /sources/bison/bison/ChangeLog,v
retrieving revision 1.1680
diff -p -u -r1.1680 ChangeLog
--- ChangeLog 7 Feb 2007 20:37:28 -0000 1.1680
+++ ChangeLog 10 Feb 2007 22:24:39 -0000
@@ -1,3 +1,14 @@
+2007-02-10 Joel E. Denny <address@hidden>
+
+ As in semantic actions, make @$ in %initial-action, %destructor, and
+ %printer imply %locations.
+ * src/scan-code.l (SC_SYMBOL_ACTION): Set locations_flag = true when
+ scanning @$.
+ * tests/actions.at (AT_CHECK_ACTION_LOCATIONS): New macro supporting...
+ (@$ in %initial-action implies %locations,
+ @$ in %destructor implies %locations,
+ @$ in %printer implies %locations): ... these new test cases.
+
2007-02-07 Paul Eggert <address@hidden>
Undo most of the 2007-02-03 change, switching to the strcase module
Index: src/scan-code.l
===================================================================
RCS file: /sources/bison/bison/src/scan-code.l,v
retrieving revision 1.20
diff -p -u -r1.20 scan-code.l
--- src/scan-code.l 4 Jan 2007 03:21:08 -0000 1.20
+++ src/scan-code.l 10 Feb 2007 22:24:39 -0000
@@ -202,7 +202,10 @@ splice (\\[ \f\t\v]*\n)*
obstack_sgrow (&obstack_for_string, "]b4_dollar_dollar[");
self->is_value_used = true;
}
- "@$" obstack_sgrow (&obstack_for_string, "]b4_at_dollar[");
+ "@$" {
+ obstack_sgrow (&obstack_for_string, "]b4_at_dollar[");
+ locations_flag = true;
+ }
}
Index: tests/actions.at
===================================================================
RCS file: /sources/bison/bison/tests/actions.at,v
retrieving revision 1.79
diff -p -u -r1.79 actions.at
--- tests/actions.at 17 Jan 2007 08:36:07 -0000 1.79
+++ tests/actions.at 10 Feb 2007 22:24:39 -0000
@@ -1247,3 +1247,62 @@ Stack now 0
]])
AT_CLEANUP
+
+
+## ----------------------- ##
+## @$ implies %locations. ##
+## ----------------------- ##
+
+# Bison once forgot to check for @$ in actions other than semantic actions.
+
+# AT_CHECK_ACTION_LOCATIONS(ACTION-DIRECTIVE)
+# -------------------------------------------------------
+m4_define([AT_CHECK_ACTION_LOCATIONS],
+[AT_SETUP(address@hidden in ]$1[ implies %locations]])
+
+AT_DATA_GRAMMAR([[input.y]],
+[[%code {
+ #include <stdio.h>
+ static int yylex (void);
+ static void yyerror (char const *msg);
+}
+
+%debug
+
+]$1[ {
+ printf ("%d\n", @$.first_line);
+} ]m4_if($1, [%initial-action], [], [[start]])[
+
+%%
+
+start: ;
+
+%%
+
+static int
+yylex (void)
+{
+ return 0;
+}
+
+static void
+yyerror (char const *msg)
+{
+ fprintf (stderr, "%s\n", msg);
+}
+
+int
+main (void)
+{
+ return yyparse ();
+}
+]])
+
+AT_CHECK([[bison -o input.c input.y]])
+AT_COMPILE([[input]])
+
+AT_CLEANUP])
+
+AT_CHECK_ACTION_LOCATIONS([[%initial-action]])
+AT_CHECK_ACTION_LOCATIONS([[%destructor]])
+AT_CHECK_ACTION_LOCATIONS([[%printer]])
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- @$ implies %locations,
Joel E. Denny <=