A new sequence optimization has been added, and the parser now runs ~30% faster!
This could have been a patch release, however, version 4.1 reintroduces a feature from v3.x: the ability to start parsing from any rule you mark with a # symbol.
A reducer is written of the place a rule is recognized at rather than of the last token it has read
// was: the last token of the rule, and the offset it starts at
Number -> { return new Node($token, $offset); } : <T_NUMBER> ;
// now: the place the rule itself is recognized at
Number -> { return new Node($begin, $length); } : <T_NUMBER> ;
$token is gone, $offset is now the offset the rule starts at
Context::$token is replaced by Context::$begin and Context::$length
Added
@error — the message a rule reports in case it cannot be recognized
%token T_OPEN \(
%token T_CLOSE \)
%token T_NAME [a-z]++
Group
: ::T_OPEN::
<T_NAME>
::T_CLOSE:: @error("a closing parenthesis is expected")
;
// "(abc" is now rejected as: a closing parenthesis is expected
A message is written of what the reading has broken on
Group : ::T_OPEN:: <T_NAME> ::T_CLOSE:: @error("got {name} at {line}:{column}") ;
// "(abc\n ," is now rejected as: got T_COMMA at 2:3
{token}, {name}, {value}, {offset}, {line}, {column}, {expected} and {expected_list}
A brace of the message itself is written twice: "write {{name}} to name it"
An unrecognized placeholder breaks the compilation
Phplrt\Parser\Exception\MessagePlaceholder
RuleDefinition::setMessage() and $message
$builder->addConcatenation([$open, $name, $close], 'Group')
->setMessage('a closing parenthesis is expected');
Compiler, LexerBuilder and ParserBuilder report to a PSR-3 logger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
Release Notes
phplrt/phplrt (phplrt/phplrt)v4.1.3
Compare Source
v4.1.2
Compare Source
v4.1.1
Compare Source
What's Changed
Full Changelog: phplrt/phplrt@4.1.0...4.1.1
v4.1.0
Compare Source
TL;DR
A new sequence optimization has been added, and the parser now runs ~30% faster!
This could have been a patch release, however, version 4.1 reintroduces a feature from v3.x: the ability to start parsing from any rule you mark with a # symbol.
Added
Full Changelog: phplrt/phplrt@4.0.3...4.1.0
v4.0.3
Compare Source
What's Changed
Full Changelog: phplrt/phplrt@4.0.2...4.0.3
v4.0.2
Compare Source
What's Changed
Full Changelog: phplrt/phplrt@4.0.1...4.0.2
v4.0.1
Compare Source
// Previously, this rule was removed/optimization and was never called ExampleRule -> { return 42; } : ::T_SKIPPED_TOKEN:: ;Full Changelog: phplrt/phplrt@4.0.0...4.0.1
v4.0.0
Compare Source
v4.0.0-rc3
Compare Source
BC
Support for PHP 8.1 required the removal of readonly classes, so:
A parser generated by RC2 has to be generated again
A generated parser implements ParserInterface rather than extending
Phplrt\Parser\Parser
parameter is still there
Added
is declared
vendor/bin/phplrt compile grammar.pp3 src/Parser.php \ --class Parser --php 8.1 --abstract --no-readonlyannotation below it; an anonymous parser is readonly from PHP 8.3 up
ClassModifier::Final
UnsupportedClassModifierException
Changed
below it
installation on PHP 8.6 and was redundant
Full Changelog: phplrt/phplrt@4.0.0-rc2...4.0.0-rc3
v4.0.0-rc2
Compare Source
BC
// was: the last token of the rule, and the offset it starts at Number -> { return new Node($token, $offset); } : <T_NUMBER> ; // now: the place the rule itself is recognized at Number -> { return new Node($begin, $length); } : <T_NUMBER> ;Added
%token T_OPEN \( %token T_CLOSE \) %token T_NAME [a-z]++ Group : ::T_OPEN:: <T_NAME> ::T_CLOSE:: @error("a closing parenthesis is expected") ; // "(abc" is now rejected as: a closing parenthesis is expectedGroup : ::T_OPEN:: <T_NAME> ::T_CLOSE:: @error("got {name} at {line}:{column}") ; // "(abc\n ," is now rejected as: got T_COMMA at 2:3Number -> { return \substr($content, $begin, $length); } : <T_NUMBER> ;Changed
so a channel of one's own is free to be written otherwise
Full Changelog: phplrt/phplrt@4.0.0-rc1...4.0.0-rc2
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.