diff options
Diffstat (limited to 'src/NXP/Classes/Lexer.php')
-rw-r--r-- | src/NXP/Classes/Lexer.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/NXP/Classes/Lexer.php b/src/NXP/Classes/Lexer.php index e541732..82b2c53 100644 --- a/src/NXP/Classes/Lexer.php +++ b/src/NXP/Classes/Lexer.php @@ -17,6 +17,7 @@ use NXP\Classes\Token\TokenLeftBracket; use NXP\Classes\Token\TokenNumber; use NXP\Classes\Token\TokenRightBracket; use NXP\Classes\Token\TokenVariable; +use NXP\Classes\Token\TokenString; use NXP\Exception\IncorrectBracketsException; use NXP\Exception\IncorrectExpressionException; @@ -42,7 +43,7 @@ class Lexer */ public function stringToTokensStream($input) { - $matches = array(); + $matches = []; preg_match_all($this->tokenFactory->getTokenParserRegex(), $input, $matches); $tokenFactory = $this->tokenFactory; $tokensStream = array_map( @@ -62,10 +63,13 @@ class Lexer */ public function buildReversePolishNotation($tokensStream) { - $output = array(); - $stack = array(); + $output = []; + $stack = []; foreach ($tokensStream as $token) { + if ($token instanceof TokenString) { + $output[] = $token; + } if ($token instanceof TokenNumber) { $output[] = $token; } |