# --------------------------------------------------
# This macro works around the impossibility to define macros
# inside macros, because issuing `[$1]' is not possible in M4 :(.
-# This sucks hard, GNU M4 should really provide M5 like $$1.
+# This sucks hard, GNU M4 should really provide M5-like $$1.
m4_define([_AT_BISON_OPTION_PUSHDEFS],
[m4_if([$1$2], $[1]$[2], [],
[m4_fatal([$0: Invalid arguments: $@])])dnl
[m4_bmatch([$3], [%define api\.prefix ".*"],
[m4_bregexp([$3], [%define api\.prefix "\([^""]*\)"], [\1])],
[yy])])
+m4_pushdef([AT_TOKEN_PREFIX],
+[m4_bmatch([$3], [%define api.tokens.prefix ".*"],
+ [m4_bregexp([$3], [%define api.tokens.prefix "\(.*\)"], [\1])])])
# yyerror receives the location if %location & %pure & (%glr or %parse-param).
m4_pushdef([AT_YYERROR_ARG_LOC_IF],
[AT_GLR_OR_PARAM_IF([AT_PURE_AND_LOC_IF([$1], [$2])],
- [$2])])
+ [$2])])
# yyerror always sees the locations (when activated), except if
# (yacc & pure & !param). FIXME: This is wrong. See the manual.
m4_pushdef([AT_YYERROR_SEES_LOC_IF],
[AT_LOCATION_IF([AT_YACC_IF([AT_PURE_IF([AT_PARAM_IF([$1], [$2])],
- [$1])],
- [$1])],
- [$2])])
+ [$1])],
+ [$1])],
+ [$2])])
# The interface is pure: either because %define api.pure, or because we
# are using the C++ parsers.
m4_pushdef([AT_PURE_LEX_IF],
[AT_PURE_IF([$1],
- [AT_SKEL_CC_IF([$1], [$2])])])
+ [AT_SKEL_CC_IF([$1], [$2])])])
AT_PURE_LEX_IF(
[m4_pushdef([AT_LOC], [(*llocp)])
m4_pushdef([AT_VAL], [(*lvalp)])
m4_pushdef([AT_LEX_FORMALS],
- [YYSTYPE *lvalp[]AT_LOCATION_IF([, YYLTYPE *llocp])])
+ [YYSTYPE *lvalp[]AT_LOCATION_IF([, YYLTYPE *llocp])])
m4_pushdef([AT_LEX_ARGS],
- [lvalp[]AT_LOCATION_IF([, llocp])])
+ [lvalp[]AT_LOCATION_IF([, llocp])])
m4_pushdef([AT_USE_LEX_ARGS],
- [(void) lvalp;AT_LOCATION_IF([(void) llocp])])
+ [(void) lvalp;AT_LOCATION_IF([(void) llocp])])
m4_pushdef([AT_LEX_PRE_FORMALS],
- [AT_LEX_FORMALS, ])
+ [AT_LEX_FORMALS, ])
m4_pushdef([AT_LEX_PRE_ARGS],
- [AT_LEX_ARGS, ])
+ [AT_LEX_ARGS, ])
],
[m4_pushdef([AT_LOC], [[(]AT_NAME_PREFIX[lloc)]])
m4_pushdef([AT_VAL], [[(]AT_NAME_PREFIX[lval)]])
[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
{
System.err.println (msg);
}]], [AT_SKEL_CC_IF([[void
-yy::parser::error (const yy::location &, std::string const &msg)
+yy::parser::error (]AT_LOCATION_IF([[const yy::location &, ]])[std::string const &msg)
{
std::cerr << msg << std::endl;
}]], [[#include <stdio.h>
# assume that we are linking too; this is a hack.
m4_define([AT_COMPILE],
[AT_CHECK([$CC $CFLAGS $CPPFLAGS m4_bmatch([$1], [[.]], [], [$LDFLAGS ])-o $1 m4_default([$2], [$1.c])[]m4_bmatch([$1], [[.]], [], [ $LIBS])],
- 0, [ignore], [ignore])])
+ 0, [ignore], [ignore])])
# AT_COMPILE_CXX(OUTPUT, [SOURCES = OUTPUT.cc])
# --------------------------------------------
[AT_KEYWORDS(c++)
AT_CHECK([$BISON_CXX_WORKS], 0, ignore, ignore)
AT_CHECK([$CXX $CXXFLAGS $CPPFLAGS m4_bmatch([$1], [[.]], [], [$LDFLAGS ])-o $1 m4_default([$2], [$1.cc])[]m4_bmatch([$1], [[.]], [], [ $LIBS])],
- 0, [ignore], [ignore])])
+ 0, [ignore], [ignore])])
# AT_JAVA_COMPILE(SOURCES)
# ------------------------
AT_BISON_CHECK([-o $1.c $1.y])
AT_COMPILE([$1],
m4_join([ ],
- [$1.c],
+ [$1.c],
m4_ifval($2, [[$1-$2.c]]),
m4_ifval($3, [[$1-$3.c]])))
])