bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SPAM] Re: proposal: simplify prologue alternatives into %code


From: Joel E. Denny
Subject: Re: [SPAM] Re: proposal: simplify prologue alternatives into %code
Date: Sun, 7 Jan 2007 02:50:21 -0500 (EST)

On Sat, 6 Jan 2007, Joel E. Denny wrote:

> > +2007-01-04  Joel E. Denny  <address@hidden>
> 
> > +   (b4_check_percent_code_qualifiers): New.  A skeleton can use this to
> > +   declare what %code qualifiers it supports and to complain if any other
> > +   qualifiers were used in the grammar.

I committed the patch below to do the same thing for %define.  This raises 
a few issues:

1. Are there any C skeleton %define variables?  I'm aware of none.  If 
there are some, I've just disabled them.

2. Are there any C++ skeleton %define variables besides the following?

  global_tokens_and_yystype
  parser_class_name
  location_type
  filename_type
  b4_namespace
  b4_define_location_comparison

If there are others, I've just disabled them.

3. The user can break Bison by putting strange characters in %define 
variable names or %code qualifiers.  For example:

  %define "[" "value"
  %code "[" { CODE }

I think we shouldn't use STRING for those names in parse-gram.y.  
Instead, we should define a limited regular expression that plays nicely 
with M4.  This leads me to believe we shouldn't have quotes around the 
name, but I'm not sure.

4. I wish %define put all its names in a separate namespace.  For example:

  %define "my_name" "value"

would create a b4_percent_define_my_name muscle instead of b4_my_name.  I 
do something similar for %code qualifiers.  This keeps these muscles out 
of the way of all of Bison's internal muscles.  Any objections?  Maybe 
this would irritate skeleton authors too much in the short term.

Index: ChangeLog
===================================================================
RCS file: /sources/bison/bison/ChangeLog,v
retrieving revision 1.1651
diff -p -u -r1.1651 ChangeLog
--- ChangeLog   7 Jan 2007 03:19:21 -0000       1.1651
+++ ChangeLog   7 Jan 2007 07:29:49 -0000
@@ -1,3 +1,29 @@
+2007-01-07  Joel E. Denny  <address@hidden>
+
+       Check for unrecognized %define variables similar to checking for
+       unrecognized %code qualifiers.  Check for redefined %define variables.
+       * data/bison.m4 (b4_check_for_unrecognized_names): New macro that
+       generalizes...
+       (b4_check_percent_code_qualifiers): ... this, which now wraps it.
+       (b4_check_percent_define_variables): New, also wraps it.
+       * data/glr.c: Unless glr.cc is wrapping glr.c, declare no valid %define
+       variables using b4_check_percent_define_variables.
+       * data/glr.cc, data/lalr1.cc: Declare the valid %define variables as
+       all those exercised in the test suite and all those listed in the
+       `Default values' section of c++.m4.  Are there others?
+       * data/push.c, data/yacc.c: Declare no valid %define variables.
+       * src/muscle_tab.c, src/muscle_tab.h (muscle_find_const): New function,
+       similar to muscle_find, but it works even when the muscle stores a
+       const value.
+       (muscle_grow_used_name_list): New function for constructing the used
+       name list muscles that b4_check_for_unrecognized_names requires.
+       * src/parse-gram.y (prologue_declaration): Warn if a variable is
+       %define'd more than once.  Define the b4_used_percent_define_variables
+       muscle with muscle_grow_used_name_list.
+       (grammar_declaration): Abbreviate %code code with
+       muscle_grow_used_name_list.
+       * tests/input.at (%define errors): New.
+
 2007-01-06  Joel E. Denny  <address@hidden>
 
        Provide warn_at, complain_at, and fatal_at function callbacks to the
Index: data/bison.m4
===================================================================
RCS file: /sources/bison/bison/data/bison.m4,v
retrieving revision 1.8
diff -p -u -r1.8 bison.m4
--- data/bison.m4       7 Jan 2007 03:19:21 -0000       1.8
+++ data/bison.m4       7 Jan 2007 07:29:49 -0000
@@ -66,7 +66,7 @@ version 2.2 of Bison.])])
 ## ---------------- ##
 
 # b4_error(KIND, FORMAT, [ARG1], [ARG2], ...)
-# -----------------------------------------------------
+# -------------------------------------------
 # Write @KIND(FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
 m4_define([b4_error],
 [m4_divert_push(0)address@hidden(]$2[]m4_if([$#], [2], [],
@@ -75,7 +75,7 @@ m4_define([b4_error],
             [[@,]b4_arg])])[@)]m4_divert_pop(0)])
 
 # b4_error_at(KIND, START, END, FORMAT, [ARG1], [ARG2], ...)
-# -----------------------------------------------------------------
+# ----------------------------------------------------------
 # Write @KIND(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
 m4_define([b4_error_at],
 [m4_divert_push(0)address@hidden(]$2[@,]$3[@,]$4[]m4_if([$#], [4], [],
@@ -84,7 +84,7 @@ m4_define([b4_error_at],
             [[@,]b4_arg])])[@)]m4_divert_pop(0)])
 
 # b4_warn(FORMAT, [ARG1], [ARG2], ...)
-# -----------------------------------------------------
+# ------------------------------------
 # Write @warn(FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
 #
 # As a simple test suite, this:
@@ -116,13 +116,13 @@ m4_define([b4_warn],
 [b4_error([[warn]], $@)])
 
 # b4_warn_at(START, END, FORMAT, [ARG1], [ARG2], ...)
-# -----------------------------------------------------------------
+# ---------------------------------------------------
 # Write @warn(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
 m4_define([b4_warn_at],
 [b4_error_at([[warn]], $@)])
 
 # b4_complain(FORMAT, [ARG1], [ARG2], ...)
-# ---------------------------------------------------------
+# ----------------------------------------
 # Write @complain(FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
 #
 # See the test suite for b4_warn above.
@@ -130,13 +130,13 @@ m4_define([b4_complain],
 [b4_error([[complain]], $@)])
 
 # b4_complain_at(START, END, FORMAT, [ARG1], [ARG2], ...)
-# ---------------------------------------------------------------------
+# -------------------------------------------------------
 # Write @complain(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
 m4_define([b4_complain_at],
 [b4_error_at([[complain]], $@)])
 
 # b4_fatal(FORMAT, [ARG1], [ARG2], ...)
-# ------------------------------------------------------
+# -------------------------------------
 # Write @fatal(FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
 #
 # See the test suite for b4_warn above.
@@ -144,7 +144,7 @@ m4_define([b4_fatal],
 [b4_error([[fatal]], $@)])
 
 # b4_fatal_at(START, END, FORMAT, [ARG1], [ARG2], ...)
-# ------------------------------------------------------------------
+# ----------------------------------------------------
 # Write @fatal(START@,END@,FORMAT@,ARG1@,ARG2@,...@) to diversion 0.
 m4_define([b4_fatal_at],
 [b4_error_at([[fatal]], $@)])
@@ -283,57 +283,81 @@ b4_define_user_code([pre_prologue])
 b4_define_user_code([stype])
 
 
+# b4_check_for_unrecognized_names(WHAT, LIST, [VALID_NAME], [VALID_NAME])
+# -----------------------------------------------------------------------
+# Complain if any name of type WHAT is used in the grammar (as recorded in
+# LIST) but is not a VALID_NAME.
+#
+# LIST must expand to a list specifying all grammar occurrences of all names of
+# type WHAT.   Each item in the list is a triplet specifying one occurrence:
+# name, start boundary, and end boundary.  Empty string names are fine.  An
+# empty list is fine.
+#
+# For example, to define b4_foo_list to be used for LIST with three name
+# occurrences and with correct quoting:
+#
+#   m4_define([b4_foo_list],
+#             [[[[[[bar]], [[parser.y:1.7]], [[parser.y:1.16]]]],
+#               [[[[bar]], [[parser.y:5.7]], [[parser.y:5.16]]]],
+#               [[[[baz]], [[parser.y:8.7]], [[parser.y:8.16]]]]]])
+#
+# Each VALID_NAME must expand to a valid name of type WHAT.  Multiple
+# occurrences of the same valid name are fine.  A VALID_NAME that expands to
+# the empty string will correctly define the empty string as a valid name, but
+# it would be ugly for a Bison skeleton to actually use that.
+#
+# For example, to invoke b4_check_for_unrecognized_names with TYPE foo, with
+# LIST b4_foo_list, with two valid names, and with correct quoting:
+#
+#   b4_check_for_unrecognized_names([[foo]], [b4_foo_list],
+#                                   [[bar]], [[baz]])
+#
+# Names and valid names must not contain the character `,'.
+m4_define([b4_check_for_unrecognized_names],
+[m4_foreach([b4_occurrence],
+            $2,
+            [m4_pushdef([b4_occurrence], b4_occurrence)
+             m4_pushdef([b4_name], m4_car(b4_occurrence))
+             m4_pushdef([b4_start], m4_car(m4_shift(b4_occurrence)))
+             m4_pushdef([b4_end], m4_shift(m4_shift(b4_occurrence)))
+             m4_if(m4_index(m4_if($#, 2, [],
+                                  [[,]m4_quote(m4_shift(m4_shift($*)))[,]]),
+                            [,]b4_name[,]),
+                   [-1],
+                   [b4_complain_at([b4_start], [b4_end],
+                                   [[`%s' is not a recognized %s]],
+                                   [b4_name], [$1])
+                   ])
+             m4_popdef([b4_occurrence])
+             m4_popdef([b4_name])
+             m4_popdef([b4_start])
+             m4_popdef([b4_end])
+            ])
+])
+
+# b4_check_percent_define_variables([VAILD_VARIABLE], [VALID_VARIABLE], ...)
+# --------------------------------------------------------------------------
+# Wrapper around b4_check_for_unrecognized_names for %define variables.
+#
+# b4_used_percent_define_variables must contain a list of all %define variables
+# used in the grammar similar to b4_foo_list from the
+# b4_check_for_unrecognized_names documentation's example.  If
+# b4_used_percent_define_variables is undefined, it's treated the same as an
+# empty list.
+#
+# Invoking b4_check_percent_define_variables with empty parens specifies one
+# valid variable that is an empty string.  Invoke it without parens to specify
+# that there are no valid variables.
+m4_define([b4_check_percent_define_variables],
+[m4_ifdef([b4_used_percent_define_variables],
+[b4_check_for_unrecognized_names([[%define variable]],
+[b4_used_percent_define_variables]m4_if([$#], [0], [], [, address@hidden))])])
+
 # b4_check_percent_code_qualifiers([VAILD_QUALIFIER], [VALID_QUALIFIER], ...)
 # ---------------------------------------------------------------------------
-# Complain if any %code qualifier used in the grammar is not a valid qualifier.
-#
-# If no %code qualifiers are used in the grammar,
-# b4_used_percent_code_qualifiers must be undefined or must expand to the empty
-# string.  Otherwise, it must expand to a list specifying all occurrences of
-# all %code qualifiers used in the grammar.   Each item in the list is a
-# triplet specifying one occurrence: qualifier, start boundary, and end
-# boundary.  For example, to define b4_used_percent_code_qualifiers with three
-# qualifier occurrences with correct quoting:
-#
-#   m4_define([b4_used_percent_code_qualifiers],
-#             [[[[[[requires]], [[parser.y:1.7]], [[parser.y:1.16]]]],
-#               [[[[provides]], [[parser.y:5.7]], [[parser.y:5.16]]]],
-#               [[[[provides]], [[parser.y:8.7]], [[parser.y:8.16]]]]]])
-#
-# Empty string qualifiers are fine.
-#
-# Each VALID_QUALIFIER must expand to a valid qualifier.  For example,
-# b4_check_percent_code_qualifiers might be invoked with:
-#
-#   b4_check_percent_code_qualifiers([[requires]], [[provides]])
-#
-# Multiple occurrences of the same valid qualifier are fine.  A VALID_QUALIFIER
-# that expands to the empty string will correctly define the empty string as a
-# valid qualifier, but it would be ugly for a Bison skeleton to actually use
-# that.  If b4_used_percent_code_qualifiers is invoked with empty parens, then
-# there is one valid qualifier and it is the empty string.  To specify that
-# there are no valid qualifiers, invoke b4_check_percent_code_qualifiers
-# without parens.
-#
-# Qualifiers and valid qualifiers must not contain the character `,'.
+# Same as b4_check_percent_define_variables but for %code qualifiers using
+# b4_used_percent_code_qualifiers.
 m4_define([b4_check_percent_code_qualifiers],
-[m4_ifdef([b4_used_percent_code_qualifiers], [
-m4_foreach([b4_occurrence],
-           b4_used_percent_code_qualifiers,
-           [m4_pushdef([b4_occurrence], b4_occurrence)
-            m4_pushdef([b4_qualifier], m4_car(b4_occurrence))
-            m4_pushdef([b4_start], m4_car(m4_shift(b4_occurrence)))
-            m4_pushdef([b4_end], m4_shift(m4_shift(b4_occurrence)))
-            m4_if(m4_index(m4_if($#, 0, [], [[,]m4_quote($*)[,]]),
-                           [,]b4_qualifier[,]),
-                  [-1],
-                  [b4_complain_at([b4_start], [b4_end],
-                                  [[`%s' is not a recognized %%code 
qualifier]],
-                                  [b4_qualifier])
-                  ])
-            m4_popdef([b4_occurrence])
-            m4_popdef([b4_qualifier])
-            m4_popdef([b4_start])
-            m4_popdef([b4_end])
-           ])
-])])
+[m4_ifdef([b4_used_percent_code_qualifiers],
+[b4_check_for_unrecognized_names([[%code qualifier]],
+[b4_used_percent_code_qualifiers]m4_if([$#], [0], [], [, address@hidden))])])
Index: data/glr.c
===================================================================
RCS file: /sources/bison/bison/data/glr.c,v
retrieving revision 1.196
diff -p -u -r1.196 glr.c
--- data/glr.c  6 Jan 2007 06:14:04 -0000       1.196
+++ data/glr.c  7 Jan 2007 07:29:50 -0000
@@ -20,7 +20,13 @@
 
 
 m4_include(b4_pkgdatadir/[c.m4])
-b4_check_percent_code_qualifiers([[requires]], [[provides]], [[top]])
+
+# glr.cc checks %define variables also.
+m4_if(b4_skeleton, [["glr.c"]], [b4_check_percent_define_variables])
+
+b4_check_percent_code_qualifiers([[requires]],
+                                 [[provides]],
+                                 [[top]])
 
 b4_push_if([
 b4_complain([[non-deterministic push parsers are not yet supported]])])
Index: data/glr.cc
===================================================================
RCS file: /sources/bison/bison/data/glr.cc,v
retrieving revision 1.31
diff -p -u -r1.31 glr.cc
--- data/glr.cc 6 Jan 2007 06:14:04 -0000       1.31
+++ data/glr.cc 7 Jan 2007 07:29:50 -0000
@@ -57,6 +57,12 @@ b4_defines_if([],
 m4_include(b4_pkgdatadir/[c++.m4])
 m4_include(b4_pkgdatadir/[location.cc])
 
+b4_check_percent_define_variables([[global_tokens_and_yystype]],
+                                  [[parser_class_name]],
+                                  [[location_type]],
+                                  [[filename_type]],
+                                  [[b4_namespace]],
+                                  [[b4_define_location_comparison]])
 
 # Save the parse parameters.
 m4_define([b4_parse_param_orig], m4_defn([b4_parse_param]))
Index: data/lalr1.cc
===================================================================
RCS file: /sources/bison/bison/data/lalr1.cc,v
retrieving revision 1.148
diff -p -u -r1.148 lalr1.cc
--- data/lalr1.cc       6 Jan 2007 06:14:04 -0000       1.148
+++ data/lalr1.cc       7 Jan 2007 07:29:50 -0000
@@ -18,7 +18,17 @@
 # 02110-1301  USA
 
 m4_include(b4_pkgdatadir/[c++.m4])
-b4_check_percent_code_qualifiers([[requires]], [[provides]], [[top]])
+
+b4_check_percent_define_variables([[global_tokens_and_yystype]],
+                                  [[parser_class_name]],
+                                  [[location_type]],
+                                  [[filename_type]],
+                                  [[b4_namespace]],
+                                  [[b4_define_location_comparison]])
+
+b4_check_percent_code_qualifiers([[requires]],
+                                 [[provides]],
+                                 [[top]])
 
 # The header is mandatory.
 b4_defines_if([],
Index: data/push.c
===================================================================
RCS file: /sources/bison/bison/data/push.c,v
retrieving revision 1.31
diff -p -u -r1.31 push.c
--- data/push.c 6 Jan 2007 06:14:04 -0000       1.31
+++ data/push.c 7 Jan 2007 07:29:51 -0000
@@ -33,7 +33,12 @@ b4_use_push_for_pull_if([
   ])])
 
 m4_include(b4_pkgdatadir/[c.m4])
-b4_check_percent_code_qualifiers([[requires]], [[provides]], [[top]])
+
+b4_check_percent_define_variables
+
+b4_check_percent_code_qualifiers([[requires]],
+                                 [[provides]],
+                                 [[top]])
 
 ## ---------------- ##
 ## Default values.  ##
Index: data/yacc.c
===================================================================
RCS file: /sources/bison/bison/data/yacc.c,v
retrieving revision 1.159
diff -p -u -r1.159 yacc.c
--- data/yacc.c 6 Jan 2007 06:14:04 -0000       1.159
+++ data/yacc.c 7 Jan 2007 07:29:51 -0000
@@ -24,7 +24,12 @@
 b4_use_push_for_pull_if([m4_include(b4_pkgdatadir/[push.c])m4_exit])
 
 m4_include(b4_pkgdatadir/[c.m4])
-b4_check_percent_code_qualifiers([[requires]], [[provides]], [[top]])
+
+b4_check_percent_define_variables
+
+b4_check_percent_code_qualifiers([[requires]],
+                                 [[provides]],
+                                 [[top]])
 
 ## ---------------- ##
 ## Default values.  ##
Index: src/muscle_tab.c
===================================================================
RCS file: /sources/bison/bison/src/muscle_tab.c,v
retrieving revision 1.42
diff -p -u -r1.42 muscle_tab.c
--- src/muscle_tab.c    7 Jan 2007 03:19:21 -0000       1.42
+++ src/muscle_tab.c    7 Jan 2007 07:29:51 -0000
@@ -209,6 +209,26 @@ void muscle_pair_list_grow (const char *
   obstack_free (&muscle_obstack, pair);
 }
 
+
+/*----------------------------------------------------------------------------.
+| Find the value of muscle KEY.  Unlike MUSCLE_FIND, this is always reliable  |
+| to determine whether KEY has a value.                                       |
+`----------------------------------------------------------------------------*/
+
+char const *
+muscle_find_const (char const *key)
+{
+  muscle_entry probe;
+  muscle_entry *result = NULL;
+
+  probe.key = key;
+  result = hash_lookup (muscle_table, &probe);
+  if (result)
+    return result->value;
+  return NULL;
+}
+
+
 /*----------------------------------------------------------------------------.
 | Find the value of muscle KEY.  Abort if muscle_insert was invoked more      |
 | recently than muscle_grow for KEY since muscle_find can't return a          |
@@ -216,7 +236,7 @@ void muscle_pair_list_grow (const char *
 `----------------------------------------------------------------------------*/
 
 char *
-muscle_find (const char *key)
+muscle_find (char const *key)
 {
   muscle_entry probe;
   muscle_entry *result = NULL;
@@ -276,3 +296,16 @@ muscle_boundary_grow (char const *key, b
   muscle_grow (key, extension, "");
   obstack_free (&muscle_obstack, extension);
 }
+
+void
+muscle_grow_used_name_list (char const *key, char const *used_name,
+                            location loc)
+{
+  muscle_grow (key, "[[[[", ",");
+  muscle_grow (key, used_name, "");
+  muscle_grow (key, "]], [[", "");
+  muscle_boundary_grow (key, loc.start);
+  muscle_grow (key, "]], [[", "");
+  muscle_boundary_grow (key, loc.end);
+  muscle_grow (key, "]]]]", "");
+}
Index: src/muscle_tab.h
===================================================================
RCS file: /sources/bison/bison/src/muscle_tab.h,v
retrieving revision 1.20
diff -p -u -r1.20 muscle_tab.h
--- src/muscle_tab.h    7 Jan 2007 03:19:21 -0000       1.20
+++ src/muscle_tab.h    7 Jan 2007 07:29:51 -0000
@@ -26,6 +26,7 @@
 void muscle_init (void);
 void muscle_insert (char const *key, char const *value);
 char *muscle_find (char const *key);
+char const *muscle_find_const (char const *key);
 void muscle_free (void);
 
 
@@ -116,4 +117,12 @@ void muscles_m4_output (FILE *out);
    for special characters in the file name.  */
 void muscle_boundary_grow (char const *key, boundary bound);
 
+/* Grow KEY for the occurrence of the name USED_NAME at LOC appropriately for
+   use with b4_check_for_unrecognized_names in ../data/bison.m4.  USED_NAME
+   is not escaped with digraphs, so it must not contain `[' or `]'.  As a
+   precondition on b4_check_for_unrecognized_names, it can't contain `,'
+   either.  */
+void muscle_grow_used_name_list (char const *key, char const *used_name,
+                                 location loc);
+
 #endif /* not MUSCLE_TAB_H_ */
Index: src/parse-gram.y
===================================================================
RCS file: /sources/bison/bison/src/parse-gram.y,v
retrieving revision 1.108
diff -p -u -r1.108 parse-gram.y
--- src/parse-gram.y    7 Jan 2007 03:19:21 -0000       1.108
+++ src/parse-gram.y    7 Jan 2007 07:29:52 -0000
@@ -82,7 +82,6 @@ static int current_prec = 0;
 %locations
 %pure-parser
 %error-verbose
-%defines
 %name-prefix="gram_"
 %expect 0
 
@@ -233,7 +232,15 @@ prologue_declaration:
       code_scanner_last_string_free ();
     }
 | "%debug"                         { debug_flag = true; }
-| "%define" STRING content.opt     { muscle_insert ($2, $3); }
+| "%define" STRING content.opt
+    {
+      /* FIXME: Special characters in $2 may break %define.
+         For example: `['.  */
+      if (muscle_find_const ($2))
+        warn_at (@2, _("%s: `%s' redefined"), "%define", $2);
+      muscle_insert ($2, $3);
+      muscle_grow_used_name_list ("used_percent_define_variables", $2, @2);
+    }
 | "%defines"                       { defines_flag = true; }
 | "%defines" STRING
     {
@@ -316,6 +323,8 @@ grammar_declaration:
     }
 | "%code" STRING braceless
     {
+      /* FIXME: Special characters in $2 may break %code.
+         For example: `['.  */
       char const name_prefix[] = "percent_code_";
       char *name = xmalloc (sizeof name_prefix + strlen ($2));
       strcpy (name, name_prefix);
@@ -323,13 +332,7 @@ grammar_declaration:
       muscle_code_grow (uniqstr_new (name), $3, @3);
       free (name);
       code_scanner_last_string_free ();
-      muscle_grow ("used_percent_code_qualifiers", "[[[[", ",");
-      muscle_grow ("used_percent_code_qualifiers", $2, "");
-      muscle_grow ("used_percent_code_qualifiers", "]], [[", "");
-      muscle_boundary_grow ("used_percent_code_qualifiers", @2.start);
-      muscle_grow ("used_percent_code_qualifiers", "]], [[", "");
-      muscle_boundary_grow ("used_percent_code_qualifiers", @2.end);
-      muscle_grow ("used_percent_code_qualifiers", "]]]]", "");
+      muscle_grow_used_name_list ("used_percent_code_qualifiers", $2, @2);
     }
 ;
 
Index: tests/input.at
===================================================================
RCS file: /sources/bison/bison/tests/input.at,v
retrieving revision 1.70
diff -p -u -r1.70 input.at
--- tests/input.at      7 Jan 2007 03:19:21 -0000       1.70
+++ tests/input.at      7 Jan 2007 07:29:52 -0000
@@ -788,3 +788,28 @@ special-char-@:>@.y:3.7-8: `' is not a r
 ]])
 
 AT_CLEANUP
+
+
+## ---------------- ##
+## %define errors.  ##
+## ---------------- ##
+
+AT_SETUP([%define errors])
+
+AT_DATA([input.y],
+[[%define "var" "value1"
+%define "var" "value1"
+ %define "var" "value2"
+%%
+start: ;
+]])
+
+AT_CHECK([[bison input.y]], [1], [],
+[[input.y:2.9-13: warning: %define: `var' redefined
+input.y:3.10-14: warning: %define: `var' redefined
+input.y:1.9-13: `var' is not a recognized %define variable
+input.y:2.9-13: `var' is not a recognized %define variable
+input.y:3.10-14: `var' is not a recognized %define variable
+]])
+
+AT_CLEANUP




reply via email to

[Prev in Thread] Current Thread [Next in Thread]