* 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

@@ -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> 2004-12-16 Akim Demaille <akim@epita.fr>
* data/lalr1.cc (yyreport_syntax_error_): Catch up with glr.c and * data/lalr1.cc (yyreport_syntax_error_): Catch up with glr.c and

View File

@@ -103,7 +103,7 @@ m4_define([b4_lpure_formals],
# -------------------- # --------------------
# Expansion of $<TYPE>$. # Expansion of $<TYPE>$.
m4_define([b4_lhs_value], m4_define([b4_lhs_value],
[(*yyvalp)[]m4_ifval([$1], [.$1])]) [((*yyvalp)[]m4_ifval([$1], [.$1]))])
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE]) # 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 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
# symbols on RHS. # symbols on RHS.
m4_define([b4_rhs_value], 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 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
# on RHS. # on RHS.
m4_define([b4_rhs_location], 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. # We do want M4 expansion after # for CPP macros.
m4_changecom() m4_changecom()

View File

@@ -35,7 +35,7 @@ m4_define_default([b4_parser_class_name], [Parser])
# -------------------- # --------------------
# Expansion of $<TYPE>$. # Expansion of $<TYPE>$.
m4_define([b4_lhs_value], m4_define([b4_lhs_value],
[yyval[]m4_ifval([$1], [.$1])]) [(yyval[]m4_ifval([$1], [.$1]))])
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE]) # 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 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
# symbols on RHS. # symbols on RHS.
m4_define([b4_rhs_value], 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]) m4_define_default([b4_location_type], [Location])
@@ -51,7 +51,7 @@ m4_define_default([b4_location_type], [Location])
# ----------------- # -----------------
# Expansion of @$. # Expansion of @$.
m4_define([b4_lhs_location], m4_define([b4_lhs_location],
[yyloc]) [(yyloc)])
# b4_rhs_location(RULE-LENGTH, NUM) # 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 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
# on RHS. # on RHS.
m4_define([b4_rhs_location], m4_define([b4_rhs_location],
[yylocation_stack_@{m4_eval([$1 - $2])@}]) [(yylocation_stack_@{m4_eval([$1 - $2])@})])
# b4_parse_param_decl # b4_parse_param_decl

View File

@@ -93,7 +93,7 @@ m4_define([b4_int_type],
# -------------------- # --------------------
# Expansion of $<TYPE>$. # Expansion of $<TYPE>$.
m4_define([b4_lhs_value], m4_define([b4_lhs_value],
[yyval[]m4_ifval([$1], [.$1])]) [(yyval[]m4_ifval([$1], [.$1]))])
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE]) # 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 # Expansion of $<TYPE>NUM, where the current rule has RULE-LENGTH
# symbols on RHS. # symbols on RHS.
m4_define([b4_rhs_value], 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 @$. # Expansion of @$.
m4_define([b4_lhs_location], m4_define([b4_lhs_location],
[yyloc]) [(yyloc)])
# b4_rhs_location(RULE-LENGTH, NUM) # 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 # Expansion of @NUM, where the current rule has RULE-LENGTH symbols
# on RHS. # on RHS.
m4_define([b4_rhs_location], m4_define([b4_rhs_location],
[yylsp@{m4_eval([$2 - $1])@}]) [(yylsp@{m4_eval([$2 - $1])@})])