Skip to content

Commit

Permalink
Exported ErrorNode class
Browse files Browse the repository at this point in the history
Also enabled Github build action
  • Loading branch information
mike-lischke committed Sep 8, 2023
1 parent f4cc2a3 commit 0ca9391
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 10 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Build & Test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [19.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test
25 changes: 22 additions & 3 deletions ReadMe.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# JavaScript + TypeScript Target Runtime for ANTLR 4

[![npm version](https://img.shields.io/npm/v/antlr4)](https://www.npmjs.com/package/antlr4)
[![Badge showing the supported LTS versions of Node.JS in the latest NPM release](https://img.shields.io/node/v-lts/antlr4)](https://www.npmjs.com/package/antlr4)
[![npm type definitions](https://img.shields.io/npm/types/antlr4)](https://www.npmjs.com/package/antlr4)
[![Build & Test](https://github.com/mike-lischke/antlr4ng/actions/workflows/nodejs.yml/badge.svg?branch=master)](https://github.com/mike-lischke/antlr4ng/actions/workflows/nodejs.yml)[![Downloads](https://img.shields.io/npm/dw/antlr4ng?color=blue)](https://www.npmjs.com/package/antlr4ng)

[![npm version](https://img.shields.io/npm/v/antlr4ng)](https://www.npmjs.com/package/antlr4ng)
[![Badge showing the supported LTS versions of Node.JS in the latest NPM release](https://img.shields.io/node/v-lts/antlr4ng)](https://www.npmjs.com/package/antlr4)


This package is a fork of the official ANTLR4 JavaScript runtime, with the following changes:

Expand All @@ -15,3 +17,20 @@ This package is a fork of the official ANTLR4 JavaScript runtime, with the follo
- Smaller node package (no test specs or other unnecessary files).

It is a drop-in replacement of the `antlr4` package, and can be used as such. For more information about ANTLR see www.antlr.org. More details about the JavaScript/TypeScript target can be found [here](https://github.com/antlr/antlr4/blob/master/doc/javascript-target.md).

## Release Notes

### 1.0.2
- Github build action
- Updated package.json
- Exported `ErrorNode`

### 1.0.1

- Added and/or replaced all copyrights to a common ANTLR version.
- Removed all individual default exports. Only the final lib exports contain both, default and non-default exports. This avoids namespace access like `antlr4.atn`. Everything is available under a top level import.
- Renamed ErrorListener to BaseListener, as that is what it is actually when comparing it to the Java runtime.

### 1.0.0

- Initial release.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "antlr4ng",
"version": "1.0.1",
"version": "1.0.2",
"type": "module",
"description": "Alternative JavaScript/TypeScript runtime for ANTLR4",
"browser": "dist/antlr4.web.mjs",
"main": "dist/antlr4.node.mjs",
"types": "src/antlr4/index.d.ts",
"repository": "antlr/antlr4.git",
"repository": "https://github.com/mike-lischke/antlr4ng",
"keywords": [
"lexer",
"parser",
Expand Down
6 changes: 3 additions & 3 deletions src/antlr4/index.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { Parser } from './Parser.js';
import { TokenStream } from './TokenStream.js';
import { TokenStreamRewriter } from './TokenStreamRewriter.js';
import { Vocabulary } from "./Vocabulary.js";

import { RuleContext } from './context/RuleContext.js';
import { ParserRuleContext } from './context/ParserRuleContext.js';
import { ATN } from './atn/ATN.js';
Expand Down Expand Up @@ -47,6 +46,7 @@ import { ParseTreeWalker } from "./tree/ParseTreeWalker.js";
import { BaseErrorListener } from "./error/BaseErrorListener.js";
import { DiagnosticErrorListener } from "./error/DiagnosticErrorListener.js";
import { TerminalNode } from "./tree/TerminalNode.js";
import { ErrorNode } from "./tree/ErrorNode.js";

import { XPath } from "./tree/xpath/XPath.js";

Expand All @@ -62,7 +62,7 @@ export default {
PredictionContextCache, LexerATNSimulator, ParserATNSimulator, DFA, RecognitionException, NoViableAltException,
FailedPredicateException, BaseErrorListener, DiagnosticErrorListener, BailErrorStrategy, DefaultErrorStrategy, LexerNoViableAltException,
ParseCancellationException, arrayToString, Vocabulary, TokenStream, Transition, TokenFactory,
XPath, ATNSimulator, TokenStreamRewriter
XPath, ATNSimulator, TokenStreamRewriter, ErrorNode
};

export {
Expand All @@ -73,5 +73,5 @@ export {
PredictionContextCache, LexerATNSimulator, ParserATNSimulator, DFA, RecognitionException, NoViableAltException,
FailedPredicateException, BaseErrorListener, DiagnosticErrorListener, BailErrorStrategy, DefaultErrorStrategy, LexerNoViableAltException,
ParseCancellationException, arrayToString, Vocabulary, TokenStream, Transition, TokenFactory,
XPath, ATNSimulator, TokenStreamRewriter
XPath, ATNSimulator, TokenStreamRewriter, ErrorNode
};
6 changes: 4 additions & 2 deletions src/antlr4/index.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ import { BaseErrorListener } from "./error/BaseErrorListener.js";
import { DiagnosticErrorListener } from "./error/DiagnosticErrorListener.js";
import { LexerNoViableAltException } from "./error/LexerNoViableAltException.js";
import { TerminalNode } from "./tree/TerminalNode.js";
import { ErrorNode } from "./tree/ErrorNode.js";

import { arrayToString } from "./utils/arrayToString.js";

import { Transition } from "./transition/Transition.js";
Expand All @@ -58,7 +60,7 @@ export default {
PredictionContextCache, LexerATNSimulator, ParserATNSimulator, DFA, RecognitionException, NoViableAltException,
FailedPredicateException, BaseErrorListener, DiagnosticErrorListener, BailErrorStrategy, DefaultErrorStrategy, LexerNoViableAltException,
ParseCancellationException, arrayToString, TokenStream, TokenStreamRewriter, Vocabulary, Transition, TokenFactory,
ATNSimulator
ATNSimulator, ErrorNode
};

export {
Expand All @@ -69,5 +71,5 @@ export {
PredictionContextCache, LexerATNSimulator, ParserATNSimulator, DFA, RecognitionException, NoViableAltException,
FailedPredicateException, BaseErrorListener, DiagnosticErrorListener, BailErrorStrategy, DefaultErrorStrategy, LexerNoViableAltException,
ParseCancellationException, arrayToString, TokenStream, TokenStreamRewriter, Vocabulary, Transition, TokenFactory,
ATNSimulator
ATNSimulator, ErrorNode
};

0 comments on commit 0ca9391

Please sign in to comment.