Skip to content

BREAKING: Move to antlr4 runtime for Typescript #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
May 13, 2025
Merged

Conversation

pwrightcertinia
Copy link
Contributor

@pwrightcertinia pwrightcertinia commented May 8, 2025

closes #45

In addition to changes below, this PR also improves the build process, as well as enabling code formatting for TS/Java on commit. Files have been formatted, so changes are quite noisy.

From Changelog:

  • (BREAKING) Migrated from antlr4ts to official antlr4 runtime package.
    • Some lesser used methods are missing in the type definitions, refer to the antlr4 Javascript code if you need to cast types.
    • extends is now required to use antlr Listener/Visitor types.
      • Exception being to avoid the property initialisation syntax in the antlr generated types:

        class MyListener extends ParseTreeListener implements ApexParserListener {
          // with 'extends ApexParserListener' you must write this
          enterMethodDeclaration = () => {}
          // this requires 'extends ParseTreeListener implements ApexParserListener'
          enterMethodDeclaration() {}
        }
  • (BREAKING) Updated output to ES2020 and increased min node version to 16.
  • (BREAKING) Updated to ANTLR 4.13.2 across both distributions. Same tool now generates both.
  • (BREAKING) Re-exported antlr types removed, add antlr4 package dep instead matching apex-parser version.
  • Typescript CaseInsensitiveInputStream type now extends CharStream and can be constructed from string.
    • Constructor passing in Charstream retained to match Java version.
  • Removed node-dir dependency - replaced with node fs api.

@pwrightcertinia pwrightcertinia merged commit edaedeb into main May 13, 2025
1 check passed
@pwrightcertinia pwrightcertinia deleted the antlr-update branch May 13, 2025 11:02
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.

chore: replace antlr4ts with antlr4 typescript target
1 participant