aboutsummaryrefslogtreecommitdiff
path: root/src/NXP/Classes/Lexer.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/NXP/Classes/Lexer.php')
-rw-r--r--src/NXP/Classes/Lexer.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/NXP/Classes/Lexer.php b/src/NXP/Classes/Lexer.php
index a511c9b..898d8c1 100644
--- a/src/NXP/Classes/Lexer.php
+++ b/src/NXP/Classes/Lexer.php
@@ -77,7 +77,7 @@ class Lexer
} elseif ($token instanceof TokenVariable) {
$output[] = $token;
} elseif ($token instanceof TokenFunction) {
- array_push($stack, $token);
+ $stack[] = $token;
} elseif ($token instanceof AbstractOperator) {
// While we have something on the stack
while (($count = count($stack)) > 0
@@ -104,9 +104,12 @@ class Lexer
$output[] = array_pop($stack);
}
- array_push($stack, $token);
+ // Comma operators do nothing really, don't put them on the stack
+ if (! ($token instanceof TokenComma)) {
+ $stack[] = $token;
+ }
} elseif ($token instanceof TokenLeftBracket) {
- array_push($stack, $token);
+ $stack[] = $token;
} elseif ($token instanceof TokenRightBracket) {
while (($current = array_pop($stack)) && (!($current instanceof TokenLeftBracket))) {
$output[] = $current;