- Refactored match statement in
Evaluator.php
file
- Add comment description to the case in
ParserOption
ENUM
- Moved
phpunit
from "require" to "require-dev" incomposer.json
file
- Added more tests to
EvaluatorTest.php
for checking if/elseif/else statements logic - Fixed wrong printing of the expression statement when calling a
String()
method on it
- Inlined one in CoreParserTest.php because it was used only in one place
- Change IfStatement ast node to a better implementation
- Simplified Lexer code
- Add support for grouped expressions. Now you can use them like this:
{{ (1 + 2) * 3 }}
- Added support for comparison operators like
==
,===
,!==
,!=
,<
,>
,<=
,>=
. Now you can use them like this:{{ if 1 == 1 }}
,{{ if 1 === 1 }}
,{{ if 1 !== 1 }}
,{{ if 1 != 1 }}
,{{ if 1 < 1 }}
,{{ if 1 > 1 }}
,{{ if 1 <= 1 }}
,{{ if 1 >= 1 }}
- Improved error handling for operators
- Added more tests to make sure that everything works as expected
- Added more info to the
README.md
file - Added assign statement to the BNF grammar
- Added a third parameter to a
Parser.php
which exceptsParserOption
ENUM
- Added
elseif
statements to a BNF grammar - Added
.gitattributes
file to ignore HTML files intests/files
directory - Updated code to level 9 of the PHP Stan static analysis tool
- Fixed a typo in the change log file
- Added variable declaration statement support. Now you can declare variables like this:
{{ $name = 'Anna' }}
. Variable declaration is a statement, and must be surrounded with curly braces - 🐛 Bug fix,
$index
variable was accessible outside of the loop. Now, it will throw an error that variable $index is undefined.
- Added support for
elseif (<expression>)
andelse if (<expression>)
statements like we have in PHP. You can use them like this:{{ if true }}<h1>True</h1>{{ elseif false }}<h1>False</h1>{{ else }}<h1>Something else</h1>{{ end }}
- Added PHP Stan static analysis tool
- Added CS Fixer code style fixer
- 🐛 Bug fixes in the
Parser.php
class related to readonly properties being set later in the code - Improved error handling
- Changed tests back to PHPUnit from Pest, because Pest is kinda sucks and doesn't work as I want. It lacks of error descriptive error messages when tests fail. It's hard to debug. So, I decided to go back to PHPUnit
- 🐛 Bug fix of the error that was happening when you condition of the if statement was false
- Installed
CS Fixer
to the project
- Added support for math expressions: add (+), subtract (-), multiply (*), divide (/), modulo (%). Now you can use it like this:
{{ 1 + 2 }}
,{{ 1 - 2 }}
,{{ 1 * 2 }}
,{{ 1 / 2 }}
,{{ 1 % 2 }}
- Added BNF (Backus-Naur Form) grammar
- Changed
if
andloop
expression to statements - Refactored and restructured AST nodes for better readability
- Removed
final
keyword from all the classes to make it easier to extend the package - Introduced Pratt Parsing
- Replaced PHPUnit with Pest testing framework
- 🐛 Fixed bug with wrong ternary expression precedence. Negation operator (!) was negating the whole ternary expression instead of the boolean part of it. Now, the negation operator (!) will negate only the boolean part of the ternary expression. Before:
(!(true ? 1 : 0))
. After:((!true) ? 1 : 0)
. - Added concatenation for strings. Now you can use it like this:
{{ 'Serhii ' . ' Cho' }}
- Added support for
null
type support. Now you can usenull
like this:{{ if null }}
- Added negation operator (
!
). Now you can use it like this:{{ if !true }}
or{{ if !false }}
- Improved code readability to refactoring the
Lexer
class
- Changed the first parameter of the
Parser
class. Now, it accepts absolute path to the template file or a string with template content. Before, it was accepting only the path - Improved code readability to refactoring the
Parser
class - Added support for
floats
. Now you can usefloats
like this:{{ if 1.2 }}
- 🐛 Bug fix, when you pass a relative path as a first argument to the
Parser
class. Now, it will throw an exception with a descriptive message
- Rewritten the whole package to proper Lexical Analyzer, Parser and Evaluator. Now you can do that you couldn't do before. Like using nested loops, if statements, ternary operators and so on.
- Rewritten the whole documentation
- Rewritten the tests
- Dropped support for PHP versions below 8.2. Now, the minimum required PHP version is 8.2
- Added BOOLEAN type support for the parser. Now you can use
true
andfalse
like this:{{ if true }}
or `{{ if false }} - Added STRING type support for the parser. Now you can use strings like this:
{{ 'some string' }}
or{{ if "some string" }}
- Added quote escaping for strings. Now you can use strings like this:
{{ 'some \'string\'' }}
or{{ if "some \"string\"" }}
- Added support for PHP 8.3
- Added
CHANGELOG.md
file to the project
- Installed Pint
- Added Pint analyzer
- Added support for PHP 8.2
- Small fixes
- Added support for loops
- Fixed various bugs
- Added more tests
- Added support for ternary operator
- Refactored code
- Added more tests
- Added more info to README.md
- Added LISCENCE.md
- Added support for if/else statements
- Added support for php7.1 in composer.json
- Connected to GitHub actions
- Added more tests
- Refactored the main Parser class
- Added comments
- Added information to documentation
- First release with if statements supported
- First ever version