diff options
author | Bruce Wells <bruce.wells@simparel.com> | 2019-11-27 19:19:42 +0300 |
---|---|---|
committer | Bruce Wells <bruce.wells@simparel.com> | 2019-11-27 19:19:42 +0300 |
commit | 44a13487b5a89951d244ab7a5e723cf7ec893a54 (patch) | |
tree | 88cafa1f3fe84e1db662470851a68947973cadda /src/NXP/Classes/TokenFactory.php | |
parent | adf43bc705fd2d839a639c162f53407434867206 (diff) | |
parent | f975f0bfbc6ac28f0a868b2c237cca071c37c39e (diff) |
Merge branch 'master' of https://github.com/neonxp/MathExecutor
# Conflicts:
# .gitignore
# tests/MathTest.php
Diffstat (limited to 'src/NXP/Classes/TokenFactory.php')
-rw-r--r-- | src/NXP/Classes/TokenFactory.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/NXP/Classes/TokenFactory.php b/src/NXP/Classes/TokenFactory.php index 74b5789..5aa634a 100644 --- a/src/NXP/Classes/TokenFactory.php +++ b/src/NXP/Classes/TokenFactory.php @@ -133,21 +133,21 @@ class TokenFactory { $operatorsRegex = ''; foreach ($this->operators as $operator) { - $operatorsRegex .= $operator::getRegex(); + $operatorsRegex .= '|(' . $operator::getRegex() . ')'; } - - return sprintf( - '/(%s)|(%s)|(%s)|([%s])|(%s)|(%s)|([%s%s%s])/i', + $s = sprintf( + '/(%s)|(%s)|(%s)|(%s)|(%s)|([%s%s%s])', TokenNumber::getRegex(), TokenStringDoubleQuoted::getRegex(), TokenStringSingleQuoted::getRegex(), - $operatorsRegex, TokenFunction::getRegex(), TokenVariable::getRegex(), TokenLeftBracket::getRegex(), TokenRightBracket::getRegex(), TokenComma::getRegex() ); + $s .= $operatorsRegex . '/i'; + return $s; } /** |