mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-18 16:53:02 +00:00
(Torturing the Scanner): Add tests that @oline@,
__oline__, #output, $@, and @{ do not have unintended meanings.
This commit is contained in:
@@ -151,13 +151,17 @@ static int yylex (void);
|
|||||||
|
|
||||||
%%
|
%%
|
||||||
/* Exercise M4 quoting: '@:>@@:>@', @<:@, 1. */
|
/* Exercise M4 quoting: '@:>@@:>@', @<:@, 1. */
|
||||||
exp: '@<:@' '\1' '\x000000000000000000000000000000000000000000000000002'
|
exp: '@<:@' '\1' two '$' '@' '{' oline output
|
||||||
{
|
{
|
||||||
/* Exercise quotes in braces. */
|
/* Exercise quotes in braces. */
|
||||||
char tmp[] = "@<:@%c@:>@,\n";
|
char tmp[] = "@<:@%c@:>@,\n";
|
||||||
printf (tmp, $1);
|
printf (tmp, $1);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
two: '\x000000000000000000000000000000000000000000000000000000000000000000002';
|
||||||
|
oline: '@' 'o' 'l' 'i' 'n' 'e' '@' '_' '_' 'o' 'l' 'i' 'n' 'e' '_' '_';
|
||||||
|
output: '#' 'o' 'u' 't' 'p' 'u' 't' ' ';
|
||||||
%%
|
%%
|
||||||
/* Exercise M4 quoting: '@:>@@:>@', @<:@, 2. */
|
/* Exercise M4 quoting: '@:>@@:>@', @<:@, 2. */
|
||||||
|
|
||||||
@@ -172,7 +176,9 @@ value_t_as_yystype (value_t val)
|
|||||||
static int
|
static int
|
||||||
yylex (void)
|
yylex (void)
|
||||||
{
|
{
|
||||||
static const char *input = "@<:@\1\2";
|
static const char *input = "@<:@\1\2$@{@oline@__@&t@oline__\
|
||||||
|
#output "; /* "
|
||||||
|
*/
|
||||||
yylval = value_t_as_yystype (*input);
|
yylval = value_t_as_yystype (*input);
|
||||||
return *input++;
|
return *input++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user