%{
#include <stdio.h>
#include <stdlib.h>
-
+#define MAX $max
]AT_YYLEX_DECLARE[
]AT_YYERROR_DECLARE[
%}
};
print ";\n";
-print <<EOF;
+print <<\EOF;
%%
+]AT_YYERROR_DEFINE[
static int
yylex (void)
{
static int inner = 1;
static int outer = 0;
- if (outer > $max)
+ if (outer > MAX)
return 0;
else if (inner > outer)
{
}
return inner++;
}
-
-static void
-yyerror (const char *msg)
-{
- fprintf (stderr, "%s\\n", msg);
-}
-
int
main (void)
{
%{
#include <stdio.h>
#include <stdlib.h>
-
+#define MAX $max
]AT_YYLEX_DECLARE[
]AT_YYERROR_DECLARE[
%}
(map { "\"$_\"" } (1 .. $max)), ";"),
"\n";
-print <<EOF;
+print <<\EOF;
%%
+]AT_YYERROR_DEFINE[
static int
yylex (void)
{
static int counter = 1;
- if (counter <= $max)
+ if (counter <= MAX)
return counter++;
- if (counter++ != $max + 1)
+ if (counter++ != MAX + 1)
abort ();
return 0;
}
-static void
-yyerror (const char *msg)
-{
- fprintf (stderr, "%s\\n", msg);
-}
-
int
main (void)
{
# include <stdio.h>
# include <stdlib.h>
# include <assert.h>
-
+# define MAX $max
]AT_YYLEX_DECLARE[
]AT_YYERROR_DECLARE[
%}
print "n$count: token { \$\$ = $count; };\n";
};
-print <<EOF;
+print <<\EOF;
%%
+]AT_YYERROR_DEFINE[
static int
yylex (void)
{
static int return_token = 1;
static int counter = 1;
- if (counter > $max)
+ if (counter > MAX)
{
- if (counter++ != $max + 1)
+ if (counter++ != MAX + 1)
abort ();
return 0;
}
return counter++;
}
-static void
-yyerror (const char *msg)
-{
- fprintf (stderr, "%s\\n", msg);
-}
-
int
main (void)
{