-
Notifications
You must be signed in to change notification settings - Fork 25
Update to ANTLR 4.13 and add Python 3.13 support #100
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
base: master
Are you sure you want to change the base?
Update to ANTLR 4.13 and add Python 3.13 support #100
Conversation
|
recheck |
- Update antlr4-python3-runtime dependency from ~=4.9.0 to ~=4.13.0 - Regenerate all parser files with ANTLR 4.13.2 (12 files across 3 locations) - Add Python 3.13 to test matrix and classifiers - Add automated grammar regeneration script (scripts/regenerate_grammars.sh) - Update v20 inspector to use TimestampLiteral (grammar API change) - Update v20 tests to use timestamp literal syntax (t'...') - Fix documentation to reference Python3 instead of Python2 for ANTLR - Update GitHub Actions to latest versions (checkout@v4, setup-python@v5) - Bump version to 2.1.0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
d1a5fa1 to
29eac1a
Compare
|
@ejratl @clenk @chisholm @JasonKeirstead @sparrell Hi maintainers! This PR updates ANTLR to 4.13.2 and adds Python 3.13 support. Key improvements over the existing PR #96:
All 177 tests pass, CLA is signed, and CI is green. Would appreciate a review when you have time. Happy to address any feedback! |
|
@brianatdetections Nice work! It would probably be best to include Python 3.14 as a supported target as well; since that would be one more package pulled into support for the modern world. I haven't looked to see about antlr4 version support for 3.14 is; so that could be a issue there. |
|
This is great work! Thank you @brianatdetections The large grammar files make it a bit hard to review - since they are generated, I wonder if it would be possible to omit them and have users generate them on their own - would that be too much of a usability hit? I will work on reviewing this and merge after I have done so. |
|
The generated bindings should be reproducible; so they should be able to be independently generated from the input .g4 files and shown to be the same. Asking users to generate them from g4 files would require them to have java and the appropriate antlr jar available to build them with; which could be a tall order for a python package to ask for. |
Summary
This PR updates the STIX Pattern Validator to use ANTLR 4.13.x and adds Python 3.13 support.
Changes
antlr4-python3-runtimedependency from~=4.9.0to~=4.13.0scripts/regenerate_grammars.shfor easy grammar regenerationBreaking Change Note
The upstream grammar now requires timestamp literals with the
tprefix for STARTSTOP qualifiers (e.g.,START t'2024-01-01T00:00:00Z'instead ofSTART '2024-01-01T00:00:00Z'). This aligns with the current STIX 2.1 specification. The v20 inspector and tests have been updated accordingly.Test Plan
Files Changed
CLA
I have signed the Individual Contributor License Agreement.
🤖 Generated with Claude Code