* tests/actions.at, tests/input.at, tests/reduce.at,
* tests/regression.at:
here.
%%
]AT_YYERROR_DEFINE[
]AT_YYLEX_DEFINE[
%%
]AT_YYERROR_DEFINE[
]AT_YYLEX_DEFINE[
// that has set yychar might not always return normally. Instead,
// skeletons must translate before every use of yytoken.
start: 'a' accept { USE($1); } ;
// that has set yychar might not always return normally. Instead,
// skeletons must translate before every use of yytoken.
start: 'a' accept { USE($1); } ;
assert (yychar == YYEMPTY);
yychar = 'b';
YYACCEPT;
assert (yychar == YYEMPTY);
yychar = 'b';
YYACCEPT;
-exp: { $$ = $1 ; };
-exp: { @$ = @1 ; };
+exp: %empty { $$ = $1 ; };
+exp: %empty { @$ = @1 ; };
]])
AT_BISON_CHECK([-fcaret input.y], [1], [],
]])
AT_BISON_CHECK([-fcaret input.y], [1], [],
-[[input.y:2.13-14: error: integer out of range: '$1'
- exp: { $$ = $1 ; };
- ^^
-input.y:3.13-14: error: integer out of range: '@1'
- exp: { @$ = @1 ; };
- ^^
+[[input.y:2.20-21: error: integer out of range: '$1'
+ exp: %empty { $$ = $1 ; };
+ ^^
+input.y:3.20-21: error: integer out of range: '@1'
+ exp: %empty { @$ = @1 ; };
+ ^^
%%
exp: foo { $$; } foo { $2; } foo
| foo
%%
exp: foo { $$; } foo { $2; } foo
| foo
input.y:6.6-8: warning: type clash on default action: <bar> != <> [-Wother]
| foo
^^^
input.y:6.6-8: warning: type clash on default action: <bar> != <> [-Wother]
| foo
^^^
-input.y:7.5: warning: empty rule for typed nonterminal, and no action [-Wother]
- | /* empty. */
- ^
+input.y:7.6-11: warning: empty rule for typed nonterminal, and no action [-Wother]
+ | %empty
+ ^^^^^^
;
a: INT | INT { } INT { } INT { };
;
a: INT | INT { } INT { } INT { };
c: INT | INT { $]1[; } INT { $<integer>2; } INT { $<integer>4; };
d: INT | INT { } INT { $]1[; } INT { $<integer>2; };
e: INT | INT { } INT { } INT { $]1[; };
c: INT | INT { $]1[; } INT { $<integer>2; } INT { $<integer>4; };
d: INT | INT { } INT { $]1[; } INT { $<integer>2; };
e: INT | INT { } INT { } INT { $]1[; };
input.y:11.26-28: warning: unused value: $][5 [-Wother]
a: INT | INT { } INT { } INT { };
^^^
input.y:11.26-28: warning: unused value: $][5 [-Wother]
a: INT | INT { } INT { } INT { };
^^^
-input.y:12.9: warning: empty rule for typed nonterminal, and no action [-Wother]
- b: INT | /* empty */;
- ^
+input.y:12.10-15: warning: empty rule for typed nonterminal, and no action [-Wother]
+ b: INT | %empty;
+ ^^^^^^
]]m4_ifval($2, [[[input.y:13.14-20: warning: unset value: $][$ [-Wmidrule-values]
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
^^^^^^^
]]m4_ifval($2, [[[input.y:13.14-20: warning: unset value: $][$ [-Wmidrule-values]
c: INT | INT { $][1; } INT { $<integer>2; } INT { $<integer>4; };
^^^^^^^
%destructor { destroy ($$); } <*>;
%printer { print ($$); } <*>;
%destructor { destroy ($$); } <*>;
%printer { print ($$); } <*>;
%destructor { destroy ($$); } <field2> <field1>;
%printer { print ($$); } <field2> <field1>;
%destructor { destroy ($$); } <field2> <field1>;
%printer { print ($$); } <field2> <field1>;
two: '\x000000000000000000000000000000000000000000000000000000000000000000002';
oline: '@' 'o' 'l' 'i' 'n' 'e' '@' '_' '_' 'o' 'l' 'i' 'n' 'e' '_' '_';
two: '\x000000000000000000000000000000000000000000000000000000000000000000002';
oline: '@' 'o' 'l' 'i' 'n' 'e' '@' '_' '_' 'o' 'l' 'i' 'n' 'e' '_' '_';
-output.or.oline.opt: ;|oline;;|output;;;
+output.or.oline.opt: %empty;|oline;;|output;;;
output: '#' 'o' 'u' 't' 'p' 'u' 't' ' ';
%%
/* Exercise M4 quoting: '@:>@@:>@', @<:@, 2. */
output: '#' 'o' 'u' 't' 'p' 'u' 't' ' ';
%%
/* Exercise M4 quoting: '@:>@@:>@', @<:@, 2. */
AT_DATA_GRAMMAR([input.y],
[[%require "$1";
%%
AT_DATA_GRAMMAR([input.y],
[[%require "$1";
%%
-empty_file: /* empty */;
]])
AT_BISON_CHECK([-o input.c input.y], $2, [], ignore)
AT_CLEANUP
]])
AT_BISON_CHECK([-o input.c input.y], $2, [], ignore)
AT_CLEANUP
// Used to report a syntax error because it didn't see any kind of symbol
// identifier.
// Used to report a syntax error because it didn't see any kind of symbol
// identifier.
start: false_start ;
%start start;
]])
start: false_start ;
%start start;
]])
AT_DATA([input.y],
[[%%
start: PREC %prec PREC ;
AT_DATA([input.y],
[[%%
start: PREC %prec PREC ;
]])
AT_BISON_CHECK([input.y], [1], [],
]])
AT_BISON_CHECK([input.y], [1], [],
%code bad {}
%code format {}
%%
%code bad {}
%code format {}
%%
]])
AT_BISON_CHECK([[input-c.y]], [[1]], [],
[[input-c.y:1.7: error: %code qualifier 'q' is not used
]])
AT_BISON_CHECK([[input-c.y]], [[1]], [],
[[input-c.y:1.7: error: %code qualifier 'q' is not used
%code bad {}
%code bad {}
%%
%code bad {}
%code bad {}
%%
]])
AT_BISON_CHECK([[input-c-glr.y]], [[1]], [],
[[input-c-glr.y:1.7: error: %code qualifier 'q' is not used
]])
AT_BISON_CHECK([[input-c-glr.y]], [[1]], [],
[[input-c-glr.y:1.7: error: %code qualifier 'q' is not used
%code bad {}
%code q {}
%%
%code bad {}
%code q {}
%%
]])
AT_BISON_CHECK([[input-c++.y]], [[1]], [],
[[input-c++.y:1.7: error: %code qualifier 'q' is not used
]])
AT_BISON_CHECK([[input-c++.y]], [[1]], [],
[[input-c++.y:1.7: error: %code qualifier 'q' is not used
]])
AT_BISON_CHECK([[input-c++-glr.y]], [[1]], [],
[[input-c++-glr.y:1.7-9: error: %code qualifier 'bad' is not used
]])
AT_BISON_CHECK([[input-c++-glr.y]], [[1]], [],
[[input-c++-glr.y:1.7-9: error: %code qualifier 'bad' is not used
]])
AT_BISON_CHECK([[special-char-@@.y]], [[1]], [],
[[special-char-@@.y:1.7-9: error: %code qualifier 'bad' is not used
]])
AT_BISON_CHECK([[special-char-@@.y]], [[1]], [],
[[special-char-@@.y:1.7-9: error: %code qualifier 'bad' is not used
]])
AT_BISON_CHECK([[special-char-@:>@.y]], [[1]], [],
[[special-char-@:>@.y:1.7-9: error: %code qualifier 'bad' is not used
]])
AT_BISON_CHECK([[special-char-@:>@.y]], [[1]], [],
[[special-char-@:>@.y:1.7-9: error: %code qualifier 'bad' is not used
%define special1 "@:>@"
%define special2 "@<:@"
%%
%define special1 "@:>@"
%define special2 "@<:@"
%%
]])
AT_BISON_CHECK([[input-redefined.y]], [[1]], [],
]])
AT_BISON_CHECK([[input-redefined.y]], [[1]], [],
AT_DATA([input-unused.y],
[[%define var "value"
%%
AT_DATA([input-unused.y],
[[%define var "value"
%%
]])
AT_BISON_CHECK([[input-unused.y]], [[1]], [],
]])
AT_BISON_CHECK([[input-unused.y]], [[1]], [],
AT_DATA([[input.y]],
[[%define var-dfg "gram"
%%
AT_DATA([[input.y]],
[[%define var-dfg "gram"
%%
]])
AT_BISON_CHECK([[-Dvar-dd=cmd-d1 -Dvar-dd=cmd-d2 \
-Fvar-ff=cmd-f1 -Fvar-ff=cmd-f2 \
]])
AT_BISON_CHECK([[-Dvar-dd=cmd-d1 -Dvar-dd=cmd-d2 \
-Fvar-ff=cmd-f1 -Fvar-ff=cmd-f2 \
AT_DATA([[input-dg.y]],
[[%define var "gram"
%%
AT_DATA([[input-dg.y]],
[[%define var "gram"
%%
]])
AT_BISON_CHECK([[-Dvar=cmd-d input-dg.y]], [[1]], [],
[[input-dg.y:1.9-11: error: %define variable 'var' redefined
]])
AT_BISON_CHECK([[-Dvar=cmd-d input-dg.y]], [[1]], [],
[[input-dg.y:1.9-11: error: %define variable 'var' redefined
AT_DATA([[input-dg.y]],
[[%define var "gram"
%%
AT_DATA([[input-dg.y]],
[[%define var "gram"
%%
]])
AT_BISON_CHECK([[-fcaret -Dvar=cmd-d input-dg.y]], [[1]], [],
[[input-dg.y:1.9-11: error: %define variable 'var' redefined
]])
AT_BISON_CHECK([[-fcaret -Dvar=cmd-d input-dg.y]], [[1]], [],
[[input-dg.y:1.9-11: error: %define variable 'var' redefined
AT_DATA([[input-unused.y]],
[[%%
AT_DATA([[input-unused.y]],
[[%%
]])
AT_BISON_CHECK([[-Dunused-d -Funused-f input-unused.y]], [[1]], [],
[[<command line>:2: error: %define variable 'unused-d' is not used
]])
AT_BISON_CHECK([[-Dunused-d -Funused-f input-unused.y]], [[1]], [],
[[<command line>:2: error: %define variable 'unused-d' is not used
%define public "maybe"
%define parser_class_name "Input"
%%
%define public "maybe"
%define parser_class_name "Input"
%%
]])
AT_BISON_CHECK([[Input.y]], [1], [],
]])
AT_BISON_CHECK([[Input.y]], [1], [],
AT_DATA([[input.y]],
[[%define lr.default-reduction bogus
%%
AT_DATA([[input.y]],
[[%define lr.default-reduction bogus
%%
]])
AT_BISON_CHECK([[-fcaret input.y]], [[1]], [[]],
[[input.y:1.9-28: error: invalid value for %define variable 'lr.default-reduction': 'bogus'
]])
AT_BISON_CHECK([[-fcaret input.y]], [[1]], [[]],
[[input.y:1.9-28: error: invalid value for %define variable 'lr.default-reduction': 'bogus'
AT_DATA([[input.y]],
[[%define api.push-pull neither
%%
AT_DATA([[input.y]],
[[%define api.push-pull neither
%%
]])
AT_BISON_CHECK([[-fcaret input.y]], [[1]], [[]],
[[input.y:1.9-21: error: invalid value for %define variable 'api.push-pull': 'neither'
]])
AT_BISON_CHECK([[-fcaret input.y]], [[1]], [[]],
[[input.y:1.9-21: error: invalid value for %define variable 'api.push-pull': 'neither'
%define api.namespace "foo"
%define variant
%%
%define api.namespace "foo"
%define variant
%%
]])
AT_BISON_CHECK([[-fcaret input.y]], [1], [],
[[input.y:1.9-21: warning: deprecated directive, use '%define api.push-pull both' [-Wdeprecated]
]])
AT_BISON_CHECK([[-fcaret input.y]], [1], [],
[[input.y:1.9-21: warning: deprecated directive, use '%define api.push-pull both' [-Wdeprecated]
[[%define api.pure ]$2[
]$1[
%%
[[%define api.pure ]$2[
]$1[
%%
]])
AT_BISON_CHECK([[input.y]], [[1]], [],
]])
AT_BISON_CHECK([[input.y]], [[1]], [],
%defines
%define api.namespace "]$1["
%%
%defines
%define api.namespace "]$1["
%%
]])
AT_BISON_CHECK([[input.y]], [1], [],
]])
AT_BISON_CHECK([[input.y]], [1], [],
AT_DATA([[input.y]],
[[%%
AT_DATA([[input.y]],
[[%%
]])
# parse.lac.* options are useless if LAC isn't actually activated.
]])
# parse.lac.* options are useless if LAC isn't actually activated.
AT_DATA([[input.y]],
[[%%
AT_DATA([[input.y]],
[[%%
]])
# -Werror is not enabled by -Wall or equivalent.
]])
# -Werror is not enabled by -Wall or equivalent.
[AT_DATA([[input.y]],
[[$1
%%
[AT_DATA([[input.y]],
[[$1
%%
]])
AT_BISON_CHECK([[$2 input.y]], [[1]], [[]],
[[$3: error: '%name-prefix' and '%define api.prefix' cannot be used together
]])
AT_BISON_CHECK([[$2 input.y]], [[1]], [[]],
[[$3: error: '%name-prefix' and '%define api.prefix' cannot be used together
and multiple reductions. The first reduction has more lookaheads than the
second, so the first should always be preferred as the default reduction if
enabled. The second reduction has one lookahead. */
and multiple reductions. The first reduction has more lookaheads than the
second, so the first should always be preferred as the default reduction if
enabled. The second reduction has one lookahead. */
]],
dnl Visit each state mentioned above.
[['a', 'a']],
]],
dnl Visit each state mentioned above.
[['a', 'a']],
%token <operator> LE 134 "<="
%left OR "<="
%%
%token <operator> LE 134 "<="
%left OR "<="
%%
AT_DATA([input.y],
[[%%
statement: struct_stat;
AT_DATA([input.y],
[[%%
statement: struct_stat;
-struct_stat: /* empty. */ | if else;
+struct_stat: %empty | if else;
if: "if" "const" "then" statement;
else: "else" statement;
%%
if: "if" "const" "then" statement;
else: "else" statement;
%%
| program e ';'
| program error ';';
| program e ';'
| program error ';';