mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
d: tests: use fewer global variables
* tests/calc.at: Move 'input' into the scanner.
This commit is contained in:
@@ -50,12 +50,8 @@ AT_D_IF([m4_pushdef([AT_CALC_MAIN],
|
||||
semantic_value result = 0;
|
||||
int count = 0;
|
||||
|
||||
if (args.length == 2)
|
||||
input = File (args[1], "r");
|
||||
else
|
||||
input = stdin;
|
||||
|
||||
CalcLexer l = new CalcLexer ();
|
||||
File input = args.length == 2 ? File (args[1], "r") : stdin;
|
||||
CalcLexer l = new CalcLexer (input);
|
||||
YYParser p = new YYParser (l);
|
||||
int status = !p.parse ();
|
||||
return status;
|
||||
@@ -121,9 +117,15 @@ main (int argc, const char **argv)
|
||||
]])])
|
||||
|
||||
AT_D_IF([m4_pushdef([AT_CALC_LEX],
|
||||
[[File input;
|
||||
[[class CalcLexer : Lexer
|
||||
{
|
||||
|
||||
class CalcLexer : Lexer {
|
||||
this (File i)
|
||||
{
|
||||
input = i;
|
||||
}
|
||||
|
||||
File input;
|
||||
|
||||
int prev_char = -1;
|
||||
|
||||
@@ -871,4 +873,4 @@ AT_CHECK_CALC([%skeleton "lalr1.d"])
|
||||
m4_define([AT_CHECK_CALC_LALR1_D],
|
||||
[AT_CHECK_CALC([%language "D" $1], [$2])])
|
||||
|
||||
AT_CHECK_CALC_LALR1_D([])
|
||||
AT_CHECK_CALC_LALR1_D([])
|
||||
|
||||
Reference in New Issue
Block a user