;
%%
]AT_YYERROR_DEFINE[
-]AT_YYLEX_DEFINE(123456789)[
+]AT_YYLEX_DEFINE(["123456789"])[
int
main (void)
{
%%
]AT_YYERROR_DEFINE[
-]AT_YYLEX_DEFINE([])[
+]AT_YYLEX_DEFINE[
int
main (void)
{
%%
]AT_YYERROR_DEFINE[
-]AT_YYLEX_DEFINE()[
+]AT_YYLEX_DEFINE[
int
main (void)
{
%%
]AT_YYERROR_DEFINE[
-]AT_YYLEX_DEFINE([abcd], [[yylval = res]])[
+]AT_YYLEX_DEFINE(["abcd"], [[yylval = res]])[
int
main (void)
%%
]AT_YYERROR_DEFINE[
-]AT_YYLEX_DEFINE([abcdef])[
+]AT_YYLEX_DEFINE(["abcdef"])[
int
main (void)
%%
]AT_YYERROR_DEFINE[
-]AT_YYLEX_DEFINE([abd], [yylval = res])[
+]AT_YYLEX_DEFINE(["abd"], [yylval = res])[
int
main (void)
{
%%
]AT_YYERROR_DEFINE[
-]AT_YYLEX_DEFINE([])[
+]AT_YYLEX_DEFINE[
int
main (void)
{
%%
]AT_YYERROR_DEFINE[
-]AT_YYLEX_DEFINE([])[
+]AT_YYLEX_DEFINE[
int
main (void)
{
%%
]AT_YYERROR_DEFINE[
-]AT_YYLEX_DEFINE([a])[
+]AT_YYLEX_DEFINE(["a"])[
int
main (void)
{
%%
]AT_YYERROR_DEFINE[
-]AT_YYLEX_DEFINE([aaa])[
+]AT_YYLEX_DEFINE(["aaa"])[
int
main (void)
%%
]AT_YYERROR_DEFINE[
-]AT_YYLEX_DEFINE([a])[
+]AT_YYLEX_DEFINE(["a"])[
int
main (void)
;
%%
-]AT_YYLEX_DEFINE(a)[
+]AT_YYLEX_DEFINE(["a"])[
]AT_YYERROR_DEFINE[
int
main (void)
%%
]AT_YYERROR_DEFINE[
-]AT_YYLEX_DEFINE(a)[
+]AT_YYLEX_DEFINE(["a"])[
int
main (void)
{
%%
]AT_YYERROR_DEFINE[
-]AT_YYLEX_DEFINE()[
+]AT_YYLEX_DEFINE[
int
main (void)
%%
]AT_YYERROR_DEFINE[
-]AT_YYLEX_DEFINE([a])[
+]AT_YYLEX_DEFINE(["a"])[
int
main (void)
%%
]AT_YYERROR_DEFINE[
-]AT_YYLEX_DEFINE()[
+]AT_YYLEX_DEFINE[
int
main (void)
%%
]AT_YYERROR_DEFINE[
-]AT_YYLEX_DEFINE()[
+]AT_YYLEX_DEFINE[
int
main (void)
{
b: 'b';
d: /* nada. */;
%%
-]AT_YYLEX_DEFINE([abc])[
+]AT_YYLEX_DEFINE(["abc"])[
]AT_YYERROR_DEFINE[
int
main (void)
# 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
])
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[;
%%
]AT_YYERROR_DEFINE[
-]m4_if([$1], [[both]], [AT_YYLEX_DEFINE([])])[
+]m4_if([$1], [[both]], [AT_YYLEX_DEFINE])[
int
main (void)
/* Induce two syntax error messages (which requires full error
recovery by shifting 3 tokens) in order to detect any loss of the
reallocated buffer. */
-]AT_YYLEX_DEFINE([abc])[
+]AT_YYLEX_DEFINE(["abc"])[
int
main (void)
{
]AT_YYERROR_DEFINE[
/* Induce two syntax error messages (which requires full error
recovery by shifting 3 tokens). */
-]AT_YYLEX_DEFINE([abc])[
+]AT_YYLEX_DEFINE(["abc"])[
int
main (void)
{
%%
]AT_YYERROR_DEFINE[
-]AT_YYLEX_DEFINE([$1])[
+]AT_YYLEX_DEFINE(["$1"])[
int
main (void)
{