Commit graph

147 commits

Author SHA1 Message Date
Bruce Wells
17cc5b9dc4
Unary Minus (#84)
Fixed unary minus to allow a minus sign in front of functions and parentheses.
2021-02-16 22:13:44 -05:00
Chun-Sheng, Li
936ee5caca
Improve autoloading, asssertions and CI trigger (#79) 2021-01-05 19:07:33 -05:00
Mirosław Sztorc
2f043ba2b2
CI - new workflow for GitHub actions (#82)
* php>=7.2

* CI workflow - added php matrix
2021-01-05 19:07:15 -05:00
Mirosław Sztorc
a4b0fac121
Cache-control improvements (#81)
* cache-control improvements

* Update src/NXP/MathExecutor.php

yeah, you're right.

Co-authored-by: Alexander Kiryukhin <a.kiryukhin@mail.ru>

* Update MathExecutor.php

braces qfix

* Update MathExecutor.php

Co-authored-by: Alexander Kiryukhin <a.kiryukhin@mail.ru>
2021-01-05 19:06:04 -05:00
Bruce Wells
5ed72fda6f
PHPUnit 8 or higher for PHP 8.0 support (#78) 2020-11-28 11:50:32 -05:00
Bruce Wells
761ac50344
Additional tests Hacktoberfest (#77)
* Additional tests

Co-authored-by: diman3210 <diman-3210@mail.ru>
2020-10-19 19:25:48 -04:00
diman3210
e28c1bf9e7
add new functions and aliases to the old functions (#76)
* add new functions and aliases to the old functions

* add tests for new functions
2020-10-19 18:48:30 -04:00
Bruce Wells
d9eb39e38d
Improved unit tests (#74)
* Variable fixes (#67)

* Reproduce if throws UnknownOperatorException

* Fix variable detection

* Adding IncorrectNumberOfFunctionParametersException

* Removing tabs

* Better exception message text

* 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

* Release prep (#69)

* String comparison unit tests

* getVars and getFunctions sanity checks

* Add dynamic variable documentation

* Better setVar error message (#70)

Additional unit tests
Readme update

* Improved support for null variables (#72)

* 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

* Better support for null variables

* Better support for null variables

* Better support for null variables

* Allow null values in `setVar` method (#73)

* 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

* Better support for null variables

* Better support for null variables

* Better support for null variables

* Allow null values in `setVar` method

* Better unit testing

Co-authored-by: Javier Marín <javier@marinros.com>
2020-09-15 21:27:43 -04:00
Javier Marín
8aa6674831
Allow null values in setVar method (#73)
* 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

* Better support for null variables

* Better support for null variables

* Better support for null variables

* Allow null values in `setVar` method
2020-09-15 21:08:14 -04:00
Javier Marín
f8faf3fa8d
Improved support for null variables (#72)
* 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

* Better support for null variables

* Better support for null variables

* Better support for null variables
2020-09-14 20:47:26 -04:00
Bruce Wells
44d72cc252
Better setVar error message (#70)
Additional unit tests
Readme update
2020-07-27 12:25:59 -04:00
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
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