Introducing petitparser grammar#51
Merged
Merged
Conversation
…rsion to 4.0.0-beta.4
There was a problem hiding this comment.
Pull request overview
This PR replaces the ANTLR-based Apex/Apexdoc parsing pipeline with handwritten petitparser grammars, updating the Dart and Node/Wasm build + test setup accordingly.
Changes:
- Introduces new
petitparsergrammars for Apex declarations and Apexdoc comments, removing ANTLR walkers/listeners and generated grammar artifacts. - Updates Dart unit/integration tests to parse via the new
ApexParser/ApexdocParserAPIs (including new parser-focused test coverage). - Switches the Node packaging flow to ship a Wasm module + loader (
node.wasm+node.mjs) and updates docs/build scripts.
Reviewed changes
Copilot reviewed 57 out of 63 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tool/grind.dart | Removes old grinder-based dart2js build task. |
| test/walker_test.dart | Removes walker-based ANTLR traversal test. |
| test/type_references_test.dart | Refactors type reference tests to parse real Apex snippets. |
| test/type_references_end_to_end_test.dart | Updates end-to-end type reference tests to use new parsers. |
| test/apexdoc_parser_test.dart | Adds coverage for new Apexdoc parsing edge cases (aliases, fences, whitespace). |
| test/apexdoc_integration_test.dart | Updates integration tests to parse via new Apex parser API. |
| test/apex_parser_test.dart | Adds comprehensive tests for new Apex grammar behavior. |
| README.md | Documents new petitparser-based parsing and Wasm build workflow. |
| pubspec.yaml | Removes ANTLR/grinder/mocktail; adds petitparser; bumps Dart SDK constraint. |
| lib/src/service/walker.dart | Removes ANTLR walker abstraction. |
| lib/src/service/utils/parsing/parsing_utils.dart | Removes old parsing utils export barrel. |
| lib/src/service/utils/parsing/parameters_parser.dart | Removes ANTLR-based parameter parsing helper. |
| lib/src/service/utils/parsing/enum_utils.dart | Removes enum utility previously used by ANTLR parsing. |
| lib/src/service/utils/parsing/access_modifiers_parser.dart | Removes ANTLR-based modifier parsing helper. |
| lib/src/service/parsers.g.dart | Regenerates JSON serialization glue after model/parser refactor. |
| lib/src/service/parsers.dart | Switches parsing entrypoints to petitparser grammars. |
| lib/src/service/grammar/apexdoc_grammar.dart | Adds petitparser grammar for Apexdoc comments. |
| lib/src/service/grammar/apex_grammar.dart | Adds petitparser grammar for Apex declarations/triggers. |
| lib/src/service/declaration_descriptor.dart | Adds new modifier/annotation classification utility for new grammar. |
| lib/src/service/case_insensitive_input_stream.dart | Removes ANTLR-specific case-insensitive input stream. |
| lib/src/service/apexdoc_listener.dart | Removes ANTLR Apexdoc listener. |
| lib/src/service/apex_listener.dart | Removes ANTLR Apex listener and related parsing state machine. |
| lib/src/model/types.g.dart | Regenerates JSON serialization for updated type models. |
| lib/src/model/type_references.g.dart | Regenerates JSON serialization for type references. |
| lib/src/model/type_references.dart | Removes ANTLR context-driven factory; keeps type reference API docs. |
| lib/src/model/multi_line_apex_doc_annotation.dart | Tweaks doc sanitization behavior and simplifies utilities. |
| lib/src/model/modifiers.g.dart | Regenerates JSON serialization for modifiers/annotations. |
| lib/src/model/modifiers.dart | Refactors annotation name/type detection away from ANTLR contexts. |
| lib/src/model/members.g.dart | Regenerates JSON serialization for members. |
| lib/src/model/doc_comment.g.dart | Regenerates JSON serialization for doc comment model. |
| lib/src/model/declaration_mirror.dart | Keeps parsed/raw doc comment in sync via setter update. |
| lib/src/extension_methods/list_extensions.dart | Removes unused containsIgnoreCase helper. |
| lib/src/builders/builders.dart | Removes ANTLR parse-tree-to-model builder functions. |
| lib/src/antlr/grammars/Apexdoc/ApexdocParserListener.dart | Removes ANTLR-generated Apexdoc listener interface. |
| lib/src/antlr/grammars/Apexdoc/ApexdocParserBaseListener.dart | Removes ANTLR-generated Apexdoc base listener. |
| lib/src/antlr/grammars/Apexdoc/ApexdocParser.tokens | Removes ANTLR-generated token file. |
| lib/src/antlr/grammars/Apexdoc/ApexdocParser.interp | Removes ANTLR-generated interpreter file. |
| lib/src/antlr/grammars/Apexdoc/ApexdocParser.g4 | Removes ANTLR Apexdoc grammar source. |
| lib/src/antlr/grammars/Apexdoc/ApexdocLexer.tokens | Removes ANTLR-generated lexer token file. |
| lib/src/antlr/grammars/Apexdoc/ApexdocLexer.interp | Removes ANTLR-generated lexer interpreter file. |
| lib/src/antlr/grammars/Apexdoc/ApexdocLexer.g4 | Removes ANTLR Apexdoc lexer source. |
| lib/src/antlr/grammars/apex/examples/ApexClass.cls | Removes ANTLR example source. |
| lib/src/antlr/grammars/apex/ApexParser.tokens | Removes ANTLR-generated token file. |
| lib/src/antlr/grammars/apex/ApexParser.g4 | Removes ANTLR Apex grammar source. |
| lib/src/antlr/grammars/apex/ApexLexer.tokens | Removes ANTLR-generated lexer token file. |
| lib/src/antlr/grammars/apex/ApexLexer.g4 | Removes ANTLR Apex lexer source. |
| js/scripts/copy-node-wasm-to-dist.js | Copies both node.wasm and node.mjs into dist/. |
| js/README.md | Updates Node package docs for Wasm distribution and new parsing approach. |
| js/package.json | Bumps package version to a 4.x beta and updates keywords. |
| js/tests/end-to-end.test.mts | Adds regression test ensuring fenced code blocks don’t create tags. |
| analysis_options.yaml | Removes analyzer exclusion for removed ANTLR directory. |
| .idea/libraries/Dart_Packages.xml | Updates IDE package library list to remove ANTLR/mocktail and add petitparser. |
Files not reviewed (1)
- .idea/libraries/Dart_Packages.xml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cesarParra
marked this pull request as ready for review
July 4, 2026 17:33
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.
Refactors the codebase away from ANTLR and instead use the petitparser library