mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 20:33:03 +00:00
support $<tag>$ in printers and destructors
* src/scan-code.l (SC_SYMBOL_ACTION): Accept $<tag>$, not just $$. * data/c.m4 (b4_dollar_dollar_): New. (b4_symbol_actions): Let b4_dollar_dollar use b4_dollar_dollar_. * NEWS, doc/bison.texi: Document it. * tests/actions.at: Check this for C and C++.
This commit is contained in:
17
data/c.m4
17
data/c.m4
@@ -417,13 +417,28 @@ m4_define([b4_case],
|
||||
$2
|
||||
break;])
|
||||
|
||||
# b4_dollar_dollar_(NAME, FIELD, DEFAULT-FIELD)
|
||||
# ---------------------------------------------
|
||||
# If FIELD (or DEFAULT-FIELD) is non-null, read it in pointer NAME,
|
||||
# otherwise just dereference.
|
||||
m4_define([b4_dollar_dollar_],
|
||||
[m4_if([$2], [[]],
|
||||
[m4_ifval([$3], [($1->$3)],
|
||||
[(*$1)])],
|
||||
[($1->$2)])])
|
||||
|
||||
|
||||
# b4_symbol_actions(FILENAME, LINENO,
|
||||
# SYMBOL-TAG, SYMBOL-NUM,
|
||||
# SYMBOL-ACTION, SYMBOL-TYPENAME)
|
||||
# -------------------------------------------------
|
||||
# Issue the code for a symbol action (e.g., %printer).
|
||||
#
|
||||
# Define b4_dollar_dollar([TYPE-NAME]), and b4_at_dollar, which are
|
||||
# invoked where $<TYPE-NAME>$ and @$ were specified by the user.
|
||||
m4_define([b4_symbol_actions],
|
||||
[m4_pushdef([b4_dollar_dollar],
|
||||
[m4_ifval([$6], [(yyvaluep->$6)], [(*yyvaluep)])])dnl
|
||||
[b4_dollar_dollar_([yyvaluep], m4_dquote($][1), [$6])])dnl
|
||||
m4_pushdef([b4_at_dollar], [(*yylocationp)])dnl
|
||||
case $4: /* $3 */
|
||||
b4_syncline([$2], [$1])
|
||||
|
||||
Reference in New Issue
Block a user