From 3b7e772fc73fde8e36026adcc6c217271c89c282 Mon Sep 17 00:00:00 2001 From: Michael Ochmann Date: Mon, 12 Dec 2022 13:29:42 +0100 Subject: [PATCH] now tokenizing spaces --- src/Lexer.php | 4 ++++ src/Token.php | 1 + 2 files changed, 5 insertions(+) diff --git a/src/Lexer.php b/src/Lexer.php index de7db14..c73d559 100644 --- a/src/Lexer.php +++ b/src/Lexer.php @@ -119,6 +119,10 @@ class Lexer { $clearBuffer(); array_push($tokens, new Token(TokenType::RBRACE, $char, [$col, $row, $this->fileName])); break; + case ' ': + $clearBuffer(); + array_push($tokens, new Token(TokenType::SPACE, $char, [$col, $row, $this->fileName])); + break; default: $buffer .= $char; break; diff --git a/src/Token.php b/src/Token.php index 41b2a69..295f829 100644 --- a/src/Token.php +++ b/src/Token.php @@ -24,6 +24,7 @@ enum TokenType { case TAB ; case LBRACE ; case RBRACE ; + case SPACE ; } class Token {