Skip to content

Improve Parser implementation#1508

Open
odenix wants to merge 1 commit intoapple:mainfrom
odenix:improve-parser
Open

Improve Parser implementation#1508
odenix wants to merge 1 commit intoapple:mainfrom
odenix:improve-parser

Conversation

@odenix
Copy link
Copy Markdown
Contributor

@odenix odenix commented Apr 7, 2026

  • Make leaf AST classes final
  • Make protected Lexer fields private and add getter
  • Split Parser into Parser and ParserImpl
    • Using a fresh ParserImpl instance per parse simplifies reasoning (important) and makes the Parser API thread-safe (nice to have)
  • Split GenericParser into GenericParser and GenericParserImpl
    • Same motivation as for Parser

Some of these changes will facilitate the move to JSpecify, which has proven challenging for this package.

- Make leaf AST classes final
- Make protected Lexer fields private and add getter
- Split Parser into Parser and ParserImpl
  - Using a fresh ParserImpl instance per parse simplifies reasoning (important)
    and makes the Parser API thread-safe (nice to have)
- Split GenericParser into GenericParser and GenericParserImpl
  - Same motivation as for Parser

Some of these changes will facilitate the move to JSpecify,
which has proven challenging for this package.
Copy link
Copy Markdown
Contributor

@HT154 HT154 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants