* 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.
This commit is contained in:
Paul Eggert
2004-12-16 20:41:54 +00:00
parent fd19f2714f
commit bc82c5a593
4 changed files with 21 additions and 11 deletions

View 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()