Commit graph

178 commits

Author SHA1 Message Date
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
Bruce Wells
47df3edbb6 Fixed comma operator
Added unit tests for expressions in function arguments.
Changed array_push to $var[] = native code.
2019-01-15 20:04:16 -05:00
Bruce Wells
265cff175e Fixed function parameter order
Corrected $places default value for addFunction to match TokenFactory
Added function order test and put expected order first in assertEquals
If else blocks in calculator
Updated docs
2019-01-15 18:36:10 -05:00
Bruce Wells
0437f808f2
sync (#6)
* Fixed function parameter order (#42)

* Fixed parsing for ()

* sync (#5)

* Documentation fixes (#34)

Fixing typos in and clarifying documentation.

* MathExecutor allow override default operators, functions and vars (#36)

* Added simple coc (#37)

* Added simple coc

* Fix

* Replaceable operators (#38)

* Updated from NeonXP/MathExecutor

* Fixed function in () block issue

* Fixing typos in and clarifying documentation.

* Syncing from origin (#3)

* Documentation fixes (#34)

Fixing typos in and clarifying documentation.

* MathExecutor allow override default operators, functions and vars (#36)

* Allow for operators to be replaced based on regex expression

* Fix md typo (#39)

* Updated from NeonXP/MathExecutor

* Fixed function in () block issue

* Fixing typos in and clarifying documentation.

* Syncing from origin (#3)

* Documentation fixes (#34)

Fixing typos in and clarifying documentation.

* MathExecutor allow override default operators, functions and vars (#36)

* Syncing to origin (#4)

* Documentation fixes (#34)

Fixing typos in and clarifying documentation.

* MathExecutor allow override default operators, functions and vars (#36)

* Added simple coc (#37)

* Added simple coc

* Fix

* Replaceable operators (#38)

* Updated from NeonXP/MathExecutor

* Fixed function in () block issue

* Fixing typos in and clarifying documentation.

* Syncing from origin (#3)

* Documentation fixes (#34)

Fixing typos in and clarifying documentation.

* MathExecutor allow override default operators, functions and vars (#36)

* Allow for operators to be replaced based on regex expression

* \\ instead of \

* Update README.md

Some small fixes

* Fix single quotes parsing (#41)

* Fix single quotes parsing
Fix e-mails
Some small fixes

* Mistake in test

* More PHP versions

* Update README.md

Deleted `dev` branch

* Fixed function parameter order

Corrected $places default value for addFunction to match TokenFactory
Added function order test and put expected order first in assertEquals
If else blocks in calculator
Updated docs

* Create code-of-conduct.ru.md

* Update code-of-conduct.ru.md
2019-01-15 18:33:27 -05:00
Alexander Kiryukhin
5a26d651dd
Update code-of-conduct.ru.md 2019-01-12 16:31:43 +03:00
Alexander Kiryukhin
13fe23fcb0
Create code-of-conduct.ru.md 2019-01-12 16:31:24 +03:00
Bruce Wells
816c112fcd Fixed function parameter order (#42)
* Fixed parsing for ()

* sync (#5)

* Documentation fixes (#34)

Fixing typos in and clarifying documentation.

* MathExecutor allow override default operators, functions and vars (#36)

* Added simple coc (#37)

* Added simple coc

* Fix

* Replaceable operators (#38)

* Updated from NeonXP/MathExecutor

* Fixed function in () block issue

* Fixing typos in and clarifying documentation.

* Syncing from origin (#3)

* Documentation fixes (#34)

Fixing typos in and clarifying documentation.

* MathExecutor allow override default operators, functions and vars (#36)

* Allow for operators to be replaced based on regex expression

* Fix md typo (#39)

* Updated from NeonXP/MathExecutor

* Fixed function in () block issue

* Fixing typos in and clarifying documentation.

* Syncing from origin (#3)

* Documentation fixes (#34)

Fixing typos in and clarifying documentation.

* MathExecutor allow override default operators, functions and vars (#36)

* Syncing to origin (#4)

* Documentation fixes (#34)

Fixing typos in and clarifying documentation.

* MathExecutor allow override default operators, functions and vars (#36)

* Added simple coc (#37)

* Added simple coc

* Fix

* Replaceable operators (#38)

* Updated from NeonXP/MathExecutor

* Fixed function in () block issue

* Fixing typos in and clarifying documentation.

* Syncing from origin (#3)

* Documentation fixes (#34)

Fixing typos in and clarifying documentation.

* MathExecutor allow override default operators, functions and vars (#36)

* Allow for operators to be replaced based on regex expression

* \\ instead of \

* Update README.md

Some small fixes

* Fix single quotes parsing (#41)

* Fix single quotes parsing
Fix e-mails
Some small fixes

* Mistake in test

* More PHP versions

* Update README.md

Deleted `dev` branch

* Fixed function parameter order

Corrected $places default value for addFunction to match TokenFactory
Added function order test and put expected order first in assertEquals
If else blocks in calculator
Updated docs
2019-01-12 16:23:25 +03:00
Bruce Wells
c7f937c002
Merge branch 'master' into master 2019-01-12 00:05:03 -05:00
Bruce Wells
44e2bb192e Fixed function parameter order
Corrected $places default value for addFunction to match TokenFactory
Added function order test and put expected order first in assertEquals
If else blocks in calculator
Updated docs
2019-01-11 23:56:39 -05:00
Bruce Wells
145a0a136f Merge branch 'master' of https://github.com/phpfui/MathExecutor
# Conflicts:
#	src/NXP/Classes/Lexer.php
2019-01-11 21:45:29 -05:00