]> git.saurik.com Git - bison.git/commitdiff
* data/glr.c (b4_lhs_value, b4_rhs_value, b4_rhs-location):
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 16 Dec 2004 20:41:54 +0000 (20:41 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 16 Dec 2004 20:41:54 +0000 (20:41 +0000)
Parenthesize rhs to avoid obscure problems with mistakes like
"foo$$bar = foo$1bar;".  Problem reported by twlevo at xs4all.
* data/lalr1.cc (b4_lhs_value, b4_rhs_value, b4_lhs_location,
b4_rhs_location): Likewise.
* data/yacc.c (b4_lhs_value, b4_rhs_value, b4_lhs_location,
b4_rhs_location): Likewise.

ChangeLog
data/glr.c
data/lalr1.cc
data/yacc.c

index e256cc54388074acb7914e414640b659dc63e429..133b261581406b5d36f1b940db63f19d9ff9e12b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-12-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * data/glr.c (b4_lhs_value, b4_rhs_value, b4_rhs-location):
+       Parenthesize rhs to avoid obscure problems with mistakes like
+       "foo$$bar = foo$1bar;".  Problem reported by twlevo at xs4all.
+       * data/lalr1.cc (b4_lhs_value, b4_rhs_value, b4_lhs_location,
+       b4_rhs_location): Likewise.
+       * data/yacc.c (b4_lhs_value, b4_rhs_value, b4_lhs_location,
+       b4_rhs_location): Likewise.
+
 2004-12-16  Akim Demaille  <akim@epita.fr>
 
        * data/lalr1.cc (yyreport_syntax_error_): Catch up with glr.c and
index 5fef464f91f5bdf6658369d7142c05cf435f786e..bed1521455c0ac7fdcaf192f5b3841705d609296 100644 (file)
@@ -103,7 +103,7 @@ m4_define([b4_lpure_formals],
 # --------------------
 # Expansion of $<TYPE>$.
 m4_define([b4_lhs_value],
-[(*yyvalp)[]m4_ifval([$1], [.$1])])
+[((*yyvalp)[]m4_ifval([$1], [.$1]))])
 
 
 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
@@ -111,7 +111,7 @@ m4_define([b4_lhs_value],
 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
 # symbols on RHS.
 m4_define([b4_rhs_value],
-[((yyGLRStackItem const *)yyvsp)@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yysemantics.yysval[]m4_ifval([$3], [.$3])])
+[(((yyGLRStackItem const *)yyvsp)@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yysemantics.yysval[]m4_ifval([$3], [.$3]))])
 
 
 
@@ -131,7 +131,7 @@ m4_define([b4_lhs_location],
 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
 # on RHS.
 m4_define([b4_rhs_location],
-[((yyGLRStackItem const *)yyvsp)@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yyloc])
+[(((yyGLRStackItem const *)yyvsp)@{YYFILL (m4_eval([$2 - $1]))@}.yystate.yyloc)])
 
 # We do want M4 expansion after # for CPP macros.
 m4_changecom()
index 8e82cb51f3efc266ec5f6a08eedcbf3cfe80af30..6a1642bcc570ea813bc330cd156631e1b0f43736 100644 (file)
@@ -35,7 +35,7 @@ m4_define_default([b4_parser_class_name], [Parser])
 # --------------------
 # Expansion of $<TYPE>$.
 m4_define([b4_lhs_value],
-[yyval[]m4_ifval([$1], [.$1])])
+[(yyval[]m4_ifval([$1], [.$1]))])
 
 
 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
@@ -43,7 +43,7 @@ m4_define([b4_lhs_value],
 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
 # symbols on RHS.
 m4_define([b4_rhs_value],
-[yysemantic_stack_@{m4_eval([$1 - $2])@}m4_ifval([$3], [.$3])])
+[(yysemantic_stack_@{m4_eval([$1 - $2])@}m4_ifval([$3], [.$3]))])
 
 m4_define_default([b4_location_type], [Location])
 
@@ -51,7 +51,7 @@ m4_define_default([b4_location_type], [Location])
 # -----------------
 # Expansion of @$.
 m4_define([b4_lhs_location],
-[yyloc])
+[(yyloc)])
 
 
 # b4_rhs_location(RULE-LENGTH, NUM)
@@ -59,7 +59,7 @@ m4_define([b4_lhs_location],
 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
 # on RHS.
 m4_define([b4_rhs_location],
-[yylocation_stack_@{m4_eval([$1 - $2])@}])
+[(yylocation_stack_@{m4_eval([$1 - $2])@})])
 
 
 # b4_parse_param_decl
index 7331b65c3e3296183af281715173b338cb91abb3..5d9b8bd1c128b8ce7d6239aca5f09de6f27bc835 100644 (file)
@@ -93,7 +93,7 @@ m4_define([b4_int_type],
 # --------------------
 # Expansion of $<TYPE>$.
 m4_define([b4_lhs_value],
-[yyval[]m4_ifval([$1], [.$1])])
+[(yyval[]m4_ifval([$1], [.$1]))])
 
 
 # b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
@@ -101,7 +101,7 @@ m4_define([b4_lhs_value],
 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
 # symbols on RHS.
 m4_define([b4_rhs_value],
-[yyvsp@{m4_eval([$2 - $1])@}m4_ifval([$3], [.$3])])
+[(yyvsp@{m4_eval([$2 - $1])@}m4_ifval([$3], [.$3]))])
 
 
 
@@ -113,7 +113,7 @@ m4_define([b4_rhs_value],
 # -----------------
 # Expansion of @$.
 m4_define([b4_lhs_location],
-[yyloc])
+[(yyloc)])
 
 
 # b4_rhs_location(RULE-LENGTH, NUM)
@@ -121,7 +121,7 @@ m4_define([b4_lhs_location],
 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
 # on RHS.
 m4_define([b4_rhs_location],
-[yylsp@{m4_eval([$2 - $1])@}])
+[(yylsp@{m4_eval([$2 - $1])@})])