diff options
author | Bruce Wells <phpfui@users.noreply.github.com> | 2018-09-12 21:21:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-12 21:21:25 +0300 |
commit | 12d41b160bbf8c26601819fcc1f7628c48bc7a00 (patch) | |
tree | c50b777d06d9e9eeff6aeb59005c389ddf9a552b /src/NXP/Classes/Lexer.php | |
parent | 855ca5dfc1a6d70d9872df4b0d7bea8ba3c4c040 (diff) | |
parent | 4a672cfd94c07e1821227f27fd1edd2217685136 (diff) |
Merge pull request #1 from NeonXP/master
Merge from upstream master
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; } |