From 34e7730d383349929e4edb7d1e83e6048fbd5016 Mon Sep 17 00:00:00 2001 From: Richard van Velzen Date: Fri, 25 Mar 2022 14:01:39 +0100 Subject: [PATCH] Add fuzzy tests --- doc/grammars/type.abnf | 5 ++++- src/Parser/TokenIterator.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/grammars/type.abnf b/doc/grammars/type.abnf index 2a864bf0..d76fba6d 100644 --- a/doc/grammars/type.abnf +++ b/doc/grammars/type.abnf @@ -3,7 +3,7 @@ ; ---------------------------------------------------------------------------- ; Type - = Atomic [Union / Intersection] + = Atomic [Union / Intersection / Conditional] / Nullable Union @@ -12,6 +12,9 @@ Union Intersection = 1*(TokenIntersection Atomic) +Conditional + = 1*ByteHorizontalWs "is" [1*ByteHorizontalWs "not"] 1*ByteHorizontalWs Atomic TokenNullable Atomic TokenColon Atomic + Nullable = TokenNullable TokenIdentifier [Generic] diff --git a/src/Parser/TokenIterator.php b/src/Parser/TokenIterator.php index 1e732237..7def070f 100644 --- a/src/Parser/TokenIterator.php +++ b/src/Parser/TokenIterator.php @@ -59,7 +59,7 @@ public function currentTokenOffset(): int public function isCurrentTokenValue(string $tokenValue): bool { - return $this->tokens[$this->index][Lexer::VALUE_OFFSET] === $tokenValue; + return strcasecmp($this->tokens[$this->index][Lexer::VALUE_OFFSET], $tokenValue) === 0; }