Skip to content

Introducing petitparser grammar#51

Merged
cesarParra merged 11 commits into
mainfrom
petitparser-build
Jul 4, 2026
Merged

Introducing petitparser grammar#51
cesarParra merged 11 commits into
mainfrom
petitparser-build

Conversation

@cesarParra

@cesarParra cesarParra commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Refactors the codebase away from ANTLR and instead use the petitparser library

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 petitparser grammars 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/ApexdocParser APIs (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.

Comment thread lib/src/service/grammar/apex_grammar.dart
Comment thread README.md
Comment thread js/README.md

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 57 out of 63 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • .idea/libraries/Dart_Packages.xml: Generated file

Comment thread lib/src/service/grammar/apexdoc_grammar.dart
@cesarParra
cesarParra marked this pull request as ready for review July 4, 2026 17:33
@cesarParra
cesarParra merged commit f670b3e into main Jul 4, 2026
2 checks passed
@cesarParra
cesarParra deleted the petitparser-build branch July 4, 2026 17:34
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