+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
# --------------------
# 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])
# 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]))])
# 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()
# --------------------
# 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])
# 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])
# -----------------
# Expansion of @$.
m4_define([b4_lhs_location],
-[yyloc])
+[(yyloc)])
# b4_rhs_location(RULE-LENGTH, NUM)
# 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
# --------------------
# 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])
# 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]))])
# -----------------
# Expansion of @$.
m4_define([b4_lhs_location],
-[yyloc])
+[(yyloc)])
# b4_rhs_location(RULE-LENGTH, NUM)
# 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])@})])