diff options
author | Bruce Wells <bruce.wells@simparel.com> | 2018-09-12 18:55:31 +0300 |
---|---|---|
committer | Bruce Wells <bruce.wells@simparel.com> | 2018-09-12 19:33:17 +0300 |
commit | 00def17f0e9183544813427cddbdaed851986309 (patch) | |
tree | fcc3e47fdf11465e2566e9c6f71e7a80488da6a8 /src/NXP/Classes/Token | |
parent | 855ca5dfc1a6d70d9872df4b0d7bea8ba3c4c040 (diff) |
Support for double quoted strings
Changed array() to [] syntax.
Added variable in question to unknown variable exception.
Added getVar and getVars accessor functions.
Added getOperators and getFunctions accessor functions for completeness.
Extended all Exceptions off MathExecutorException.
Diffstat (limited to 'src/NXP/Classes/Token')
-rw-r--r-- | src/NXP/Classes/Token/TokenFunction.php | 2 | ||||
-rw-r--r-- | src/NXP/Classes/Token/TokenString.php | 25 |
2 files changed, 26 insertions, 1 deletions
diff --git a/src/NXP/Classes/Token/TokenFunction.php b/src/NXP/Classes/Token/TokenFunction.php index 23f64bd..2ed8ace 100644 --- a/src/NXP/Classes/Token/TokenFunction.php +++ b/src/NXP/Classes/Token/TokenFunction.php @@ -29,7 +29,7 @@ class TokenFunction extends AbstractContainerToken implements InterfaceFunction */ public function execute(&$stack) { - $args = array(); + $args = []; list($places, $function) = $this->value; for ($i = 0; $i < $places; $i++) { array_push($args, array_pop($stack)->getValue()); diff --git a/src/NXP/Classes/Token/TokenString.php b/src/NXP/Classes/Token/TokenString.php new file mode 100644 index 0000000..cab0711 --- /dev/null +++ b/src/NXP/Classes/Token/TokenString.php @@ -0,0 +1,25 @@ +<?php +/** + * This file is part of the MathExecutor package + * + * (c) Alexander Kiryukhin + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code + */ + +namespace NXP\Classes\Token; + +/** + * @author Bruce Wells <brucekwells@gmail.com> + */ +class TokenString extends AbstractContainerToken +{ + /** + * @return string + */ + public static function getRegex() + { + return '"([^"]|"")*"'; + } +} |