diff --git a/jsm.inc.php b/jsm.inc.php index c9e9e75..fd71061 100644 --- a/jsm.inc.php +++ b/jsm.inc.php @@ -79,7 +79,7 @@ class JSM return $m; } - function _currentModule() + function _currentModule() : JSM_Module { $m = end($this->cur_modules); if(!$m) @@ -87,7 +87,7 @@ class JSM return $m; } - function getCurrentModule() + function getCurrentModule() : JSM_Module { return $this->_currentModule(); } @@ -1100,7 +1100,6 @@ class JSM_Eval else { throw new Exception("Unknown func " . $func); - return false; } } } @@ -1322,8 +1321,8 @@ class JSM_Expr case ' ': case "\r": case "\t": case "\n" : break; case '(': $token = array(self::T_LParen, $c); $binary = false; break; case ')': $token = array(self::T_RParen, $c); $binary = true; break; - case '+': $token = $this->_getFuncToken(($binary ? '+' : 'u+'), $c); $binary = false; break; - case '-': $token = $this->_getFuncToken(($binary ? '-' : 'u-'), $c); $binary = false; break; + case '+': $token = $this->_getFuncToken(($binary ? '+' : 'u+')); $binary = false; break; + case '-': $token = $this->_getFuncToken(($binary ? '-' : 'u-')); $binary = false; break; default: //try to peek the next symbol and check if such an operator exists @@ -1378,7 +1377,7 @@ function jsm_lex($string, array $tokenMap) { foreach($tokenMap as $regex => $token) { - if(preg_match($regex, $string, $matches, null, $offset)) + if(preg_match($regex, $string, $matches, 0, $offset)) { $tokens[] = array( $token, // token ID (e.g. T_FIELD_SEPARATOR) @@ -1751,10 +1750,11 @@ class JSM_ArgsParser ++$this->c; } + $str_num = substr($this->in, $start, $this->c - $start); if($is_float) - return 1*substr($this->in, $start, $this->c - $start); + return floatval($str_num); else - return (int)(1*substr($this->in, $start, $this->c - $start)); + return intval($str_num); } private function _error($error)