diff options
Diffstat (limited to 'src/Lexer.php')
-rw-r--r-- | src/Lexer.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Lexer.php b/src/Lexer.php index 0d0862d..01d41d8 100644 --- a/src/Lexer.php +++ b/src/Lexer.php @@ -290,7 +290,25 @@ class Lexer */ $iEnd = $this->last; + /** + * Whether last parsed character is a whitespace. + * @var bool + */ + $lastSpace = false; + for ($j = 1; $j < Context::KEYWORD_MAX_LENGTH && $this->last < $this->len; ++$j, ++$this->last) { + // Composed keywords shouldn't have more than one whitespace between + // keywords. + if (Context::isWhitespace($this->str[$this->last])) { + if ($lastSpace) { + --$j; // The size of the keyword didn't increase. + continue; + } else { + $lastSpace = true; + } + } else { + $lastSpace = false; + } $token .= $this->str[$this->last]; if (($this->last + 1 === $this->len) || (Context::isSeparator($this->str[$this->last + 1]))) { if (($flags = Context::isKeyword($token))) { |