diff options
author | Alexander Kiryukhin <alexander@kiryukhin.su> | 2018-09-12 20:05:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-12 20:05:09 +0300 |
commit | 4a672cfd94c07e1821227f27fd1edd2217685136 (patch) | |
tree | c50b777d06d9e9eeff6aeb59005c389ddf9a552b /src/NXP/Classes/Lexer.php | |
parent | 76d1b4b8f02d555e4b4f4fd4d641597f0f6b5f4e (diff) | |
parent | 2722a5201d326317e391ae6c0e2fa7e0c2b537b4 (diff) |
Merge pull request #28 from phpfui/support_for_double_quoted_strings
Support for double quoted strings
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; } |