Releases: devtheorem/php-handlebars-parser
Releases · devtheorem/php-handlebars-parser
2.1.0 Uncontrolled Space
Added
parseWithoutProcessing()method.
Changed
- Optimized whitespace control and lexer position advancement.
- Removed underscore from
PathExpression::this_to align with the Handlebars.js AST.
Fixed
- Close tag indentation wasn't consistently stripped from chained
{{else if}}branches of a standalone block. - Tilde whitespace control in one
{{~else if}}branch unexpectedly leaked onto unrelated branches.
Both of the above issues stemmed from bugs in the Handlebars.js parser, and I opened PR handlebars-lang/handlebars-parser#31 to also fix them there.
2.0.0 Stateless Parser
Changed
- Moved the optional
ignoreStandaloneparameter fromParserFactory::create()to theParser::parse()method. This makes the parser instance independent of options so it can be reused when compiling multiple templates, enabling better performance and lower memory usage.
1.1.2 Zero Head
Fixed
- Parsing of
0as path expression head (devtheorem/php-handlebars#16).
Changed
- Optimized parser slightly by replacing a few unnecessary
preg_matchcalls.
1.1.1 Root SubExpression
Fixed
- Parsing of SubExpressions that are PathExpression roots.
1.1.0 Optimal Lexer
This release will be the foundation for PHP Handlebars 1.0.
Changed
- Optimized position tracking to avoid per-token full-text rescans.
- Made use of the
preg_match()offset parameter and\Ganchor to avoid per-token string allocations. - Combined alternation pattern per state: replaced N separate
preg_match()calls (one per rule) with a single call against a per-state/\G(?:(rule0)|(rule1)|...)/pattern, letting PCRE try all alternatives in one pass.
Added
- Benchmark to test parsing a large, complex template 1000 times.
In this release, parsing a complex, 13 KB Handlebars template is now about 30x faster than in v1.0.0.
1.0.0 Initial Release
The full Handlebars.js grammar, whitespace control, and parse error handling is now implemented in native PHP.