# action.
AT_DATA_GRAMMAR([[input.y]],
-[[%{
+[[%error-verbose
+%debug
+%{
# include <stdio.h>
# include <stdlib.h>
static void yyerror (const char *msg);
static int yylex (void);
-# define YYDEBUG 1
-# define YYERROR_VERBOSE 1
%}
%%
exp: { putchar ('0'); }
AT_SETUP([Exotic Dollars])
AT_DATA_GRAMMAR([[input.y]],
-[[%{
+[[%error-verbose
+%debug
+%{
# include <stdio.h>
# include <stdlib.h>
static void yyerror (const char *msg);
static int yylex (void);
-# define YYDEBUG 1
-# define YYERROR_VERBOSE 1
+# define USE(Var)
%}
%union
};
%type <val> a_1 a_2 a_5
- sum_of_the_five_previous_values
+ exp sum_of_the_five_previous_values
%%
exp: a_1 a_2 { $<val>$ = 3; } { $<val>$ = $<val>3 + 1; } a_5
}
]])
-AT_CHECK([bison -d -v -o input.c input.y])
+AT_CHECK([bison -d -v -o input.c input.y], 0, [],
+[input.y:30.6-34.5: warning: unused value: $1
+input.y:30.6-34.5: warning: unused value: $2
+input.y:30.6-34.5: warning: unused value: $5
+])
AT_COMPILE([input])
AT_PARSER_CHECK([./input], 0,
[[15
{
int ival;
}])
+AT_LALR1_CC_IF([%define "global_tokens_and_yystype"])
[
%{
]AT_LALR1_CC_IF([typedef yy::location YYLTYPE;
;
%%
/* Alias to ARGV[1]. */
-const char *yysource = 0;
+const char *source = 0;
static int
yylex (]AT_LEX_FORMALS[)
AT_LOC.last_line = AT_LOC.last_column = AT_LOC.first_line + 9;
])[
- if (yysource[c])
- printf ("sending: '%c'", yysource[c]);
+ if (source[c])
+ printf ("sending: '%c'", source[c]);
else
printf ("sending: EOF");
printf (" (%d@%d-%d)\n", c, RANGE (]AT_LOC[));
- return yysource[c];
+ return source[c];
}
]AT_LALR1_CC_IF(
int status;
yydebug = !!getenv ("YYDEBUG");
assert (argc == 2);
- yysource = argv[1];
+ source = argv[1];
status = yyparse ();
switch (status)
{
sending: EOF (3@30-39)
input (0@29-29): /* Nothing */
input (2@0-29): line (0@0-29) input (0@29-29)
+Freeing nterm input (2@0-29)
Successful parse.
]])
sending: EOF (3@30-39)
input (0@29-29): /* Nothing */
input (2@0-29): line (-1@0-29) input (0@29-29)
+Freeing nterm input (2@0-29)
Successful parse.
]])
sending: 'x' (19@190-199)
thing (19@190-199): 'x' (19@190-199)
sending: ')' (20@200-209)
-200-209: parser stack overflow
+200-209: memory exhausted
Freeing nterm thing (19@190-199)
Freeing nterm line (15@150-179)
Freeing nterm line (12@120-149)