refactor: consolidate syntax crates, introduce type syntax & core syntax #179
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.
📌 What Does This PR Do?
This PR introduces a significant refactoring of the crates related to syntax processing within the Mago workspace, aiming for better organization, improved maintainability, and clearer API boundaries.
🔍 Context & Motivation
Currently, several small crates (
mago_ast
,mago_token
,mago_lexer
,mago_parser
,mago_walker
,mago_ast_utils
) handle different aspects of PHP syntax processing. These crates are tightly coupled:Additionally, the PHP docblock type parser, previously developed within
mago_type_checker
( private for now ), is a valuable component that could be useful independently. Common utilities are also shared between the main PHP lexer/parser and this type parser.🛠️ Summary of Changes
Consolidated
mago_syntax
Crate:mago_ast
,mago_ast_utils
,mago_token
,mago_lexer
,mago_parser
, andmago_walker
into a single, unified crate namedmago_syntax
.New
mago_type_syntax
Crate:TypeLexer
), token definitions (TypeToken
,TypeTokenKind
), parser, AST, and error types.New
mago_syntax_core
Crate:📂 Affected Areas
🔗 Related Issues or PRs
📝 Notes for Reviewers