Parameterize the extraction of semantic values.

To make future changes easier, no longer rely on ".TYPE" being the
way to get a semantic value.

	* data/c.m4 (b4_symbol_value): New.
	Use it.
	* data/c++.m4, data/yacc.c: Use it.
	* data/glr.c: Use b4_symbol_value.
	(b4_rhs_data): New.
	Use it.
This commit is contained in:
Akim Demaille
2008-10-21 17:20:22 -05:00
parent 91ba8a55b1
commit 1fa5d8bbf9
5 changed files with 45 additions and 8 deletions

View File

@@ -102,7 +102,7 @@ m4_map_sep([ b4_token_enum], [,
# --------------------
# Expansion of $<TYPE>$.
m4_define([b4_lhs_value],
[(yyval[]m4_ifval([$1], [.$1]))])
[b4_symbol_value([yyval], [$1])])
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
@@ -110,7 +110,8 @@ 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_@{($1) - ($2)@}m4_ifval([$3], [.$3]))])
[b4_symbol_value([yysemantic_stack_@{($1) - ($2)@}], [$3])])
# b4_lhs_location()
# -----------------