Repository navigation
Port php-parser-in-go to Rust - #1
Merged
Merged
Conversation
Printer writes a tree back as PHP source with Go's default token texts; Formatter lays out tokens and free-floating whitespace. Tests that need a parser are ignored until the parsers land.
…nalysis Add a read-only walk over borrowed trees, store resolved names in node attributes, and port the Go tests; tests that need the parser are ignored until it lands.
Hand-written port of the Go ragel lexers (internal/php8 and internal/scanner) sharing one implementation, with the Go scanner tests, the position builder tests and a test-only token dumper for differential checks against Go.
The dumper approximated Go's IsPrint, so unassigned code points such as U+0378 were printed raw instead of escaped as \u0378.
Port of the goyacc driver, tables and grammar actions of php7.y. It reproduces the Go parser exactly, including error messages and error recovery.
Hand-written recursive descent parser with precedence climbing for expressions. On a syntax error, a recognizer driven by the goyacc tables reproduces the Go error messages and recovery points, and a guided reparse rebuilds the recovered tree. Also nest absolute input paths under the dump output directory, as Go filepath.Join does, and enable the PHP 5 printer tests.
Recursive descent for statements and precedence climbing for expressions build the same tree as the goyacc grammar. Files with a syntax error are re-parsed by the table-driven parser, which reports and recovers exactly like Go.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Port of rectorphp/php-parser-in-go to Rust, to compare parse speed.
tests/fixtures: every source the Go tests parse, with Go's dump and errors; all match byte for byteLaravel, 18157 files, 4 cores: