Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
antlr4ng-cli
Advanced tools
Part of the Next Generation ANTLR Project
This package contains a custom code generator for ANTLR4 grammars. It is based on the official ANTLR4 code generator, but includes support for the antlr4ng
runtime, so the TypeScript output is different. Other than that it is a drop-in replacement for the official generator and can also be used with the official runtimes (C++, Java, etc.).
To install the package, run the following command:
npm install antlr4ng-cli
The package needs Java installed on your system, To generate your parser, run the following command:
antlr4ng <options> <grammar-file>
in the root of your project, where you installed the package.
Note: in contrast to
antlr4ts
you have to specify the target language explicitly, just as if you use the generator jar file directly. A typical case would be:antlr4ng -Dlanguage=TypeScript -o generated/ -visitor -listener -Xexact-output-dir path/to/YourLexer.g4 path/to/YourParser.g4
This is the next major release of the code generator, after an overhaul of the antlr4ng runtime. It introduces a number of API changes, but no changes to the original working mechanism. The other targets (C++, Java, etc.) are not affected by this release. All changes in this release are to support the new antlr4ng major release 3.0.0:
_type
-> type
, _channel
-> channel
, _mode
-> mode
, _parseListeners
-> parseListeners
).getText
methods for the token stream, to avoid frequent parameter checking in method overloading.RuleContext
into ParserRuleContext
. It's not used anywhere else, so why keeping it around?ParserRuleContext.exception
has been removed and it is no longer set in generated code (only relevant for error conditions, where a proper exception is passed to error listeners.Code generation improvements, especially for local rule attributes. Attributes in a rule (which are implemented as local variables in the generated code) can be unassigned and need extra null-safety checks (the ? operator) or non-null assertions. The code generator now adds these checks automatically.
Code generation changes:
Compatible with antlr4ng 2.0.0
Code generation changes:
override
keyword is needed in generated classes.ParserRuleContext._ctx
was renamed to ParserRuleContext.context
in the runtime.TokenStream.getText
no longer needs a temporary interval as parameter, but can directly work with start and stop values.override
keyword for generated copyFrom
methods.Updated the ANTLR4 jar.
_interp
-> interpreter
).FAQs
ANTLR4 NG command line tool for TypeScript
The npm package antlr4ng-cli receives a total of 21,007 weekly downloads. As such, antlr4ng-cli popularity was classified as popular.
We found that antlr4ng-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.