-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Feature: Try out parsica #20
Draft
mhsdesign
wants to merge
21
commits into
main
Choose a base branch
from
feature/parsica
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
a6bc964
WIP: Feature: Try out parsica
mhsdesign a3ef1fc
WIP: Parsica use bind instead of Parser::make
mhsdesign 6f94ba3
WIP: Parsica rewrite Precedence to only use @api 50% slower due to `g…
mhsdesign 6354184
WIP: Parsica speed up Precedence via custom strings parser
mhsdesign 41b94c7
WIP: Parsica add MatchParser
mhsdesign 590a5f1
WIP: Parsica NumberLiteralParser support for funny number formats
mhsdesign c58a9c9
WIP: Parsica TagNode Parsing
mhsdesign fc5fbf7
WIP: Parsica Improve Precedence handling and extract parser into sepa…
mhsdesign 3870cd6
WIP: Parsica parse TemplateLiteralNode
mhsdesign ab5ddd3
WIP: Parsica cleanup MatchParser
mhsdesign df231cd
WIP: Parsica minor cleanups
mhsdesign 018c156
WIP: Parsica implement Module Import Export Component Enum and Struct
mhsdesign ad4b62a
WIP: Parsica implement TagAttributes, Refine `SourcePath` handling en…
mhsdesign 893015d
WIP: Parsica add correct whitespace handling in html tags
mhsdesign 8aad772
WIP: Parsica simple comment handling in few places to make tests happ…
mhsdesign cc2c9c7
WIP: Parsica expression brace handling ()
mhsdesign 1e87337
WIP: Parsica match node with multiple expressions as match arm
mhsdesign 0b23265
WIP: Parsica clean up unnecessary flyweights (singletons)
mhsdesign b579257
TASK: ExpressionParser use lazy identity for nested parsers
mhsdesign 0fa187a
TASK: Add instance cache for all expressionRootParser
mhsdesign 8788d30
Merge branch 'main' into feature/parsica
grebaldi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
|
||
namespace PackageFactory\ComponentEngine\Parser\Ast; | ||
|
||
use PackageFactory\ComponentEngine\Parser\Parser\Identifier\IdentifierParser; | ||
use PackageFactory\ComponentEngine\Parser\Source\Source; | ||
use PackageFactory\ComponentEngine\Parser\Tokenizer\Scanner; | ||
use PackageFactory\ComponentEngine\Parser\Tokenizer\Token; | ||
|
@@ -30,18 +31,14 @@ | |
|
||
final class IdentifierNode implements \JsonSerializable | ||
{ | ||
private function __construct( | ||
public function __construct( | ||
public readonly string $value | ||
) { | ||
} | ||
|
||
public static function fromString(string $identifierAsString): self | ||
{ | ||
return self::fromTokens( | ||
Tokenizer::fromSource( | ||
Source::fromString($identifierAsString) | ||
)->getIterator() | ||
); | ||
return IdentifierParser::get()->tryString($identifierAsString)->output(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The whole method |
||
} | ||
|
||
/** | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,15 +23,16 @@ | |
namespace PackageFactory\ComponentEngine\Parser\Ast; | ||
|
||
use PackageFactory\ComponentEngine\Parser\Ast\IdentifierNode; | ||
use PackageFactory\ComponentEngine\Parser\Source\Path; | ||
use PackageFactory\ComponentEngine\Parser\Source\Source; | ||
use PackageFactory\ComponentEngine\Parser\Tokenizer\Scanner; | ||
use PackageFactory\ComponentEngine\Parser\Tokenizer\Token; | ||
use PackageFactory\ComponentEngine\Parser\Tokenizer\TokenType; | ||
|
||
final class ImportNode implements \JsonSerializable | ||
{ | ||
private function __construct( | ||
public readonly Source $source, | ||
public function __construct( | ||
public readonly Path $sourcePath, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Excellent move! |
||
public readonly string $path, | ||
public readonly IdentifierNode $name | ||
) { | ||
|
@@ -64,7 +65,7 @@ public static function fromTokens(\Iterator $tokens): \Iterator | |
|
||
while (true) { | ||
$identifier = IdentifierNode::fromTokens($tokens); | ||
yield new self($source, $path, $identifier); | ||
yield new self($source->path, $path, $identifier); | ||
|
||
Scanner::skipSpaceAndComments($tokens); | ||
if (Scanner::type($tokens) === TokenType::COMMA) { | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EnumDeclarationNode::fromString
might as well be removed then.