d, java: compute static subtractions

* data/d.m4, data/java.m4: Use b4_subtract where appropriate.
This commit is contained in:
Akim Demaille
2018-12-04 21:02:57 +01:00
parent f15382f7d7
commit cfd682f46d
2 changed files with 4 additions and 4 deletions

View File

@@ -219,7 +219,7 @@ m4_define([b4_lhs_value],
# In this simple implementation, %token and %type have class names
# between the angle brackets.
m4_define([b4_rhs_value],
[b4_symbol_value([(yystack.valueAt ($1-($2)))], [$3], [$4])])
[b4_symbol_value([(yystack.valueAt (b4_subtract([$1], [$2])))], [$3], [$4])])
# b4_lhs_location()
@@ -234,7 +234,7 @@ m4_define([b4_lhs_location],
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
# on RHS.
m4_define([b4_rhs_location],
[yystack.locationAt ($1-($2))])
[yystack.locationAt ([$1], [$2])])
# b4_lex_param

View File

@@ -242,7 +242,7 @@ m4_define([b4_lhs_value], [yyval])
# -----------------------------
# See README.
m4_define([b4_rhs_data],
[yystack.valueAt ($1-($2))])
[yystack.valueAt (b4_subtract($@))])
# b4_rhs_value(RULE-LENGTH, POS, SYMBOL-NUM, [TYPE])
# --------------------------------------------------
@@ -266,7 +266,7 @@ m4_define([b4_lhs_location],
# Expansion of @POS, where the current rule has RULE-LENGTH symbols
# on RHS.
m4_define([b4_rhs_location],
[yystack.locationAt ($1-($2))])
[yystack.locationAt (b4_subtract($@))])
# b4_lex_param