mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
* src/reader.c (copy_at, copy_dollarm parse_braces, parse_action)
(parse_guard): Rename the formal argument `stack_offset' as `rule_length', which is more readable. Adjust callers. (copy_at, copy_dollar): Instead of outputting the hard coded values of $$, $n and so forth, output invocation to b4_lhs_value, b4_lhs_location, b4_rhs_value, and b4_rhs_location. * data/bison.simple, data/bison.c++ (b4_lhs_value) (b4_lhs_location, b4_rhs_value, and b4_rhs_location: New.
This commit is contained in:
@@ -20,6 +20,36 @@ m4_define([b4_uint_type],
|
||||
[m4_fatal([no unsigned int type for $1])])])
|
||||
|
||||
|
||||
# b4_lhs_value([TYPE])
|
||||
# --------------------
|
||||
# Expansion of $<TYPE>$.
|
||||
m4_define([b4_lhs_value],
|
||||
[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])])
|
||||
|
||||
|
||||
# b4_lhs_location()
|
||||
# -----------------
|
||||
# Expansion of @$.
|
||||
m4_define([b4_lhs_location],
|
||||
[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])@:>@])
|
||||
|
||||
|
||||
# b4_token_defines(TOKEN-NAME, TOKEN-NUMBER)
|
||||
# ------------------------------------------
|
||||
# Output the definition of this token as #define.
|
||||
|
||||
@@ -20,6 +20,36 @@ m4_define([b4_uint_type],
|
||||
[m4_fatal([no unsigned int type for $1])])])
|
||||
|
||||
|
||||
# b4_lhs_value([TYPE])
|
||||
# --------------------
|
||||
# Expansion of $<TYPE>$.
|
||||
m4_define([b4_lhs_value],
|
||||
[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])])
|
||||
|
||||
|
||||
# b4_lhs_location()
|
||||
# -----------------
|
||||
# Expansion of @$.
|
||||
m4_define([b4_lhs_location],
|
||||
[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])@:>@])
|
||||
|
||||
|
||||
m4_define_default([b4_input_suffix], [.y])
|
||||
|
||||
m4_define_default([b4_output_parser_suffix],
|
||||
|
||||
Reference in New Issue
Block a user