mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 08:43:03 +00:00
Use b4_subtract where possible.
* data/lalr1.cc (b4_subtract): Move to... * data/bison.m4: here. * data/glr.c (b4_rhs_data): Use it. * data/yacc.c (b4_rhs_value, b4_rhs_location): Use it.
This commit is contained in:
@@ -1,3 +1,11 @@
|
|||||||
|
2008-11-18 Akim Demaille <demaille@gostai.com>
|
||||||
|
|
||||||
|
Use b4_subtract where possible.
|
||||||
|
* data/lalr1.cc (b4_subtract): Move to...
|
||||||
|
* data/bison.m4: here.
|
||||||
|
* data/glr.c (b4_rhs_data): Use it.
|
||||||
|
* data/yacc.c (b4_rhs_value, b4_rhs_location): Use it.
|
||||||
|
|
||||||
2008-11-18 Akim Demaille <demaille@gostai.com>
|
2008-11-18 Akim Demaille <demaille@gostai.com>
|
||||||
|
|
||||||
Remove incorrect mode specification.
|
Remove incorrect mode specification.
|
||||||
|
|||||||
@@ -212,6 +212,15 @@ m4_define([b4_ints_in],
|
|||||||
[m4_eval([$3 <= $1 && $1 <= $4 && $3 <= $2 && $2 <= $4])])
|
[m4_eval([$3 <= $1 && $1 <= $4 && $3 <= $2 && $2 <= $4])])
|
||||||
|
|
||||||
|
|
||||||
|
# b4_subtract(LHS, RHS)
|
||||||
|
# ---------------------
|
||||||
|
# Evaluate LHS - RHS if they are integer literals, otherwise expand
|
||||||
|
# to (LHS) - (RHS).
|
||||||
|
m4_define([b4_subtract],
|
||||||
|
[m4_bmatch([$1$2], [^[0123456789]*$],
|
||||||
|
[m4_eval([$1 - $2])],
|
||||||
|
[($1) - ($2)])])
|
||||||
|
|
||||||
|
|
||||||
## ------------------ ##
|
## ------------------ ##
|
||||||
## Decoding options. ##
|
## Decoding options. ##
|
||||||
@@ -257,11 +266,6 @@ b4_define_flag_if([nondeterministic]) # Whether conflicts should be handled.
|
|||||||
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
b4_define_flag_if([yacc]) # Whether POSIX Yacc is emulated.
|
||||||
|
|
||||||
|
|
||||||
## ------------------------- ##
|
|
||||||
## Assigning token numbers. ##
|
|
||||||
## ------------------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
## ----------- ##
|
## ----------- ##
|
||||||
## Synclines. ##
|
## Synclines. ##
|
||||||
## ----------- ##
|
## ----------- ##
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ m4_define([b4_lhs_value],
|
|||||||
# Expand to the semantic stack place that contains value and location
|
# Expand to the semantic stack place that contains value and location
|
||||||
# of symbol number NUM in a rule of length RULE-LENGTH.
|
# of symbol number NUM in a rule of length RULE-LENGTH.
|
||||||
m4_define([b4_rhs_data],
|
m4_define([b4_rhs_data],
|
||||||
[((yyGLRStackItem const *)yyvsp)@{YYFILL (($2) - ($1))@}.yystate])
|
[((yyGLRStackItem const *)yyvsp)@{YYFILL (b4_subtract([$2], [$1]))@}.yystate])
|
||||||
|
|
||||||
|
|
||||||
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
# b4_rhs_value(RULE-LENGTH, NUM, [TYPE])
|
||||||
|
|||||||
@@ -18,16 +18,6 @@
|
|||||||
|
|
||||||
m4_include(b4_pkgdatadir/[c++.m4])
|
m4_include(b4_pkgdatadir/[c++.m4])
|
||||||
|
|
||||||
# b4_subtract(LHS, RHS)
|
|
||||||
# ---------------------
|
|
||||||
# Evaluate LHS - RHS if they are integer literals, otherwise expand
|
|
||||||
# to (LHS) - (RHS).
|
|
||||||
m4_define([b4_subtract],
|
|
||||||
[m4_bmatch([$1$2], [^[0123456789]*$],
|
|
||||||
[m4_eval([$1 - $2])],
|
|
||||||
[($1) - ($2)])])
|
|
||||||
|
|
||||||
|
|
||||||
# b4_args(ARG1, ...)
|
# b4_args(ARG1, ...)
|
||||||
# _b4_args(ARG1, ...)
|
# _b4_args(ARG1, ...)
|
||||||
# -------------------
|
# -------------------
|
||||||
|
|||||||
@@ -124,7 +124,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],
|
||||||
[b4_symbol_value([yyvsp@{($2) - ($1)@}], [$3])])
|
[b4_symbol_value([yyvsp@{b4_subtract([$2], [$1])@}], [$3])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -144,7 +144,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@{($2) - ($1)@})])
|
[(yylsp@{b4_subtract([$2], [$1])@})])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user