mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-14 23:03:04 +00:00
* src/scan-skel.l: Postprocess quadrigraphs.
* src/reader.c (copy_character): New function, used to output single characters while replacing `[' and `]' with quadrigraphs, to avoid troubles with M4 quotes. (copy_comment): Output characters with copy_character. (read_additionnal_code): Likewise. (copy_string2): Likewise. (copy_definition): Likewise. * tests/calc.at: Exercise M4 quoting.
This commit is contained in:
@@ -67,6 +67,8 @@ typedef int value_t;
|
||||
|
||||
%}
|
||||
|
||||
/* Exercise M4 quoting: '@:>@@:>@', 0. */
|
||||
|
||||
/* Also exercise %union. */
|
||||
%union
|
||||
{
|
||||
@@ -76,6 +78,9 @@ typedef int value_t;
|
||||
/* Exercise post-prologue dependency to %union. */
|
||||
%{
|
||||
static void id (YYSTYPE *lval);
|
||||
|
||||
/* Exercise quotes in declarations. */
|
||||
char quote[] = "@:>@@:>@,";
|
||||
%}
|
||||
|
||||
/* Bison Declarations */
|
||||
@@ -83,6 +88,9 @@ static void id (YYSTYPE *lval);
|
||||
%token <ival> NUM "number"
|
||||
%type <ival> exp
|
||||
|
||||
/* Exercise quotes in strings. */
|
||||
%token "fake @>:@@>:@,"
|
||||
|
||||
%nonassoc '=' /* comparison */
|
||||
%left '-' '+'
|
||||
%left '*' '/'
|
||||
@@ -100,9 +108,14 @@ input:
|
||||
|
||||
line:
|
||||
'\n'
|
||||
| exp '\n' {}
|
||||
| exp '\n'
|
||||
{
|
||||
/* Exercise quotes in braces. */
|
||||
char tmp[] = "@>:@@:>@,";
|
||||
}
|
||||
;
|
||||
|
||||
/* Exercise M4 quoting: '@:>@@:>@', 1. */
|
||||
exp:
|
||||
NUM { $$ = $1; }
|
||||
| exp '=' exp
|
||||
@@ -124,6 +137,7 @@ exp:
|
||||
/* The input. */
|
||||
FILE *yyin;
|
||||
|
||||
/* Exercise M4 quoting: '@:>@@:>@', 2. */
|
||||
static void
|
||||
yyerror (const char *s)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user