Change lexer code to use an option instead of ignoring the variant when no value is needed
This commit is contained in:
@@ -6,7 +6,7 @@ TEST_CASE("Lexer lexes doubles correctly", "[Lexer]") {
|
||||
|
||||
SECTION("double and negative syntax") {
|
||||
Lexer l("(1.0 0.1 -.1 -1. . - -. .-)");
|
||||
REQUIRE(l.next() == Token({OpenParen}));
|
||||
REQUIRE(l.next() == Token({OpenParen, nullopt}));
|
||||
REQUIRE(l.next() == Token({Double, 1.0}));
|
||||
REQUIRE(l.next() == Token({Double, 0.1}));
|
||||
REQUIRE(l.next() == Token({Double, -0.1}));
|
||||
@@ -15,7 +15,7 @@ TEST_CASE("Lexer lexes doubles correctly", "[Lexer]") {
|
||||
REQUIRE(l.next() == Token({Symbol, "-"}));
|
||||
REQUIRE(l.next() == Token({Symbol, "-."}));
|
||||
REQUIRE(l.next() == Token({Symbol, ".-"}));
|
||||
REQUIRE(l.next() == Token({CloseParen}));
|
||||
REQUIRE(l.next() == Token({CloseParen, nullopt}));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user