mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-21 18:23:03 +00:00
* tests/calc.at (_AT_DATA_CALC_Y): Also use %union.
In addition, put a comment in there, to replace... * tests/regression.at (%union and C comments): Remove.
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
2001-12-29 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
* tests/calc.at (_AT_DATA_CALC_Y): Also use %union.
|
||||||
|
In addition, put a comment in there, to replace...
|
||||||
|
* tests/regression.at (%union and C comments): Remove.
|
||||||
|
|
||||||
|
|
||||||
2001-12-29 Akim Demaille <akim@epita.fr>
|
2001-12-29 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* tests/regression.at (Web2c Actions): Blindly move the actual
|
* tests/regression.at (Web2c Actions): Blindly move the actual
|
||||||
|
|||||||
@@ -63,9 +63,16 @@ static void yyungetc (int c);
|
|||||||
extern void perror (const char *s);
|
extern void perror (const char *s);
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
/* Also exercise %union. */
|
||||||
|
%union
|
||||||
|
{
|
||||||
|
int ival; /* A comment to exercise an old bug. */
|
||||||
|
};
|
||||||
|
|
||||||
/* Bison Declarations */
|
/* Bison Declarations */
|
||||||
%token CALC_EOF 0 "end of file"
|
%token CALC_EOF 0 "end of file"
|
||||||
%token NUM "number"
|
%token <ival> NUM "number"
|
||||||
|
%type <ival> exp
|
||||||
|
|
||||||
%nonassoc '=' /* comparison */
|
%nonassoc '=' /* comparison */
|
||||||
%left '-' '+'
|
%left '-' '+'
|
||||||
@@ -84,7 +91,7 @@ input:
|
|||||||
|
|
||||||
line:
|
line:
|
||||||
'\n'
|
'\n'
|
||||||
| exp '\n'
|
| exp '\n' {}
|
||||||
;
|
;
|
||||||
|
|
||||||
exp:
|
exp:
|
||||||
@@ -205,7 +212,7 @@ yylex (void)
|
|||||||
if (c == '.' || isdigit (c))
|
if (c == '.' || isdigit (c))
|
||||||
{
|
{
|
||||||
yyungetc (c);
|
yyungetc (c);
|
||||||
yylval = read_signed_integer ();
|
yylval.ival = read_signed_integer ();
|
||||||
return NUM;
|
return NUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -500,29 +500,6 @@ AT_CHECK([bison --defines input.y])
|
|||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
## --------------------------------------- ##
|
|
||||||
## Duplicate '/' in C comments in %union ##
|
|
||||||
## --------------------------------------- ##
|
|
||||||
|
|
||||||
|
|
||||||
AT_SETUP([%union and C comments])
|
|
||||||
|
|
||||||
AT_DATA([input.y],
|
|
||||||
[%union
|
|
||||||
{
|
|
||||||
/* The int. */ int integer;
|
|
||||||
/* The string. */ char *string ;
|
|
||||||
}
|
|
||||||
%%
|
|
||||||
exp: {};
|
|
||||||
])
|
|
||||||
|
|
||||||
AT_CHECK([bison input.y -o input.c])
|
|
||||||
AT_CHECK([fgrep '//*' input.c], [1], [])
|
|
||||||
|
|
||||||
AT_CLEANUP
|
|
||||||
|
|
||||||
|
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
## Invalid input 1. ##
|
## Invalid input 1. ##
|
||||||
## ----------------- ##
|
## ----------------- ##
|
||||||
|
|||||||
Reference in New Issue
Block a user