Commit graph

187 commits

Author SHA1 Message Date
Bruce Wells
b38893d672
Release prep (#69)
* String comparison unit tests

* getVars and getFunctions sanity checks

* Add dynamic variable documentation
2020-07-26 22:14:51 -04:00
Javier Marín
c1e07f254a
Handler for not found variables (#68)
* Added handler to define not found variables
Added support for string variables
Fixed strings and ints comparison error

* Check if variables have scalar types (int, float, string and bool)
Better $onVarNotFound logic
2020-07-25 22:27:26 -04:00
Bruce Wells
aa8ffe19f2
Variable fixes (#67)
* Reproduce if throws UnknownOperatorException

* Fix variable detection

* Adding IncorrectNumberOfFunctionParametersException

* Removing tabs

* Better exception message text
2020-06-04 11:43:16 -04:00
Bruce Wells
333a52e9aa
Merge pull request #4 from neonxp/master
Latest from master
2020-06-03 09:59:55 -04:00
Alexander Kiryukhin
ea898d7a7b
Code style fixes & Github Actions (#65)
* Code style fixes

Up phpunit to v8
New CI

* Remove travis

* Fix CI badge

* Added php-cs-fixer action
2020-05-31 20:50:39 -04:00
Bruce Wells
7852fc7d04
Packagist tag (#64)
* $variables should be private

* Add Packagist tag
2020-05-21 14:45:25 -04:00
Alexander Kiryukhin
913cf0a1e8
Merge pull request #63 from phpfui/neonxp-ng
Update parameters and add back functions
2020-05-20 22:26:59 +03:00
Bruce Wells
2c18fbb245
Merge branch 'master' into neonxp-ng 2020-05-19 23:16:13 -04:00
Alexander Kiryukhin
949334d6c3
WIP: New generation (#62)
* Massive refactoring

More clean structure
Parsing without regular expressions

* Cleanup unused imports

* Fix version string for Travis

* 7.1 downgrade

* Fix readme
2020-05-19 23:04:31 -04:00
Bruce Wells
d195b3e909 Null parameters allowed 2020-05-19 23:00:10 -04:00
Bruce Wells
a621ea01c0 Adding setVars back in 2020-05-19 22:59:30 -04:00
Bruce Wells
7343f2c9c4 Update readme.md 2020-05-19 22:37:16 -04:00
Bruce Wells
b95ab24f36 setDivisionByZeroIsZero 2020-05-19 22:36:55 -04:00
Bruce Wells
ab3a44b330 Private members 2020-05-19 22:36:08 -04:00
Bruce Wells
1bb9f61423 typed parameters and return types 2020-05-19 22:17:03 -04:00
Bruce Wells
906021d27c Merge branch 'ng' of https://github.com/neonxp/MathExecutor into neonxp-ng
# Conflicts:
#	src/NXP/Classes/Calculator.php
#	src/NXP/Classes/Lexer.php
#	src/NXP/Classes/Token/AbstractOperator.php
#	src/NXP/Classes/TokenFactory.php
#	src/NXP/MathExecutor.php
2020-05-19 21:37:04 -04:00
Bruce Wells
f284316053 Doc update (#61)
* Update documentation for PHPFUI/InstaDoc

* Removing dead waffle.io links in docs
2020-05-19 21:31:46 -04:00
Bruce Wells
47ec659546 Negative expression start (#60)
* Update documentation for PHPFUI/InstaDoc

* Support for negative numbers starting paren enclosed expressions
2020-05-19 21:31:46 -04:00
Alexander Kiryukhin
11ea95cb21 Fix readme 2020-05-15 22:04:57 +03:00
Alexander Kiryukhin
b74742641f 7.1 downgrade 2020-05-15 22:02:52 +03:00
Alexander Kiryukhin
e6f35cd802 Fix version string for Travis 2020-05-15 21:58:38 +03:00
Alexander Kiryukhin
043058f3c7 Cleanup unused imports 2020-05-15 21:52:35 +03:00
Alexander Kiryukhin
cab8e2d38a Massive refactoring
More clean structure
Parsing without regular expressions
2020-05-15 21:51:23 +03:00
Bruce Wells
01415abc9d
Doc update (#61)
* Update documentation for PHPFUI/InstaDoc

* Removing dead waffle.io links in docs
2020-05-14 00:22:11 -04:00
Bruce Wells
4d50343330
Negative expression start (#60)
* Update documentation for PHPFUI/InstaDoc

* Support for negative numbers starting paren enclosed expressions
2020-04-21 11:12:55 -04:00
Bruce Wells
7198653aef
Update documentation for PHPFUI/InstaDoc (#58) 2020-04-10 20:40:21 -04:00
Bruce Wells
e7add2d36d Update documentation for PHPFUI/InstaDoc 2020-04-09 22:22:37 -04:00
Bruce Wells
4955c639e1
PHP 7.4 support (#57)
* Merge in neonxp master (#9)

* Version 1.1 (#51)

* Update README.md and more function support

* Removing phpunit symbolic link (#53)

* Left bracket and minus fix (#55)

* Left bracket and minus fix (#54)

* Add test for left bracket and minus fix #55

* Fix substraction by zero bug (#56)

Co-authored-by: franksl <info@streamlake.com>
Co-authored-by: Clément Lafont <johnrazeur@gmail.com>

* Docs and test updates

* Update composer

Co-authored-by: franksl <info@streamlake.com>
Co-authored-by: Clément Lafont <johnrazeur@gmail.com>
2020-02-07 17:45:33 -05:00
Bruce Wells
0eeed45566
Merge branch 'master' into master 2020-02-07 12:27:48 -05:00
Clément Lafont
43790a456e
Fix substraction by zero bug (#56) 2020-02-07 11:05:26 -05:00
Clément Lafont
707e22029d Left bracket and minus fix (#55)
* Left bracket and minus fix (#54)

* Add test for left bracket and minus fix #55
2020-01-13 12:09:18 -05:00
franksl
ff550b4180 Removing phpunit symbolic link (#53) 2020-01-09 08:41:53 -05:00
Bruce Wells
2db48eff95 PHP 7.4 support 2019-11-30 18:47:04 -05:00
Bruce Wells
f240380438
Version 1.1 (#51)
* Update README.md and more function support
2019-11-27 12:39:25 -05:00
Bruce Wells
84f3f967b7 Update README.md and more function support 2019-11-27 12:33:50 -05:00
Bruce Wells
44a13487b5 Merge branch 'master' of https://github.com/neonxp/MathExecutor
# Conflicts:
#	.gitignore
#	tests/MathTest.php
2019-11-27 11:19:42 -05:00
franksl
f975f0bfbc TokenFactory: allowing multicharacter tokens (#49) 2019-11-26 09:02:56 -05:00
franksl
29c5b5006c Logicandcompare (#50)
* TokenFactory: allowing multicharacter tokens

* Added logical and compare operators: <, <=, >, >=, ==, !=, ||, &&

* Fixed operator priorities

* Error messages fixes

* Fixed operators priority

The priorities are assigned by following the php language standard
(https://www.php.net/manual/en/language.operators.precedence.php)
I've assigned precedence in steps of 10 units by following the linked page:
230 clone new
220 **
210 ++ -- ~ (int) (float) (string) (array) (object) (bool) @
200 instanceof
190 !
180 * / %
170 + - .
160 << >>
150 < <= > >=
140 == != === !== <> <=>
130 &
120 ^
110 |
100 &&
 90 ||
 80 ??
 70 ? :
 60 = += -= *= **= /= .= %= &= |= ^= <<= >>=
 50 yield from
 40 yield
 30 and
 20 xor
 10 or

* Added if() function

* Cache key fix

There are cases where the cache key creation raised an error, for example
while evaluating the expression "if(cos(2), cos(2), 0)", because the
if() function was passing a float to the MathExecutor:execute() method.
2019-11-26 09:00:24 -05:00
Bruce Wells
adf43bc705 Merge branch 'master' of https://github.com/phpfui/MathExecutor 2019-10-31 08:31:34 -04:00
Bruce Wells
b8456057af
Upgrading to PHP 7.1 (#48)
* Subtraction fix (#46) (#7)

* Updated unit tests
* Fixed docs
* Better unary minus support

* Subtraction fix (#46) (#8)

* Updated unit tests
* Fixed docs
* Better unary minus support

* Upgrading PHPUnit and dropping support for 5.6 and 7.0
2019-10-30 22:14:36 -04:00
Bruce Wells
7988714aaa Upgrading PHPUnit and dropping support for 5.6 and 7.0 2019-10-30 22:02:25 -04:00
Bruce Wells
6080fd414d
Subtraction fix (#46) (#8)
* Updated unit tests
* Fixed docs
* Better unary minus support
2019-10-30 21:54:39 -04:00
Bruce Wells
8b5c704990 Merge branch 'master' of https://github.com/phpfui/MathExecutor 2019-08-16 14:02:31 -04:00
Bruce Wells
a4849cbcc5
Subtraction fix (#46) (#7)
* Updated unit tests
* Fixed docs
* Better unary minus support
2019-08-16 14:01:53 -04:00
Bruce Wells
ce50015732
Subtraction fix (#46)
* Updated unit tests
* Fixed docs
* Better unary minus support
2019-08-16 10:27:44 -04:00
Bruce Wells
2bc89df821 Merge branch 'master' of https://github.com/phpfui/MathExecutor
# Conflicts:
#	src/NXP/Classes/Token/TokenFunction.php
2019-08-16 08:35:06 -04:00
Alexander Kiryukhin
36b252b7c9
Merge pull request #44 from phpfui/master
* Fixed comma operator

Added unit tests for expressions in function arguments.
Changed array_push to $var[] = native code.

* Fixed merge error

* Fixed typo in constant
2019-01-16 10:27:56 +03:00
Bruce Wells
e1b770d6c8 Fixed typo in constant 2019-01-15 20:51:21 -05:00
Bruce Wells
2e847d6b81 Fixed merge error 2019-01-15 20:12:24 -05:00
Bruce Wells
01a0c8e627
Merge branch 'master' into master 2019-01-15 20:07:49 -05:00