mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-15 07:13:02 +00:00
glr: tests: formatting changes
* tests/glr-regression.at: here. Use %empty where applicable.
This commit is contained in:
@@ -1284,41 +1284,53 @@ AT_DATA_GRAMMAR([glr-regr13.y],
|
|||||||
%%
|
%%
|
||||||
|
|
||||||
start:
|
start:
|
||||||
defstate_init defstate_shift 'b' change_lookahead 'a' {
|
defstate_init defstate_shift 'b' change_lookahead 'a'
|
||||||
USE ($][3);
|
{
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "start <- defstate_init defstate_shift 'b'");
|
USE ($][3);
|
||||||
}
|
print_lookahead (yychar, &yylval, &yylloc, "start <- defstate_init defstate_shift 'b'");
|
||||||
;
|
}
|
||||||
|
;
|
||||||
|
|
||||||
defstate_init:
|
defstate_init:
|
||||||
{
|
%empty
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "defstate_init <- empty string");
|
{
|
||||||
}
|
print_lookahead (yychar, &yylval, &yylloc, "defstate_init <- empty string");
|
||||||
;
|
}
|
||||||
|
;
|
||||||
|
|
||||||
defstate_shift:
|
defstate_shift:
|
||||||
nondefstate defstate_look 'a' {
|
nondefstate defstate_look 'a'
|
||||||
USE ($][3);
|
{
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "defstate_shift <- nondefstate defstate_look 'a'");
|
USE ($][3);
|
||||||
}
|
print_lookahead (yychar, &yylval, &yylloc, "defstate_shift <- nondefstate defstate_look 'a'");
|
||||||
;
|
}
|
||||||
|
;
|
||||||
|
|
||||||
defstate_look:
|
defstate_look:
|
||||||
{
|
%empty
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "defstate_look <- empty string");
|
{
|
||||||
}
|
print_lookahead (yychar, &yylval, &yylloc, "defstate_look <- empty string");
|
||||||
;
|
}
|
||||||
|
;
|
||||||
|
|
||||||
nondefstate:
|
nondefstate:
|
||||||
{
|
%empty
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "nondefstate <- empty string");
|
{
|
||||||
}
|
print_lookahead (yychar, &yylval, &yylloc, "nondefstate <- empty string");
|
||||||
| 'b' {
|
}
|
||||||
USE ($][1);
|
| 'b'
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "nondefstate <- 'b'");
|
{
|
||||||
}
|
USE ($][1);
|
||||||
;
|
print_lookahead (yychar, &yylval, &yylloc, "nondefstate <- 'b'");
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
change_lookahead:
|
change_lookahead:
|
||||||
{
|
%empty
|
||||||
yychar = 'a';
|
{
|
||||||
}
|
yychar = 'a';
|
||||||
;
|
}
|
||||||
|
;
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
@@ -1444,99 +1456,110 @@ AT_DATA_GRAMMAR([glr-regr14.y],
|
|||||||
%%
|
%%
|
||||||
|
|
||||||
start:
|
start:
|
||||||
merge 'c' stack_explosion {
|
merge 'c' stack_explosion
|
||||||
USE ($][2); USE ($][3);
|
{
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "start <- merge 'c' stack_explosion");
|
USE ($][2); USE ($][3);
|
||||||
}
|
print_lookahead (yychar, &yylval, &yylloc, "start <- merge 'c' stack_explosion");
|
||||||
;
|
}
|
||||||
|
;
|
||||||
|
|
||||||
/* When merging the 2 deferred actions, the lookahead needs are different. */
|
/* When merging the 2 deferred actions, the lookahead needs are different. */
|
||||||
merge:
|
merge:
|
||||||
nonconflict1 'a' 'b' nonconflict2 %dprec 1 {
|
nonconflict1 'a' 'b' nonconflict2 %dprec 1
|
||||||
USE ($][2); USE ($][3);
|
{
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "merge <- nonconflict1 'a' 'b' nonconflict2");
|
USE ($][2); USE ($][3);
|
||||||
}
|
print_lookahead (yychar, &yylval, &yylloc, "merge <- nonconflict1 'a' 'b' nonconflict2");
|
||||||
| conflict defstate_look 'a' nonconflict2 'b' defstate_shift %dprec 2 {
|
}
|
||||||
USE ($][3); USE ($][5);
|
| conflict defstate_look 'a' nonconflict2 'b' defstate_shift %dprec 2
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "merge <- conflict defstate_look 'a' nonconflict2 'b'"
|
{
|
||||||
" defstate_shift");
|
USE ($][3); USE ($][5);
|
||||||
}
|
print_lookahead (yychar, &yylval, &yylloc, "merge <- conflict defstate_look 'a' nonconflict2 'b'"
|
||||||
;
|
" defstate_shift");
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
nonconflict1:
|
nonconflict1:
|
||||||
{
|
%empty
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "nonconflict1 <- empty string");
|
{
|
||||||
}
|
print_lookahead (yychar, &yylval, &yylloc, "nonconflict1 <- empty string");
|
||||||
;
|
}
|
||||||
|
;
|
||||||
|
|
||||||
nonconflict2:
|
nonconflict2:
|
||||||
{
|
%empty
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "nonconflict2 <- empty string");
|
{
|
||||||
}
|
print_lookahead (yychar, &yylval, &yylloc, "nonconflict2 <- empty string");
|
||||||
| 'a' {
|
}
|
||||||
USE ($][1);
|
| 'a'
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "nonconflict2 <- 'a'");
|
{
|
||||||
}
|
USE ($][1);
|
||||||
;
|
print_lookahead (yychar, &yylval, &yylloc, "nonconflict2 <- 'a'");
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
conflict:
|
conflict:
|
||||||
|
%empty
|
||||||
{
|
{
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "conflict <- empty string");
|
print_lookahead (yychar, &yylval, &yylloc, "conflict <- empty string");
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
defstate_look:
|
defstate_look:
|
||||||
|
%empty
|
||||||
{
|
{
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "defstate_look <- empty string");
|
print_lookahead (yychar, &yylval, &yylloc, "defstate_look <- empty string");
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
/* yychar != YYEMPTY but lookahead need is yyfalse. */
|
/* yychar != YYEMPTY but lookahead need is yyfalse. */
|
||||||
defstate_shift:
|
defstate_shift:
|
||||||
|
%empty
|
||||||
{
|
{
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "defstate_shift <- empty string");
|
print_lookahead (yychar, &yylval, &yylloc, "defstate_shift <- empty string");
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
stack_explosion:
|
stack_explosion:
|
||||||
{ $$ = '\0'; }
|
%empty { $$ = '\0'; }
|
||||||
| alt1 stack_explosion %merge<merge> { $$ = $][2; }
|
| alt1 stack_explosion %merge<merge> { $$ = $][2; }
|
||||||
| alt2 stack_explosion %merge<merge> { $$ = $][2; }
|
| alt2 stack_explosion %merge<merge> { $$ = $][2; }
|
||||||
| alt3 stack_explosion %merge<merge> { $$ = $][2; }
|
| alt3 stack_explosion %merge<merge> { $$ = $][2; }
|
||||||
;
|
;
|
||||||
|
|
||||||
alt1:
|
alt1:
|
||||||
'd' no_look {
|
'd' no_look
|
||||||
USE ($][1);
|
{
|
||||||
if (yychar != 'd' && yychar != ]AT_GLR2_CC_IF([yy::parser::token::])[YYEOF)
|
USE ($][1);
|
||||||
{
|
if (yychar != 'd' && yychar != ]AT_GLR2_CC_IF([yy::parser::token::])[YYEOF)
|
||||||
fprintf (stderr, "Incorrect lookahead during stack explosion.\n");
|
fprintf (stderr, "Incorrect lookahead during stack explosion.\n");
|
||||||
}
|
}
|
||||||
}
|
;
|
||||||
;
|
|
||||||
alt2:
|
alt2:
|
||||||
'd' no_look {
|
'd' no_look
|
||||||
USE ($][1);
|
{
|
||||||
if (yychar != 'd' && yychar != ]AT_GLR2_CC_IF([yy::parser::token::])[YYEOF)
|
USE ($][1);
|
||||||
{
|
if (yychar != 'd' && yychar != ]AT_GLR2_CC_IF([yy::parser::token::])[YYEOF)
|
||||||
fprintf (stderr, "Incorrect lookahead during stack explosion.\n");
|
fprintf (stderr, "Incorrect lookahead during stack explosion.\n");
|
||||||
}
|
}
|
||||||
}
|
;
|
||||||
;
|
|
||||||
alt3:
|
alt3:
|
||||||
'd' no_look {
|
'd' no_look {
|
||||||
USE ($][1);
|
USE ($][1);
|
||||||
if (yychar != 'd' && yychar != ]AT_GLR2_CC_IF([yy::parser::token::])[YYEOF)
|
if (yychar != 'd' && yychar != ]AT_GLR2_CC_IF([yy::parser::token::])[YYEOF)
|
||||||
{
|
fprintf (stderr, "Incorrect lookahead during stack explosion.\n");
|
||||||
fprintf (stderr, "Incorrect lookahead during stack explosion.\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
no_look:
|
no_look:
|
||||||
{
|
%empty
|
||||||
if (yychar != ]AT_GLR2_CC_IF([yy::parser::token::])[YYEMPTY)
|
{
|
||||||
{
|
if (yychar != ]AT_GLR2_CC_IF([yy::parser::token::])[YYEMPTY)
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
"Found lookahead where shouldn't during stack explosion.\n");
|
"Found lookahead where shouldn't during stack explosion.\n");
|
||||||
}
|
}
|
||||||
}
|
;
|
||||||
;
|
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user