]> git.saurik.com Git - bison.git/blobdiff - tests/local.at
api.prefix.
[bison.git] / tests / local.at
index 4de2f7b365b57d3d2be7b5b44169635b53fe7bdc..7a981c6d01723416d81c73d758b509e9f92d61e4 100644 (file)
@@ -90,7 +90,8 @@ m4_popdef([AT_LOC_LAST_COLUMN])])
 # AT_BISON_OPTION_PUSHDEFS([BISON-OPTIONS])
 # -----------------------------------------
 m4_define([AT_BISON_OPTION_PUSHDEFS],
-[_AT_BISON_OPTION_PUSHDEFS($[1], $[2], [$1])])
+[m4_divert_text([KILL],
+                [_AT_BISON_OPTION_PUSHDEFS($[1], $[2], [$1])])])
 
 
 # _AT_BISON_OPTION_PUSHDEFS($1, $2, [BISON-OPTIONS])
@@ -144,6 +145,8 @@ m4_pushdef([AT_API_prefix],
 [m4_bmatch([$3], [%define api\.prefix ".*"],
            [m4_bregexp([$3], [%define api\.prefix "\([^""]*\)"], [\1])],
            [yy])])
+m4_pushdef([AT_API_PREFIX],
+[m4_toupper(AT_API_prefix)])
 # 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])],
@@ -164,10 +167,10 @@ m4_pushdef([AT_PURE_LEX_IF],
 
 m4_pushdef([AT_YYSTYPE],
 [AT_SKEL_CC_IF([AT_NAME_PREFIX[::parser::semantic_type]],
-               [[YYSTYPE]])])
+               [AT_API_PREFIX[STYPE]])])
 m4_pushdef([AT_YYLTYPE],
 [AT_SKEL_CC_IF([AT_NAME_PREFIX[::parser::location_type]],
-               [[YYLTYPE]])])
+               [AT_API_PREFIX[LTYPE]])])
 
 
 AT_PURE_LEX_IF(
@@ -207,6 +210,7 @@ AT_SKEL_CC_IF(
 # AT_BISON_OPTION_POPDEFS
 # -----------------------
 m4_define([AT_BISON_OPTION_POPDEFS],
+[m4_divert_text([KILL],
 [m4_popdef([AT_YYLEX_PRE_ARGS])
 m4_popdef([AT_YYLEX_PRE_FORMALS])
 m4_popdef([AT_USE_LEX_ARGS])
@@ -219,6 +223,7 @@ m4_popdef([AT_LOC])
 m4_popdef([AT_PURE_LEX_IF])
 m4_popdef([AT_YYERROR_SEES_LOC_IF])
 m4_popdef([AT_YYERROR_ARG_LOC_IF])
+m4_popdef([AT_API_PREFIX])
 m4_popdef([AT_API_prefix])
 m4_popdef([AT_NAME_PREFIX])
 m4_popdef([AT_GLR_OR_PARAM_IF])
@@ -235,7 +240,7 @@ m4_popdef([AT_SKEL_JAVA_IF])
 m4_popdef([AT_GLR_CC_IF])
 m4_popdef([AT_LALR1_CC_IF])
 m4_popdef([AT_DEFINES_IF])
-AT_LOC_POPDEF
+AT_LOC_POPDEF])dnl
 ])# AT_BISON_OPTION_POPDEFS
 
 
@@ -289,8 +294,11 @@ $2])
 # AT_YYLEX_PROTOTYPE
 # AT_YYLEX_DECLARE_EXTERN
 # AT_YYLEX_DECLARE
-# AT_YYLEX_DEFINE(INPUT-STRING, [ACTION])
-# ---------------------------------------
+# AT_YYLEX_DEFINE([INPUT], [ACTION])
+# ----------------------------------
+# INPUT can be empty, or in double quotes, or a list (in braces).
+# ACTION may compute yylval for instance, using "res" as token type,
+# and "toknum" as the number of calls to yylex (starting at 0).
 m4_define([AT_YYLEX_PROTOTYPE],
 [int AT_NAME_PREFIX[]lex (]AT_YYLEX_FORMALS[)[]dnl
 ])
@@ -308,7 +316,9 @@ m4_define([AT_YYLEX_DEFINE],
 static
 ]AT_YYLEX_PROTOTYPE[
 {
-  static char const input[] = "$1";
+  ]m4_bmatch([$1], [^\(".*"\)?$],
+             [[static char const input[] = ]m4_default([$1], [""])],
+             [[static int const input[] = ]$1])[;
   static size_t toknum = 0;
   int res;
   ]AT_USE_LEX_ARGS[;