aboutsummaryrefslogtreecommitdiff
path: root/src/NXP/Classes/Tokenizer.php
diff options
context:
space:
mode:
authorJavier Marín <javier@marinros.com>2021-03-05 03:42:01 +0300
committerGitHub <noreply@github.com>2021-03-05 03:42:01 +0300
commitd99491c1f45d091cfe80227671336455b20b897e (patch)
tree6a924c8daba04fa21c99504aba957fb07ea4af77 /src/NXP/Classes/Tokenizer.php
parent17cc5b9dc48b19e0dee1937080601a9fc2890af4 (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.php6
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