diff options
author | Javier Marín <javier@marinros.com> | 2021-03-05 03:42:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-05 03:42:01 +0300 |
commit | d99491c1f45d091cfe80227671336455b20b897e (patch) | |
tree | 6a924c8daba04fa21c99504aba957fb07ea4af77 /src/NXP/Classes/Tokenizer.php | |
parent | 17cc5b9dc48b19e0dee1937080601a9fc2890af4 (diff) |
Support for unary positive expressions (#85)
* Support for unary positive operator
Diffstat (limited to 'src/NXP/Classes/Tokenizer.php')
-rw-r--r-- | src/NXP/Classes/Tokenizer.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/NXP/Classes/Tokenizer.php b/src/NXP/Classes/Tokenizer.php index bb6fa15..f8056c3 100644 --- a/src/NXP/Classes/Tokenizer.php +++ b/src/NXP/Classes/Tokenizer.php @@ -150,11 +150,11 @@ class Tokenizer $this->tokens[] = new Token(Token::ParamSeparator, ''); break; default: - // special case for unary minus - if ($ch == '-') { + // special case for unary operations + if ($ch == '-' || $ch == '+') { if ($this->allowNegative) { $this->allowNegative = false; - $this->tokens[] = new Token(Token::Operator, '`'); + $this->tokens[] = new Token(Token::Operator, $ch == '-' ? 'uNeg' : 'uPos'); continue 2; } // could be in exponent, in which case negative should be added to the numberBuffer |