Comparing version 3.0.14 to 3.0.15
@@ -18,3 +18,3 @@ import { ParserRuleContext } from "../ParserRuleContext.js"; | ||
* _i_ leads to a semantic predicate before matching a symbol, the | ||
* element at index *i* of the result will be `null`. | ||
* element at index *i* of the result will be `undefined`. | ||
* | ||
@@ -24,3 +24,3 @@ * @param s the ATN state | ||
*/ | ||
getDecisionLookahead(s?: ATNState): Array<IntervalSet | null> | undefined; | ||
getDecisionLookahead(s: ATNState): Array<IntervalSet | undefined>; | ||
/** | ||
@@ -27,0 +27,0 @@ * Compute set of tokens that can follow `s` in the ATN in the |
{ | ||
"name": "antlr4ng", | ||
"version": "3.0.14", | ||
"version": "3.0.15", | ||
"type": "module", | ||
@@ -9,3 +9,6 @@ "description": "Alternative JavaScript/TypeScript runtime for ANTLR4", | ||
"types": "dist/index.d.ts", | ||
"repository": "https://github.com/mike-lischke/antlr4ng", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/mike-lischke/antlr4ng.git" | ||
}, | ||
"keywords": [ | ||
@@ -24,5 +27,3 @@ "lexer", | ||
"homepage": "https://github.com/mike-lischke/antlr4ng", | ||
"peerDependencies": { | ||
"antlr4ng-cli": "^2.0.0" | ||
}, | ||
"sideEffects": false, | ||
"devDependencies": { | ||
@@ -35,2 +36,3 @@ "@mike-lischke/antlr-tgen": "1.0.8", | ||
"@vitest/coverage-v8": "2.1.3", | ||
"antlr-ng": "1.0.1", | ||
"esbuild": "0.23.0", | ||
@@ -60,3 +62,3 @@ "eslint": "8.57.0", | ||
"build-cjs": "npm run build-bundle -- --outfile=dist/index.cjs --format=cjs", | ||
"generate-xpath-lexer": "node cli/index.js -Dlanguage=TypeScript -o src/tree/xpath/generated -no-visitor -no-listener -Xexact-output-dir src/tree/xpath/XPathLexer.g4", | ||
"generate-xpath-lexer": "antlr-ng -Dlanguage=TypeScript --exact-output-dir -o src/tree/xpath/generated src/tree/xpath/XPathLexer.g4", | ||
"profile benchmarks": "node --no-warnings --experimental-vm-modules --prof --loader ts-node/esm tests/benchmarks/run-benchmarks.ts", | ||
@@ -63,0 +65,0 @@ "process profile tick file": " node --prof-process isolate-0x140008000-94064-v8.log > processed.txt" |
@@ -5,11 +5,14 @@ [](https://github.com/mike-lischke/antlr4ng/actions/workflows/nodejs.yml) | ||
<img src="https://raw.githubusercontent.com/mike-lischke/mike-lischke/master/images/ANTLRng2.svg" title="ANTLR Next Generation" alt="ANTLRng" width="96" height="96"/><label style="font-size: 70%">Part of the Next Generation ANTLR Project</label> | ||
<p align="center"> | ||
<img src="https://raw.githubusercontent.com/mike-lischke/mike-lischke/master/images/antlr-ng.svg" title="ANTLR Next Generation" alt="antlr-ng the parser generator" height="200"/><br/> | ||
<label style="font-size: 120%">Part of the Next Generation ANTLR Project</label> | ||
</p> | ||
# TypeScript Runtime for ANTLR 4 | ||
# TypeScript Runtime for antlr-ng and ANTLR4 | ||
This package started as a fork of the official ANTLR4 JavaScript runtime and has been fully implemented in TypeScript. It implements everything what the Java runtime does, except for the `UnbufferedCharStream` class, which requires a streaming source compatible with both Node.js and browsers. Other notable differences from the original JS source. | ||
This package contains a TypeScript runtime implementation for antlr-ng (and ANTLR4). It implements everything what the Java runtime does, except for the `UnbufferedCharStream` class, which requires a streaming source compatible with both Node.js and browsers. Other notable differences from the original JS source. | ||
- Numerous bug fixes and other changes. | ||
- No differentiation between node and browser environments. | ||
- Includes the `antlr4ng-cli` tool to generate parser files compatible with this runtime. This tool uses a custom build of the ANTLR4 tool. | ||
- Use the [antlr-ng](https://github.com/mike-lischke/antlr-ng) tool to generate parser that are compatible with this runtime. | ||
@@ -26,9 +29,2 @@ > The package requires ES2022 (ES6) or newer, for features like static initialization blocks in classes and private properties (`#field`). It is recommended to use the latest TypeScript version. | ||
This package has a peer dependency to `antlr4ng-cli`, which is the tool to generate parser files compatible with this runtime, so it is strongly recommended to install this one too: | ||
```bash | ||
npm install --save-dev antlr4ng-cli | ||
``` | ||
See [its readme](./cli/ReadMe.md) for more information. | ||
If you come from one of the other JS/TS runtimes, you may have to adjust your code a bit. The antlr4ng package more strictly exposes the Java nullability for certain members. This will require that you either use the non-null assertion operator to force the compiler to accept your code, or you have to check for null values before accessing a member. The latter is the recommended way, as it is safer. | ||
@@ -47,3 +43,3 @@ | ||
The following example shows how to use the runtime to parse a simple expression, assuming you have generated the lexer and parser files for the grammar and placed them in a subfolder folder called `generated`. The readme file of the [antlr4ng-cli](./cli/ReadMe.md) tool shows how to do that. Assume we have this expression grammar: | ||
The following example shows how to use the runtime to parse a simple expression, assuming you have generated the lexer and parser files for the grammar and placed them in a subfolder folder called `generated`. The "Getting Started" documentation section on the [antlr-ng](https://www.antlr-ng.org) website explains in detail how to install the tool and generate the files. Assume we have this expression grammar: | ||
@@ -50,0 +46,0 @@ ```antlr |
@@ -1,10 +0,21 @@ | ||
<img src="https://raw.githubusercontent.com/mike-lischke/mike-lischke/master/images/ANTLRng2.svg" title="ANTLR Next Generation" alt="ANTLRng" width="96" height="96"/><label style="font-size: 70%">Part of the Next Generation ANTLR Project</label> | ||
<p align="center"> | ||
<img src="https://raw.githubusercontent.com/mike-lischke/mike-lischke/master/images/antlr-ng.svg" title="ANTLR Next Generation" alt="antlr-ng the parser generator" height="200"/><br/> | ||
<label style="font-size: 120%">Part of the Next Generation ANTLR Project</label> | ||
</p> | ||
# TypeScript Runtime for ANTLR 4 Release Notes | ||
# TypeScript Runtime for antlr-ng and ANTLR4 - Release Notes | ||
##3.0.14 | ||
Note: the previously used peer dependency `antlr4ng-cli` is no longer used and has been deprecated. Instead the new antlr-ng tool is now used for parser generation. | ||
## 3.0.15 | ||
- Switched from antlr4ng-cli to antlr-ng. | ||
- Changed LL1Analyzer.getDecisionLookahead to never return `undefined`. | ||
- Added `sideEffects: false` to package.json to help bundlers. | ||
## 3.0.14 | ||
Bug fix: wrong upper case letter check | ||
##3.0.13 | ||
## 3.0.13 | ||
@@ -11,0 +22,0 @@ - Some member variable init was missing. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
10886956
0
487
366980
0
16
221
1