mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-16 07:43:03 +00:00
d: tests: various style fixes
* tests/calc.at, tests/scanner.at: Here. (yylex): Report values directly, without storing them to the union first.
This commit is contained in:
committed by
Akim Demaille
parent
b4582f1918
commit
689b184983
@@ -94,7 +94,7 @@ m4_define([AT_RAW_YYLEX(d)],
|
||||
import std.stdio;
|
||||
|
||||
auto yyLexer(R)(R range)
|
||||
if (isInputRange!R && is (ElementType!R : dchar))
|
||||
if (isInputRange!R && is (ElementType!R : dchar))
|
||||
{
|
||||
return new YYLexer!R(range);
|
||||
}
|
||||
@@ -105,18 +105,14 @@ auto yyLexer ()
|
||||
}
|
||||
|
||||
class YYLexer(R) : Lexer
|
||||
if (isInputRange!R && is (ElementType!R : dchar))
|
||||
if (isInputRange!R && is (ElementType!R : dchar))
|
||||
{
|
||||
R input;
|
||||
|
||||
this(R r) {
|
||||
input = r;
|
||||
}
|
||||
this(R r) { input = r; }
|
||||
|
||||
]AT_YYERROR_DEFINE[
|
||||
|
||||
Value value_;
|
||||
|
||||
Symbol yylex ()
|
||||
{
|
||||
import std.uni : isNumber;
|
||||
@@ -131,8 +127,7 @@ class YYLexer(R) : Lexer
|
||||
switch (c)
|
||||
{
|
||||
case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
|
||||
value_.val = c - '0';
|
||||
return Symbol(TokenKind.NUM, value_.val);
|
||||
return Symbol(TokenKind.NUM, c - '0');
|
||||
case '+': return Symbol(TokenKind.PLUS);
|
||||
case '-': return Symbol(TokenKind.MINUS);
|
||||
case '*': return Symbol(TokenKind.STAR);
|
||||
|
||||
Reference in New Issue
Block a user