mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-21 18:23:03 +00:00
glr: tests: more macros
This will be useful to support changes in glr2.cc. tests/glr-regression.at (Incorrect lookahead during deterministic GLR) (Incorrect lookahead during nondeterministc GLR): Introduce and use PRINT_LOOKAHEAD.
This commit is contained in:
@@ -1269,7 +1269,9 @@ AT_DATA_GRAMMAR([glr-regr13.y],
|
|||||||
static void
|
static void
|
||||||
print_lookahead (int yychr, ]AT_YYSTYPE[ *yylvalp, ]AT_YYLTYPE[ *yyllocp,
|
print_lookahead (int yychr, ]AT_YYSTYPE[ *yylvalp, ]AT_YYLTYPE[ *yyllocp,
|
||||||
char const *reduction);
|
char const *reduction);
|
||||||
#define USE(value)
|
#define PRINT_LOOKAHEAD(Msg) \
|
||||||
|
print_lookahead (yychar, &yylval, &yylloc, Msg)
|
||||||
|
#define USE(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
%define parse.assert
|
%define parse.assert
|
||||||
@@ -1287,14 +1289,14 @@ start:
|
|||||||
defstate_init defstate_shift 'b' change_lookahead 'a'
|
defstate_init defstate_shift 'b' change_lookahead 'a'
|
||||||
{
|
{
|
||||||
USE ($][3);
|
USE ($][3);
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "start <- defstate_init defstate_shift 'b'");
|
PRINT_LOOKAHEAD ("start <- defstate_init defstate_shift 'b'");
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
defstate_init:
|
defstate_init:
|
||||||
%empty
|
%empty
|
||||||
{
|
{
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "defstate_init <- empty string");
|
PRINT_LOOKAHEAD ("defstate_init <- empty string");
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -1302,26 +1304,26 @@ defstate_shift:
|
|||||||
nondefstate defstate_look 'a'
|
nondefstate defstate_look 'a'
|
||||||
{
|
{
|
||||||
USE ($][3);
|
USE ($][3);
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "defstate_shift <- nondefstate defstate_look 'a'");
|
PRINT_LOOKAHEAD ("defstate_shift <- nondefstate defstate_look 'a'");
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
defstate_look:
|
defstate_look:
|
||||||
%empty
|
%empty
|
||||||
{
|
{
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "defstate_look <- empty string");
|
PRINT_LOOKAHEAD ("defstate_look <- empty string");
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
nondefstate:
|
nondefstate:
|
||||||
%empty
|
%empty
|
||||||
{
|
{
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "nondefstate <- empty string");
|
PRINT_LOOKAHEAD ("nondefstate <- empty string");
|
||||||
}
|
}
|
||||||
| 'b'
|
| 'b'
|
||||||
{
|
{
|
||||||
USE ($][1);
|
USE ($][1);
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "nondefstate <- 'b'");
|
PRINT_LOOKAHEAD ("nondefstate <- 'b'");
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -1449,6 +1451,8 @@ AT_DATA_GRAMMAR([glr-regr14.y],
|
|||||||
static void
|
static void
|
||||||
print_lookahead (int yychr, ]AT_YYSTYPE[ *yylvalp, ]AT_YYLTYPE[ *yyllocp,
|
print_lookahead (int yychr, ]AT_YYSTYPE[ *yylvalp, ]AT_YYLTYPE[ *yyllocp,
|
||||||
char const *reduction);
|
char const *reduction);
|
||||||
|
#define PRINT_LOOKAHEAD(Msg) \
|
||||||
|
print_lookahead (yychar, &yylval, &yylloc, Msg)
|
||||||
static char merge (]AT_YYSTYPE[, ]AT_YYSTYPE[);
|
static char merge (]AT_YYSTYPE[, ]AT_YYSTYPE[);
|
||||||
#define USE(value)
|
#define USE(value)
|
||||||
}
|
}
|
||||||
@@ -1459,7 +1463,7 @@ start:
|
|||||||
merge 'c' stack_explosion
|
merge 'c' stack_explosion
|
||||||
{
|
{
|
||||||
USE ($][2); USE ($][3);
|
USE ($][2); USE ($][3);
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "start <- merge 'c' stack_explosion");
|
PRINT_LOOKAHEAD ("start <- merge 'c' stack_explosion");
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -1468,12 +1472,12 @@ merge:
|
|||||||
nonconflict1 'a' 'b' nonconflict2 %dprec 1
|
nonconflict1 'a' 'b' nonconflict2 %dprec 1
|
||||||
{
|
{
|
||||||
USE ($][2); USE ($][3);
|
USE ($][2); USE ($][3);
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "merge <- nonconflict1 'a' 'b' nonconflict2");
|
PRINT_LOOKAHEAD ("merge <- nonconflict1 'a' 'b' nonconflict2");
|
||||||
}
|
}
|
||||||
| conflict defstate_look 'a' nonconflict2 'b' defstate_shift %dprec 2
|
| conflict defstate_look 'a' nonconflict2 'b' defstate_shift %dprec 2
|
||||||
{
|
{
|
||||||
USE ($][3); USE ($][5);
|
USE ($][3); USE ($][5);
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "merge <- conflict defstate_look 'a' nonconflict2 'b'"
|
PRINT_LOOKAHEAD ("merge <- conflict defstate_look 'a' nonconflict2 'b'"
|
||||||
" defstate_shift");
|
" defstate_shift");
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
@@ -1481,33 +1485,33 @@ merge:
|
|||||||
nonconflict1:
|
nonconflict1:
|
||||||
%empty
|
%empty
|
||||||
{
|
{
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "nonconflict1 <- empty string");
|
PRINT_LOOKAHEAD ("nonconflict1 <- empty string");
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
nonconflict2:
|
nonconflict2:
|
||||||
%empty
|
%empty
|
||||||
{
|
{
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "nonconflict2 <- empty string");
|
PRINT_LOOKAHEAD ("nonconflict2 <- empty string");
|
||||||
}
|
}
|
||||||
| 'a'
|
| 'a'
|
||||||
{
|
{
|
||||||
USE ($][1);
|
USE ($][1);
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "nonconflict2 <- 'a'");
|
PRINT_LOOKAHEAD ("nonconflict2 <- 'a'");
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
conflict:
|
conflict:
|
||||||
%empty
|
%empty
|
||||||
{
|
{
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "conflict <- empty string");
|
PRINT_LOOKAHEAD ("conflict <- empty string");
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
defstate_look:
|
defstate_look:
|
||||||
%empty
|
%empty
|
||||||
{
|
{
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "defstate_look <- empty string");
|
PRINT_LOOKAHEAD ("defstate_look <- empty string");
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -1515,7 +1519,7 @@ defstate_look:
|
|||||||
defstate_shift:
|
defstate_shift:
|
||||||
%empty
|
%empty
|
||||||
{
|
{
|
||||||
print_lookahead (yychar, &yylval, &yylloc, "defstate_shift <- empty string");
|
PRINT_LOOKAHEAD ("defstate_shift <- empty string");
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user