tests: calc: simplify location management.

* tests/local.at (AT_LOC_PUSHDEF, AT_LOC_POPDEF): New.
	(_AT_BISON_OPTION_PUSHDEFS, AT_BISON_OPTION_POPDEFS): Use them to
	define the appropriate AT_LOC accessors.
	* tests/calc.at: Use AT_LOC accessors.
This commit is contained in:
Akim Demaille
2010-04-13 23:04:03 +02:00
parent 24bb8c8c25
commit 4f756f887b
3 changed files with 53 additions and 25 deletions

View File

@@ -40,6 +40,25 @@ printf "$count\n";' $1], [0], [$3
## Macros decoding Bison options. ##
## ------------------------------- ##
# AT_LOC_PUSHDEF(FIRST-LINE, FIRST-COLUMN, LAST-LINE, LAST-COLUMN)
# ----------------------------------------------------------------
# Pushdef AT_LOC_(FIRST|LAST)_(LINE|COLUMN).
m4_define([AT_LOC_PUSHDEF],
[m4_pushdef([AT_LOC_FIRST_LINE], [AT_LOC.$1])
m4_pushdef([AT_LOC_FIRST_COLUMN], [AT_LOC.$2])
m4_pushdef([AT_LOC_LAST_LINE], [AT_LOC.$3])
m4_pushdef([AT_LOC_LAST_COLUMN], [AT_LOC.$4])])
# AT_LOC_POPDEF
# -------------
# Popdef AT_LOC_(FIRST|LAST)_(LINE|COL).
m4_define([AT_LOC_POPDEF],
[m4_popdef([AT_LOC_FIRST_LINE])
m4_popdef([AT_LOC_FIRST_COLUMN])
m4_popdef([AT_LOC_LAST_LINE])
m4_popdef([AT_LOC_LAST_COLUMN])])
# AT_BISON_OPTION_PUSHDEFS([BISON-OPTIONS])
# -----------------------------------------
@@ -131,6 +150,16 @@ AT_PURE_LEX_IF(
m4_pushdef([AT_LEX_PRE_FORMALS], [])
m4_pushdef([AT_LEX_PRE_ARGS], [])
])
# Handle the different types of location components.
AT_SKEL_CC_IF(
[AT_LOCATION_TYPE_IF(
[AT_LOC_PUSHDEF([begin.l], [begin.c], [end.l], [end.c])],
[AT_LOC_PUSHDEF([begin.line], [begin.column], [end.line], [end.column])])],
[AT_LOC_PUSHDEF([first_line], [first_column], [last_line], [last_column])])
AT_GLR_IF([AT_KEYWORDS([glr])])
])# _AT_BISON_OPTION_PUSHDEFS
@@ -161,6 +190,7 @@ m4_popdef([AT_SKEL_CC_IF])
m4_popdef([AT_GLR_CC_IF])
m4_popdef([AT_LALR1_CC_IF])
m4_popdef([AT_DEFINES_IF])
AT_LOC_POPDEF
])# AT_BISON_OPTION_POPDEFS