diff --git a/.gitignore b/.gitignore
index 7b163977..74b417f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
logs/
*.log
npm-debug.log*
+.rpt2_cache
# Runtime data
pids/
diff --git a/benchmark/JavaUnicodeInputStream.ts b/benchmark/JavaUnicodeInputStream.ts
index d66c59ed..3e20fb0d 100644
--- a/benchmark/JavaUnicodeInputStream.ts
+++ b/benchmark/JavaUnicodeInputStream.ts
@@ -11,7 +11,7 @@ import { Interval } from "../src/misc/Interval";
import { NotNull } from "../src/Decorators";
import { Override } from "../src/Decorators";
-import * as assert from "assert";
+import assert from "assert";
const BACKSLASH = "\\".charCodeAt(0);
const LOWER_U = "u".charCodeAt(0);
diff --git a/benchmark/TestPerformance.ts b/benchmark/TestPerformance.ts
index 23903780..511a6294 100644
--- a/benchmark/TestPerformance.ts
+++ b/benchmark/TestPerformance.ts
@@ -12,6 +12,7 @@ import { ANTLRErrorListener } from "../src/ANTLRErrorListener";
import { ANTLRInputStream } from "../src/ANTLRInputStream";
import { Array2DHashSet } from "../src/misc/Array2DHashSet";
import { ATN } from "../src/atn/ATN";
+import { INVALID_ALT_NUMBER } from "../src/atn/Constant";
import { ATNConfig } from "../src/atn/ATNConfig";
import { ATNConfigSet } from "../src/atn/ATNConfigSet";
import { ATNDeserializer } from "../src/atn/ATNDeserializer";
@@ -44,7 +45,7 @@ import { ParserRuleContext } from "../src/ParserRuleContext";
import { ParseTree } from "../src/tree/ParseTree";
import { ParseTreeListener } from "../src/tree/ParseTreeListener";
import { ParseTreeWalker } from "../src/tree/ParseTreeWalker";
-import { PredictionContextCache } from "../src/atn/PredictionContextCache";
+import { PredictionContextCache } from "../src/atn/PredictionContext";
import { PredictionMode } from "../src/atn/PredictionMode";
import { RecognitionException } from "../src/RecognitionException";
import { Recognizer } from "../src/Recognizer";
@@ -68,7 +69,7 @@ import { JavaParser as JavaParserAtn } from "./gen/std-atn/JavaParser";
import { JavaLRParser as JavaLRParser } from "./gen/lr/JavaLRParser";
import { JavaLRParser as JavaLRParserAtn } from "./gen/lr-atn/JavaLRParser";
-import * as assert from "assert";
+import assert from "assert";
import * as fs from "fs";
import * as path from "path";
@@ -243,21 +244,21 @@ export class TestPerformance {
/**
* Parse each file with {@code JavaParser.compilationUnit}.
*/
- private static readonly RUN_PARSER: boolean = true;
+ private static readonly RUN_PARSER: boolean = true;
/**
* {@code true} to use {@link BailErrorStrategy}, {@code false} to use
* {@link DefaultErrorStrategy}.
*/
- private static readonly BAIL_ON_ERROR: boolean = false;
+ private static readonly BAIL_ON_ERROR: boolean = false;
/**
* {@code true} to compute a checksum for verifying consistency across
* optimizations and multiple passes.
*/
- private static readonly COMPUTE_CHECKSUM: boolean = true;
+ private static readonly COMPUTE_CHECKSUM: boolean = true;
/**
* This value is passed to {@link Parser#setBuildParseTree}.
*/
- private static readonly BUILD_PARSE_TREES: boolean = false;
+ private static readonly BUILD_PARSE_TREES: boolean = false;
/**
* Use
* {@link ParseTreeWalker#DEFAULT}{@code .}{@link ParseTreeWalker#walk walk}
@@ -266,9 +267,9 @@ export class TestPerformance {
* will instead be called during the parsing process via
* {@link Parser#addParseListener}.
*/
- private static readonly BLANK_LISTENER: boolean = false;
+ private static readonly BLANK_LISTENER: boolean = false;
- private static readonly EXPORT_LARGEST_CONFIG_CONTEXTS: boolean = false;
+ private static readonly EXPORT_LARGEST_CONFIG_CONTEXTS: boolean = false;
/**
* Shows the number of {@link DFAState} and {@link ATNConfig} instances in
@@ -277,21 +278,21 @@ export class TestPerformance {
* will only apply to one file (the last file if {@link #NUMBER_OF_THREADS}
* is 0, otherwise the last file which was parsed on the first thread).
*/
- private static readonly SHOW_DFA_STATE_STATS: boolean = true;
+ private static readonly SHOW_DFA_STATE_STATS: boolean = true;
/**
* If {@code true}, the DFA state statistics report includes a breakdown of
* the number of DFA states contained in each decision (with rule names).
*/
- public static readonly DETAILED_DFA_STATE_STATS: boolean = true;
+ public static readonly DETAILED_DFA_STATE_STATS: boolean = true;
- private static readonly ENABLE_LEXER_DFA: boolean = true;
+ private static readonly ENABLE_LEXER_DFA: boolean = true;
- private static readonly ENABLE_PARSER_DFA: boolean = true;
+ private static readonly ENABLE_PARSER_DFA: boolean = true;
/**
* If {@code true}, the DFA will be used for full context parsing as well as
* SLL parsing.
*/
- private static readonly ENABLE_PARSER_FULL_CONTEXT_DFA: boolean = false;
+ private static readonly ENABLE_PARSER_FULL_CONTEXT_DFA: boolean = false;
/**
* Specify the {@link PredictionMode} used by the
@@ -299,48 +300,48 @@ export class TestPerformance {
* {@code true}, this value only applies to the second stage, as the first
* stage will always use {@link PredictionMode#SLL}.
*/
- private static readonly PREDICTION_MODE: PredictionMode = PredictionMode.LL;
- private static readonly FORCE_GLOBAL_CONTEXT: boolean = false;
- private static readonly TRY_LOCAL_CONTEXT_FIRST: boolean = true;
- private static readonly OPTIMIZE_LL1: boolean = true;
- private static readonly OPTIMIZE_UNIQUE_CLOSURE: boolean = true;
- private static readonly OPTIMIZE_TAIL_CALLS: boolean = true;
- private static readonly TAIL_CALL_PRESERVES_SLL: boolean = true;
- private static readonly TREAT_SLLK1_CONFLICT_AS_AMBIGUITY: boolean = false;
+ private static readonly PREDICTION_MODE: PredictionMode = PredictionMode.LL;
+ private static readonly FORCE_GLOBAL_CONTEXT: boolean = false;
+ private static readonly TRY_LOCAL_CONTEXT_FIRST: boolean = true;
+ private static readonly OPTIMIZE_LL1: boolean = true;
+ private static readonly OPTIMIZE_UNIQUE_CLOSURE: boolean = true;
+ private static readonly OPTIMIZE_TAIL_CALLS: boolean = true;
+ private static readonly TAIL_CALL_PRESERVES_SLL: boolean = true;
+ private static readonly TREAT_SLLK1_CONFLICT_AS_AMBIGUITY: boolean = false;
- private static readonly TWO_STAGE_PARSING: boolean = true;
+ private static readonly TWO_STAGE_PARSING: boolean = true;
- private static readonly SHOW_CONFIG_STATS: boolean = false;
+ private static readonly SHOW_CONFIG_STATS: boolean = false;
/**
* If {@code true}, detailed statistics for the number of DFA edges were
* taken while parsing each file, as well as the number of DFA edges which
* required on-the-fly computation.
*/
- public static readonly COMPUTE_TRANSITION_STATS: boolean = false;
- private static readonly SHOW_TRANSITION_STATS_PER_FILE: boolean = false;
+ public static readonly COMPUTE_TRANSITION_STATS: boolean = false;
+ private static readonly SHOW_TRANSITION_STATS_PER_FILE: boolean = false;
/**
* If {@code true}, the transition statistics will be adjusted to a running
* total before reporting the final results.
*/
- private static readonly TRANSITION_RUNNING_AVERAGE: boolean = false;
+ private static readonly TRANSITION_RUNNING_AVERAGE: boolean = false;
/**
* If {@code true}, transition statistics will be weighted according to the
* total number of transitions taken during the parsing of each file.
*/
- private static readonly TRANSITION_WEIGHTED_AVERAGE: boolean = false;
+ private static readonly TRANSITION_WEIGHTED_AVERAGE: boolean = false;
/**
* If {@code true}, after each pass a summary of the time required to parse
* each file will be printed.
*/
- private static readonly COMPUTE_TIMING_STATS: boolean = false;
+ private static readonly COMPUTE_TIMING_STATS: boolean = false;
/**
* If {@code true}, the timing statistics for {@link #COMPUTE_TIMING_STATS}
* will be cumulative (i.e. the time reported for the nth file will
* be the total time required to parse the first n files).
*/
- private static readonly TIMING_CUMULATIVE: boolean = false;
+ private static readonly TIMING_CUMULATIVE: boolean = false;
/**
* If {@code true}, the timing statistics will include the parser only. This
* flag allows for targeted measurements, and helps eliminate variance when
@@ -348,17 +349,17 @@ export class TestPerformance {
*
* This flag has no impact when {@link #RUN_PARSER} is {@code false}.
*/
- private static readonly TIME_PARSE_ONLY: boolean = false;
+ private static readonly TIME_PARSE_ONLY: boolean = false;
/**
* When {@code true}, messages will be printed to {@link System#err} when
* the first stage (SLL) parsing resulted in a syntax error. This option is
* ignored when {@link #TWO_STAGE_PARSING} is {@code false}.
*/
- private static readonly REPORT_SECOND_STAGE_RETRY: boolean = true;
- public static readonly REPORT_SYNTAX_ERRORS: boolean = true;
- public static readonly REPORT_AMBIGUITIES: boolean = false;
- public static readonly REPORT_FULL_CONTEXT: boolean = false;
+ private static readonly REPORT_SECOND_STAGE_RETRY: boolean = true;
+ public static readonly REPORT_SYNTAX_ERRORS: boolean = true;
+ public static readonly REPORT_AMBIGUITIES: boolean = false;
+ public static readonly REPORT_FULL_CONTEXT: boolean = false;
public static readonly REPORT_CONTEXT_SENSITIVITY: boolean = TestPerformance.REPORT_FULL_CONTEXT;
/**
@@ -366,27 +367,27 @@ export class TestPerformance {
* {@link Lexer#setInputStream} will be called to initialize it for each
* source file. Otherwise, a new instance will be created for each file.
*/
- private static readonly REUSE_LEXER: boolean = false;
+ private static readonly REUSE_LEXER: boolean = false;
/**
* If {@code true}, a single DFA will be used for lexing which is shared
* across all threads and files. Otherwise, each file will be lexed with its
* own DFA which is accomplished by creating one ATN instance per thread and
* clearing its DFA cache before lexing each file.
*/
- private static readonly REUSE_LEXER_DFA: boolean = true;
+ private static readonly REUSE_LEXER_DFA: boolean = true;
/**
* If {@code true}, a single {@code JavaParser} will be used, and
* {@link Parser#setInputStream} will be called to initialize it for each
* source file. Otherwise, a new instance will be created for each file.
*/
- private static readonly REUSE_PARSER: boolean = false;
+ private static readonly REUSE_PARSER: boolean = false;
/**
* If {@code true}, a single DFA will be used for parsing which is shared
* across all threads and files. Otherwise, each file will be parsed with
* its own DFA which is accomplished by creating one ATN instance per thread
* and clearing its DFA cache before parsing each file.
*/
- private static readonly REUSE_PARSER_DFA: boolean = true;
+ private static readonly REUSE_PARSER_DFA: boolean = true;
/**
* If {@code true}, the shared lexer and parser are reset after each pass.
* If {@code false}, all passes after the first will be fully "warmed up",
@@ -394,31 +395,31 @@ export class TestPerformance {
* but it will not distinguish bytecode load/JIT time from warm-up time
* during the first pass.
*/
- private static readonly CLEAR_DFA: boolean = false;
+ private static readonly CLEAR_DFA: boolean = false;
/**
* Total number of passes to make over the source.
*/
- private static readonly PASSES: number = 4;
+ private static readonly PASSES: number = 4;
/**
* This option controls the granularity of multi-threaded parse operations.
* If {@code true}, the parsing operation will be parallelized across files;
* otherwise the parsing will be parallelized across multiple iterations.
*/
- private static readonly FILE_GRANULARITY: boolean = true;
+ private static readonly FILE_GRANULARITY: boolean = true;
/**
* Number of parser threads to use.
*/
- public static readonly NUMBER_OF_THREADS: number = 1;
+ public static readonly NUMBER_OF_THREADS: number = 1;
- private static readonly sharedLexers: Array = new Array(TestPerformance.NUMBER_OF_THREADS);
- private static readonly sharedLexerATNs: Array = new Array(TestPerformance.NUMBER_OF_THREADS);
+ private static readonly sharedLexers: Array = new Array(TestPerformance.NUMBER_OF_THREADS);
+ private static readonly sharedLexerATNs: Array = new Array(TestPerformance.NUMBER_OF_THREADS);
- private static readonly sharedParsers: Array = new Array(TestPerformance.NUMBER_OF_THREADS);
- private static readonly sharedParserATNs: Array = new Array(TestPerformance.NUMBER_OF_THREADS);
+ private static readonly sharedParsers: Array = new Array(TestPerformance.NUMBER_OF_THREADS);
+ private static readonly sharedParserATNs: Array = new Array(TestPerformance.NUMBER_OF_THREADS);
- private static readonly sharedListeners: Array = new Array(TestPerformance.NUMBER_OF_THREADS);
+ private static readonly sharedListeners: Array = new Array(TestPerformance.NUMBER_OF_THREADS);
private static readonly totalTransitionsPerFile: Uint32Array[] = new Array(TestPerformance.PASSES);
private static readonly computedTransitionsPerFile: Uint32Array[] = new Array(TestPerformance.PASSES);
@@ -451,7 +452,7 @@ export class TestPerformance {
}
let listenerName: string = TestPerformance.USE_LR_GRAMMAR ? "JavaLRBaseListener" : "JavaBaseListener";
- let entryPoint: string = "compilationUnit";
+ let entryPoint: string = "compilationUnit";
let factory: ParserFactory = this.getParserFactory(lexerCtor, parserCtor, EmptyListener, JavaLRParser.prototype.compilationUnit.name, (parser) => parser.compilationUnit());
if (TestPerformance.TOP_PACKAGE.length > 0) {
@@ -462,7 +463,7 @@ export class TestPerformance {
assertTrue(fs.lstatSync(directory).isDirectory());
let filesFilter: FilenameFilter = FilenameFilters.extension(".java", false);
- let directoriesFilter: FilenameFilter = FilenameFilters.ALL_FILES;
+ let directoriesFilter: FilenameFilter = FilenameFilters.ALL_FILES;
let sources: InputDescriptor[] = this.loadSources(directory, filesFilter, directoriesFilter, TestPerformance.RECURSIVE);
for (let i = 0; i < TestPerformance.PASSES; i++) {
@@ -502,10 +503,10 @@ export class TestPerformance {
// }
// }));
for (let i = 0; i < TestPerformance.PASSES - 1; i++) {
- let currentPass: number = i + 1;
- // passResults.add(executorService.submit(new Runnable() {
- // @Override
- // run(): void {
+ let currentPass: number = i + 1;
+ // passResults.add(executorService.submit(new Runnable() {
+ // @Override
+ // run(): void {
if (TestPerformance.CLEAR_DFA) {
let index: number = TestPerformance.FILE_GRANULARITY ? 0 : 0;
if (TestPerformance.sharedLexers.length > 0 && TestPerformance.sharedLexers[index] != null) {
@@ -530,8 +531,8 @@ export class TestPerformance {
// Logger.getLogger(TestPerformance.class.getName()).log(Level.SEVERE, null, ex);
console.error(ex);
}
- // }
- // }));
+ // }
+ // }));
}
// for (let passResult of passResults) {
@@ -579,8 +580,8 @@ export class TestPerformance {
}
}
- let sumNum: Uint32Array = new Uint32Array(TestPerformance.totalTransitionsPerFile[0].length);
- let sumDen: Uint32Array = new Uint32Array(TestPerformance.totalTransitionsPerFile[0].length);
+ let sumNum: Uint32Array = new Uint32Array(TestPerformance.totalTransitionsPerFile[0].length);
+ let sumDen: Uint32Array = new Uint32Array(TestPerformance.totalTransitionsPerFile[0].length);
let sumNormalized: Float64Array = new Float64Array(TestPerformance.totalTransitionsPerFile[0].length);
for (let i = 0; i < TestPerformance.PASSES; i++) {
let num: Uint32Array = TestPerformance.computedTransitionsPerFile[i];
@@ -595,7 +596,7 @@ export class TestPerformance {
}
let weightedAverage: Float64Array = new Float64Array(TestPerformance.totalTransitionsPerFile[0].length);
- let average: Float64Array = new Float64Array(TestPerformance.totalTransitionsPerFile[0].length);
+ let average: Float64Array = new Float64Array(TestPerformance.totalTransitionsPerFile[0].length);
for (let i = 0; i < average.length; i++) {
if (sumDen[i] > 0) {
weightedAverage[i] = sumNum[i] / sumDen[i];
@@ -607,15 +608,15 @@ export class TestPerformance {
average[i] = sumNormalized[i] / TestPerformance.PASSES;
}
- let low95: Float64Array = new Float64Array(TestPerformance.totalTransitionsPerFile[0].length);
- let high95: Float64Array = new Float64Array(TestPerformance.totalTransitionsPerFile[0].length);
- let low67: Float64Array = new Float64Array(TestPerformance.totalTransitionsPerFile[0].length);
- let high67: Float64Array = new Float64Array(TestPerformance.totalTransitionsPerFile[0].length);
- let stddev: Float64Array = new Float64Array(TestPerformance.totalTransitionsPerFile[0].length);
+ let low95: Float64Array = new Float64Array(TestPerformance.totalTransitionsPerFile[0].length);
+ let high95: Float64Array = new Float64Array(TestPerformance.totalTransitionsPerFile[0].length);
+ let low67: Float64Array = new Float64Array(TestPerformance.totalTransitionsPerFile[0].length);
+ let high67: Float64Array = new Float64Array(TestPerformance.totalTransitionsPerFile[0].length);
+ let stddev: Float64Array = new Float64Array(TestPerformance.totalTransitionsPerFile[0].length);
for (let i = 0; i < stddev.length; i++) {
- let points: Float64Array = new Float64Array(TestPerformance.PASSES);
+ let points: Float64Array = new Float64Array(TestPerformance.PASSES);
for (let j = 0; j < TestPerformance.PASSES; j++) {
- let totalTransitions: number = TestPerformance.totalTransitionsPerFile[j][i];
+ let totalTransitions: number = TestPerformance.totalTransitionsPerFile[j][i];
if (totalTransitions > 0) {
points[j] = TestPerformance.computedTransitionsPerFile[j][i] / TestPerformance.totalTransitionsPerFile[j][i];
}
@@ -626,15 +627,15 @@ export class TestPerformance {
points.sort();
- let averageValue: number = TestPerformance.TRANSITION_WEIGHTED_AVERAGE ? weightedAverage[i] : average[i];
- let value: number = 0;
+ let averageValue: number = TestPerformance.TRANSITION_WEIGHTED_AVERAGE ? weightedAverage[i] : average[i];
+ let value: number = 0;
for (let j = 0; j < TestPerformance.PASSES; j++) {
- let diff: number = points[j] - averageValue;
+ let diff: number = points[j] - averageValue;
value += diff * diff;
}
- let ignoreCount95: number = Math.round(TestPerformance.PASSES * (1 - 0.95) / 2.0) | 0;
- let ignoreCount67: number = Math.round(TestPerformance.PASSES * (1 - 0.667) / 2.0) | 0;
+ let ignoreCount95: number = Math.round(TestPerformance.PASSES * (1 - 0.95) / 2.0) | 0;
+ let ignoreCount67: number = Math.round(TestPerformance.PASSES * (1 - 0.667) / 2.0) | 0;
low95[i] = points[ignoreCount95];
high95[i] = points[points.length - 1 - ignoreCount95];
low67[i] = points[ignoreCount67];
@@ -644,7 +645,7 @@ export class TestPerformance {
console.log("File\tAverage\tStd. Dev.\t95%% Low\t95%% High\t66.7%% Low\t66.7%% High");
for (let i = 0; i < stddev.length; i++) {
- let averageValue: number = TestPerformance.TRANSITION_WEIGHTED_AVERAGE ? weightedAverage[i] : average[i];
+ let averageValue: number = TestPerformance.TRANSITION_WEIGHTED_AVERAGE ? weightedAverage[i] : average[i];
console.log(`${i + 1}\t${averageValue}\t${stddev[i]}\t${averageValue - low95[i]}\t${high95[i] - averageValue}\t${averageValue - low67[i]}\t${high67[i] - averageValue}`);
}
}
@@ -682,28 +683,28 @@ export class TestPerformance {
average[i] = sum[i] / TestPerformance.PASSES;
}
- let low95: Float64Array = new Float64Array(fileCount);
- let high95: Float64Array = new Float64Array(fileCount);
- let low67: Float64Array = new Float64Array(fileCount);
- let high67: Float64Array = new Float64Array(fileCount);
- let stddev: Float64Array = new Float64Array(fileCount);
+ let low95: Float64Array = new Float64Array(fileCount);
+ let high95: Float64Array = new Float64Array(fileCount);
+ let low67: Float64Array = new Float64Array(fileCount);
+ let high67: Float64Array = new Float64Array(fileCount);
+ let stddev: Float64Array = new Float64Array(fileCount);
for (let i = 0; i < stddev.length; i++) {
- let points: Float64Array = new Float64Array(TestPerformance.PASSES);
+ let points: Float64Array = new Float64Array(TestPerformance.PASSES);
for (let j = 0; j < TestPerformance.PASSES; j++) {
points[j] = TestPerformance.timePerFile[j][i] / TestPerformance.tokensPerFile[j][i];
}
points.sort();
- let averageValue: number = average[i];
- let value: number = 0;
+ let averageValue: number = average[i];
+ let value: number = 0;
for (let j = 0; j < TestPerformance.PASSES; j++) {
- let diff: number = points[j] - averageValue;
+ let diff: number = points[j] - averageValue;
value += diff * diff;
}
- let ignoreCount95: number = Math.round(TestPerformance.PASSES * (1 - 0.95) / 2.0) | 0;
- let ignoreCount67: number = Math.round(TestPerformance.PASSES * (1 - 0.667) / 2.0) | 0;
+ let ignoreCount95: number = Math.round(TestPerformance.PASSES * (1 - 0.95) / 2.0) | 0;
+ let ignoreCount67: number = Math.round(TestPerformance.PASSES * (1 - 0.667) / 2.0) | 0;
low95[i] = points[ignoreCount95];
high95[i] = points[points.length - 1 - ignoreCount95];
low67[i] = points[ignoreCount67];
@@ -713,13 +714,13 @@ export class TestPerformance {
console.log("File\tAverage\tStd. Dev.\t95% Low\t95% High\t66.7% Low\t66.7% High");
for (let i = 0; i < stddev.length; i++) {
- let averageValue: number = average[i];
+ let averageValue: number = average[i];
console.log(`${i + 1}\t${averageValue}\t${stddev[i]}\t${averageValue - low95[i]}\t${high95[i] - averageValue}\t${averageValue - low67[i]}\t${high67[i] - averageValue}`);
}
}
private getSourceRoot(prefix: string): string | undefined {
- let sourceRoot = process.env[prefix + "_SOURCE_ROOT"];
+ let sourceRoot = process.env[prefix + "_SOURCE_ROOT"];
// if (sourceRoot == null) {
// sourceRoot = System.getProperty(prefix+"_SOURCE_ROOT");
// }
@@ -825,7 +826,7 @@ export class TestPerformance {
}
}
- public configOutputSize: number = 0;
+ public configOutputSize: number = 0;
protected parseSources(currentPass: number, factory: ParserFactory, sources: InputDescriptor[], shuffleSources: boolean): void {
if (shuffleSources) {
@@ -836,8 +837,8 @@ export class TestPerformance {
let startTime: Stopwatch = Stopwatch.startNew();
TestPerformance.tokenCount[currentPass] = 0;
- let inputSize: number = 0;
- let inputCount: number = 0;
+ let inputSize: number = 0;
+ let inputCount: number = 0;
let results: Array = [];
// let executorService: ExecutorService;
@@ -852,22 +853,22 @@ export class TestPerformance {
break;
}
- let input: CharStream = inputDescriptor.getInputStream();
+ let input: CharStream = inputDescriptor.getInputStream();
input.seek(0);
inputSize += input.size;
inputCount++;
let futureChecksum: () => FileParseResult | undefined = () => {
// @Override
// call(): FileParseResult {
- // this incurred a great deal of overhead and was causing significant variations in performance results.
- // console.log(`Parsing file ${input.sourceName}`);
- try {
- return factory.parseFile(input, currentPass, 0);
- } catch (ex) {
- console.error(ex);
- }
+ // this incurred a great deal of overhead and was causing significant variations in performance results.
+ // console.log(`Parsing file ${input.sourceName}`);
+ try {
+ return factory.parseFile(input, currentPass, 0);
+ } catch (ex) {
+ console.error(ex);
+ }
- return undefined;
+ return undefined;
// }
};
@@ -875,12 +876,12 @@ export class TestPerformance {
}
let checksum = new MurmurHashChecksum();
- let currentIndex: number = -1;
+ let currentIndex: number = -1;
for (let future of results) {
currentIndex++;
- let fileChecksum: number = 0;
+ let fileChecksum: number = 0;
// try {
- let fileResult: FileParseResult | undefined = future;
+ let fileResult: FileParseResult | undefined = future;
if (fileResult == null) {
continue;
}
@@ -920,14 +921,14 @@ export class TestPerformance {
console.log(`${currentPass + 1}. Total parse time for ${inputCount} files (${Math.round(inputSize / 1024)} KiB, ${TestPerformance.tokenCount[currentPass]} tokens${TestPerformance.COMPUTE_CHECKSUM ? `, checksum 0x${(checksum.getValue() >>> 0).toString(16)}` : ""}): ${Math.round(startTime.elapsedMillis())}ms`);
if (TestPerformance.sharedLexers.length > 0) {
- let index: number = TestPerformance.FILE_GRANULARITY ? 0 : 0;
- let lexer: Lexer = TestPerformance.sharedLexers[index]!;
- let lexerInterpreter: LexerATNSimulator = lexer.interpreter;
- let modeToDFA: DFA[] = lexerInterpreter.atn.modeToDFA;
+ let index: number = TestPerformance.FILE_GRANULARITY ? 0 : 0;
+ let lexer: Lexer = TestPerformance.sharedLexers[index]!;
+ let lexerInterpreter: LexerATNSimulator = lexer.interpreter;
+ let modeToDFA: DFA[] = lexerInterpreter.atn.modeToDFA;
if (TestPerformance.SHOW_DFA_STATE_STATS) {
- let states: number = 0;
- let configs: number = 0;
- let uniqueConfigs: Array2DHashSet = new Array2DHashSet(ObjectEqualityComparator.INSTANCE);
+ let states: number = 0;
+ let configs: number = 0;
+ let uniqueConfigs: Array2DHashSet = new Array2DHashSet(ObjectEqualityComparator.INSTANCE);
for (let dfa of modeToDFA) {
if (dfa == null) {
@@ -946,17 +947,17 @@ export class TestPerformance {
if (TestPerformance.DETAILED_DFA_STATE_STATS) {
console.log("\tMode\tStates\tConfigs\tMode");
for (let i = 0; i < modeToDFA.length; i++) {
- let dfa: DFA = modeToDFA[i];
+ let dfa: DFA = modeToDFA[i];
if (dfa == null || dfa.states.isEmpty) {
continue;
}
- let modeConfigs: number = 0;
+ let modeConfigs: number = 0;
for (let state of dfa.states) {
modeConfigs += state.configs.size;
}
- let modeName: string = lexer.modeNames[i];
+ let modeName: string = lexer.modeNames[i];
console.log(`\t${dfa.decision}\t${dfa.states.size}\t${modeConfigs}\t${modeName}`);
}
}
@@ -964,16 +965,16 @@ export class TestPerformance {
}
if (TestPerformance.RUN_PARSER && TestPerformance.sharedParsers.length > 0) {
- let index: number = TestPerformance.FILE_GRANULARITY ? 0 : 0;
- let parser: Parser = TestPerformance.sharedParsers[index]!;
+ let index: number = TestPerformance.FILE_GRANULARITY ? 0 : 0;
+ let parser: Parser = TestPerformance.sharedParsers[index]!;
// make sure the individual DFAState objects actually have unique ATNConfig arrays
- let interpreter: ParserATNSimulator = parser.interpreter;
- let decisionToDFA: DFA[] = interpreter.atn.decisionToDFA;
+ let interpreter: ParserATNSimulator = parser.interpreter;
+ let decisionToDFA: DFA[] = interpreter.atn.decisionToDFA;
if (TestPerformance.SHOW_DFA_STATE_STATS) {
- let states: number = 0;
- let configs: number = 0;
- let uniqueConfigs: Array2DHashSet = new Array2DHashSet(ObjectEqualityComparator.INSTANCE);
+ let states: number = 0;
+ let configs: number = 0;
+ let uniqueConfigs: Array2DHashSet = new Array2DHashSet(ObjectEqualityComparator.INSTANCE);
for (let dfa of decisionToDFA) {
if (dfa == null) {
@@ -998,26 +999,26 @@ export class TestPerformance {
}
for (let i = 0; i < decisionToDFA.length; i++) {
- let dfa: DFA = decisionToDFA[i];
+ let dfa: DFA = decisionToDFA[i];
if (dfa == null || dfa.states.isEmpty) {
continue;
}
- let decisionConfigs: number = 0;
+ let decisionConfigs: number = 0;
for (let state of dfa.states) {
decisionConfigs += state.configs.size;
}
- let ruleName: string = parser.ruleNames[parser.atn.decisionToState[dfa.decision].ruleIndex];
+ let ruleName: string = parser.ruleNames[parser.atn.decisionToState[dfa.decision].ruleIndex];
- let calls: number = 0;
- let fullContextCalls: number = 0;
- let nonSllCalls: number = 0;
- let transitions: number = 0;
- let computedTransitions: number = 0;
- let fullContextTransitions: number = 0;
- let lookahead: number = 0;
- let fullContextLookahead: number = 0;
+ let calls: number = 0;
+ let fullContextCalls: number = 0;
+ let nonSllCalls: number = 0;
+ let transitions: number = 0;
+ let computedTransitions: number = 0;
+ let fullContextTransitions: number = 0;
+ let lookahead: number = 0;
+ let fullContextLookahead: number = 0;
let formatString: string;
if (TestPerformance.COMPUTE_TRANSITION_STATS) {
for (let data of TestPerformance.decisionInvocationsPerFile[currentPass]) {
@@ -1064,11 +1065,11 @@ export class TestPerformance {
}
}
- let localDfaCount: number = 0;
- let globalDfaCount: number = 0;
- let localConfigCount: number = 0;
- let globalConfigCount: number = 0;
- let contextsInDFAState: Int32Array = new Int32Array(0);
+ let localDfaCount: number = 0;
+ let globalDfaCount: number = 0;
+ let localConfigCount: number = 0;
+ let globalConfigCount: number = 0;
+ let contextsInDFAState: Int32Array = new Int32Array(0);
for (let dfa of decisionToDFA) {
if (dfa == null) {
@@ -1084,7 +1085,7 @@ export class TestPerformance {
}
if (state.isAcceptState) {
- let hasGlobal: boolean = false;
+ let hasGlobal: boolean = false;
for (let config of state.configs) {
if (config.reachesIntoOuterContext) {
globalConfigCount++;
@@ -1108,7 +1109,7 @@ export class TestPerformance {
if (TestPerformance.EXPORT_LARGEST_CONFIG_CONTEXTS) {
for (let state of dfa.states) {
for (let config of state.configs) {
- let configOutput: string = config.toDotString();
+ let configOutput: string = config.toDotString();
if (configOutput.length <= this.configOutputSize) {
continue;
}
@@ -1143,7 +1144,7 @@ export class TestPerformance {
}
private static sum(array: Uint32Array): number {
- let result: number = 0;
+ let result: number = 0;
for (let value of array) {
result += value;
}
@@ -1180,88 +1181,171 @@ export class TestPerformance {
// lexerCtor: Constructor extends Lexer> = lexerClass.getConstructor(CharStream.class);
// parserCtor: Constructor extends Parser> = parserClass.getConstructor(TokenStream.class);
- // construct initial instances of the lexer and parser to deserialize their ATNs
- let lexerInstance = new lexerCtor(CharStreams.fromString(""));
- let parserInstance = new parserCtor(new CommonTokenStream(lexerInstance));
+ // construct initial instances of the lexer and parser to deserialize their ATNs
+ let lexerInstance = new lexerCtor(CharStreams.fromString(""));
+ let parserInstance = new parserCtor(new CommonTokenStream(lexerInstance));
- if (!TestPerformance.REUSE_LEXER_DFA) {
- let lexerSerializedATN: string = lexerInstance.serializedATN;
- for (let i = 0; i < TestPerformance.NUMBER_OF_THREADS; i++) {
- TestPerformance.sharedLexerATNs[i] = new ATNDeserializer().deserialize(Utils.toCharArray(lexerSerializedATN));
- }
+ if (!TestPerformance.REUSE_LEXER_DFA) {
+ let lexerSerializedATN: string = lexerInstance.serializedATN;
+ for (let i = 0; i < TestPerformance.NUMBER_OF_THREADS; i++) {
+ TestPerformance.sharedLexerATNs[i] = new ATNDeserializer().deserialize(Utils.toCharArray(lexerSerializedATN));
}
+ }
- if (TestPerformance.RUN_PARSER && !TestPerformance.REUSE_PARSER_DFA) {
- let parserSerializedATN: string = parserInstance.serializedATN;
- for (let i = 0; i < TestPerformance.NUMBER_OF_THREADS; i++) {
- TestPerformance.sharedParserATNs[i] = new ATNDeserializer().deserialize(Utils.toCharArray(parserSerializedATN));
- }
+ if (TestPerformance.RUN_PARSER && !TestPerformance.REUSE_PARSER_DFA) {
+ let parserSerializedATN: string = parserInstance.serializedATN;
+ for (let i = 0; i < TestPerformance.NUMBER_OF_THREADS; i++) {
+ TestPerformance.sharedParserATNs[i] = new ATNDeserializer().deserialize(Utils.toCharArray(parserSerializedATN));
}
+ }
- return {
- // @SuppressWarnings("unused")
- // @Override
- parseFile(input: CharStream, currentPass: number, thread: number): FileParseResult {
- let checksum = new MurmurHashChecksum();
+ return {
+ // @SuppressWarnings("unused")
+ // @Override
+ parseFile(input: CharStream, currentPass: number, thread: number): FileParseResult {
+ let checksum = new MurmurHashChecksum();
- let startTime: Stopwatch = Stopwatch.startNew();
- assert(thread >= 0 && thread < TestPerformance.NUMBER_OF_THREADS);
+ let startTime: Stopwatch = Stopwatch.startNew();
+ assert(thread >= 0 && thread < TestPerformance.NUMBER_OF_THREADS);
- try {
- let listener: ParseTreeListener | undefined = TestPerformance.sharedListeners[thread];
- if (listener == null) {
- listener = new listenerCtor();
- TestPerformance.sharedListeners[thread] = listener;
+ try {
+ let listener: ParseTreeListener | undefined = TestPerformance.sharedListeners[thread];
+ if (listener == null) {
+ listener = new listenerCtor();
+ TestPerformance.sharedListeners[thread] = listener;
+ }
+
+ let lexer: Lexer | undefined = TestPerformance.sharedLexers[thread];
+ if (TestPerformance.REUSE_LEXER && lexer != null) {
+ lexer.inputStream = input;
+ } else {
+ let previousLexer: Lexer | undefined = lexer;
+ lexer = new lexerCtor(input);
+ TestPerformance.sharedLexers[thread] = lexer;
+ let atn: ATN = (TestPerformance.FILE_GRANULARITY || previousLexer == null ? lexer : previousLexer).atn;
+ if (!TestPerformance.REUSE_LEXER_DFA || (!TestPerformance.FILE_GRANULARITY && previousLexer == null)) {
+ atn = TestPerformance.sharedLexerATNs[thread]!;
}
- let lexer: Lexer | undefined = TestPerformance.sharedLexers[thread];
- if (TestPerformance.REUSE_LEXER && lexer != null) {
- lexer.inputStream = input;
- } else {
- let previousLexer: Lexer | undefined = lexer;
- lexer = new lexerCtor(input);
- TestPerformance.sharedLexers[thread] = lexer;
- let atn: ATN = (TestPerformance.FILE_GRANULARITY || previousLexer == null ? lexer : previousLexer).atn;
- if (!TestPerformance.REUSE_LEXER_DFA || (!TestPerformance.FILE_GRANULARITY && previousLexer == null)) {
- atn = TestPerformance.sharedLexerATNs[thread]!;
- }
+ if (!TestPerformance.ENABLE_LEXER_DFA) {
+ lexer.interpreter = new NonCachingLexerATNSimulator(atn, lexer);
+ } else if (!TestPerformance.REUSE_LEXER_DFA || TestPerformance.COMPUTE_TRANSITION_STATS) {
+ lexer.interpreter = new StatisticsLexerATNSimulator(atn, lexer);
+ }
+ }
- if (!TestPerformance.ENABLE_LEXER_DFA) {
- lexer.interpreter = new NonCachingLexerATNSimulator(atn, lexer);
- } else if (!TestPerformance.REUSE_LEXER_DFA || TestPerformance.COMPUTE_TRANSITION_STATS) {
- lexer.interpreter = new StatisticsLexerATNSimulator(atn, lexer);
- }
+ lexer.removeErrorListeners();
+ lexer.addErrorListener(DescriptiveLexerErrorListener.INSTANCE);
+
+ lexer.interpreter.optimize_tail_calls = TestPerformance.OPTIMIZE_TAIL_CALLS;
+ if (TestPerformance.ENABLE_LEXER_DFA && !TestPerformance.REUSE_LEXER_DFA) {
+ lexer.interpreter.atn.clearDFA();
+ }
+
+ let tokens: CommonTokenStream = new CommonTokenStream(lexer);
+ tokens.fill();
+ TestPerformance.tokenCount[currentPass] += tokens.size;
+
+ if (TestPerformance.COMPUTE_CHECKSUM) {
+ for (let token of tokens.getTokens()) {
+ TestPerformance.updateChecksum(checksum, token);
+ }
+ }
+
+ if (!TestPerformance.RUN_PARSER) {
+ return new FileParseResult(input.sourceName, checksum.getValue(), undefined, tokens.size, startTime, lexer, undefined);
+ }
+
+ let parseStartTime: Stopwatch = Stopwatch.startNew();
+ let parser: AnyJavaParser | undefined = TestPerformance.sharedParsers[thread];
+ if (TestPerformance.REUSE_PARSER && parser != null) {
+ parser.inputStream = tokens;
+ } else {
+ let previousParser: Parser | undefined = parser;
+
+ if (TestPerformance.USE_PARSER_INTERPRETER) {
+ let referenceParser: Parser = new parserCtor(tokens);
+ parser = new ParserInterpreter(referenceParser.grammarFileName, referenceParser.vocabulary, referenceParser.ruleNames, referenceParser.atn, tokens);
+ }
+ else {
+ parser = new parserCtor(tokens);
}
- lexer.removeErrorListeners();
- lexer.addErrorListener(DescriptiveLexerErrorListener.INSTANCE);
+ let atn: ATN = (TestPerformance.FILE_GRANULARITY || previousParser == null ? parser : previousParser).atn;
+ if (!TestPerformance.REUSE_PARSER_DFA || (!TestPerformance.FILE_GRANULARITY && previousParser == null)) {
+ atn = TestPerformance.sharedParserATNs[thread]!;
+ }
- lexer.interpreter.optimize_tail_calls = TestPerformance.OPTIMIZE_TAIL_CALLS;
- if (TestPerformance.ENABLE_LEXER_DFA && !TestPerformance.REUSE_LEXER_DFA) {
- lexer.interpreter.atn.clearDFA();
+ if (!TestPerformance.ENABLE_PARSER_DFA) {
+ parser.interpreter = new NonCachingParserATNSimulator(atn, parser);
+ } else if (!TestPerformance.REUSE_PARSER_DFA || TestPerformance.COMPUTE_TRANSITION_STATS) {
+ parser.interpreter = new StatisticsParserATNSimulator(atn, parser);
}
- let tokens: CommonTokenStream = new CommonTokenStream(lexer);
- tokens.fill();
- TestPerformance.tokenCount[currentPass] += tokens.size;
+ TestPerformance.sharedParsers[thread] = parser;
+ }
- if (TestPerformance.COMPUTE_CHECKSUM) {
- for (let token of tokens.getTokens()) {
- TestPerformance.updateChecksum(checksum, token);
- }
+ parser.removeParseListeners();
+ parser.removeErrorListeners();
+ if (!TestPerformance.TWO_STAGE_PARSING) {
+ parser.addErrorListener(DescriptiveErrorListener.INSTANCE);
+ parser.addErrorListener(new SummarizingDiagnosticErrorListener());
+ }
+
+ if (TestPerformance.ENABLE_PARSER_DFA && !TestPerformance.REUSE_PARSER_DFA) {
+ parser.interpreter.atn.clearDFA();
+ }
+
+ parser.interpreter.setPredictionMode(TestPerformance.TWO_STAGE_PARSING ? PredictionMode.SLL : TestPerformance.PREDICTION_MODE);
+ parser.interpreter.force_global_context = TestPerformance.FORCE_GLOBAL_CONTEXT && !TestPerformance.TWO_STAGE_PARSING;
+ parser.interpreter.always_try_local_context = TestPerformance.TRY_LOCAL_CONTEXT_FIRST || TestPerformance.TWO_STAGE_PARSING;
+ parser.interpreter.enable_global_context_dfa = TestPerformance.ENABLE_PARSER_FULL_CONTEXT_DFA;
+ parser.interpreter.optimize_ll1 = TestPerformance.OPTIMIZE_LL1;
+ parser.interpreter.optimize_unique_closure = TestPerformance.OPTIMIZE_UNIQUE_CLOSURE;
+ parser.interpreter.optimize_tail_calls = TestPerformance.OPTIMIZE_TAIL_CALLS;
+ parser.interpreter.tail_call_preserves_sll = TestPerformance.TAIL_CALL_PRESERVES_SLL;
+ parser.interpreter.treat_sllk1_conflict_as_ambiguity = TestPerformance.TREAT_SLLK1_CONFLICT_AS_AMBIGUITY;
+ parser.buildParseTree = TestPerformance.BUILD_PARSE_TREES;
+ if (!TestPerformance.BUILD_PARSE_TREES && TestPerformance.BLANK_LISTENER) {
+ parser.addParseListener(listener);
+ }
+ if (TestPerformance.BAIL_ON_ERROR || TestPerformance.TWO_STAGE_PARSING) {
+ parser.errorHandler = new BailErrorStrategy();
+ }
+
+ // let parseMethod: Method = parserClass.getMethod(entryPoint);
+ let parseResult: ParserRuleContext;
+
+ try {
+ if (TestPerformance.COMPUTE_CHECKSUM && !TestPerformance.BUILD_PARSE_TREES) {
+ parser.addParseListener(new ChecksumParseTreeListener(checksum));
+ }
+
+ if (parser instanceof ParserInterpreter) {
+ parseResult = parser.parse(parser.ruleNames.indexOf(entryPointName));
+ }
+ else {
+ parseResult = entryPoint(parser);
+ }
+ } catch (ex) {
+ if (!TestPerformance.TWO_STAGE_PARSING) {
+ throw ex;
}
- if (!TestPerformance.RUN_PARSER) {
- return new FileParseResult(input.sourceName, checksum.getValue(), undefined, tokens.size, startTime, lexer, undefined);
+ let sourceName: string = tokens.sourceName;
+ sourceName = sourceName != null && sourceName.length > 0 ? sourceName + ": " : "";
+ if (TestPerformance.REPORT_SECOND_STAGE_RETRY) {
+ console.error(sourceName + "Forced to retry with full context.");
}
- let parseStartTime: Stopwatch = Stopwatch.startNew();
- let parser: AnyJavaParser | undefined = TestPerformance.sharedParsers[thread];
- if (TestPerformance.REUSE_PARSER && parser != null) {
+ if (!(ex instanceof ParseCancellationException)) {
+ throw ex;
+ }
+
+ tokens.seek(0);
+ if (TestPerformance.REUSE_PARSER && TestPerformance.sharedParsers[thread] != null) {
parser.inputStream = tokens;
} else {
- let previousParser: Parser | undefined = parser;
-
if (TestPerformance.USE_PARSER_INTERPRETER) {
let referenceParser: Parser = new parserCtor(tokens);
parser = new ParserInterpreter(referenceParser.grammarFileName, referenceParser.vocabulary, referenceParser.ruleNames, referenceParser.atn, tokens);
@@ -1270,34 +1354,23 @@ export class TestPerformance {
parser = new parserCtor(tokens);
}
- let atn: ATN = (TestPerformance.FILE_GRANULARITY || previousParser == null ? parser : previousParser).atn;
- if (!TestPerformance.REUSE_PARSER_DFA || (!TestPerformance.FILE_GRANULARITY && previousParser == null)) {
- atn = TestPerformance.sharedParserATNs[thread]!;
- }
-
- if (!TestPerformance.ENABLE_PARSER_DFA) {
- parser.interpreter = new NonCachingParserATNSimulator(atn, parser);
- } else if (!TestPerformance.REUSE_PARSER_DFA || TestPerformance.COMPUTE_TRANSITION_STATS) {
- parser.interpreter = new StatisticsParserATNSimulator(atn, parser);
- }
-
TestPerformance.sharedParsers[thread] = parser;
}
parser.removeParseListeners();
parser.removeErrorListeners();
- if (!TestPerformance.TWO_STAGE_PARSING) {
- parser.addErrorListener(DescriptiveErrorListener.INSTANCE);
- parser.addErrorListener(new SummarizingDiagnosticErrorListener());
- }
-
- if (TestPerformance.ENABLE_PARSER_DFA && !TestPerformance.REUSE_PARSER_DFA) {
- parser.interpreter.atn.clearDFA();
+ parser.addErrorListener(DescriptiveErrorListener.INSTANCE);
+ parser.addErrorListener(new SummarizingDiagnosticErrorListener());
+ if (!TestPerformance.ENABLE_PARSER_DFA) {
+ parser.interpreter = new NonCachingParserATNSimulator(parser.atn, parser);
+ } else if (!TestPerformance.REUSE_PARSER_DFA) {
+ parser.interpreter = new StatisticsParserATNSimulator(TestPerformance.sharedParserATNs[thread]!, parser);
+ } else if (TestPerformance.COMPUTE_TRANSITION_STATS) {
+ parser.interpreter = new StatisticsParserATNSimulator(parser.atn, parser);
}
-
- parser.interpreter.setPredictionMode(TestPerformance.TWO_STAGE_PARSING ? PredictionMode.SLL : TestPerformance.PREDICTION_MODE);
- parser.interpreter.force_global_context = TestPerformance.FORCE_GLOBAL_CONTEXT && !TestPerformance.TWO_STAGE_PARSING;
- parser.interpreter.always_try_local_context = TestPerformance.TRY_LOCAL_CONTEXT_FIRST || TestPerformance.TWO_STAGE_PARSING;
+ parser.interpreter.setPredictionMode(TestPerformance.PREDICTION_MODE);
+ parser.interpreter.force_global_context = TestPerformance.FORCE_GLOBAL_CONTEXT;
+ parser.interpreter.always_try_local_context = TestPerformance.TRY_LOCAL_CONTEXT_FIRST;
parser.interpreter.enable_global_context_dfa = TestPerformance.ENABLE_PARSER_FULL_CONTEXT_DFA;
parser.interpreter.optimize_ll1 = TestPerformance.OPTIMIZE_LL1;
parser.interpreter.optimize_unique_closure = TestPerformance.OPTIMIZE_UNIQUE_CLOSURE;
@@ -1305,114 +1378,42 @@ export class TestPerformance {
parser.interpreter.tail_call_preserves_sll = TestPerformance.TAIL_CALL_PRESERVES_SLL;
parser.interpreter.treat_sllk1_conflict_as_ambiguity = TestPerformance.TREAT_SLLK1_CONFLICT_AS_AMBIGUITY;
parser.buildParseTree = TestPerformance.BUILD_PARSE_TREES;
+ if (TestPerformance.COMPUTE_CHECKSUM && !TestPerformance.BUILD_PARSE_TREES) {
+ parser.addParseListener(new ChecksumParseTreeListener(checksum));
+ }
if (!TestPerformance.BUILD_PARSE_TREES && TestPerformance.BLANK_LISTENER) {
parser.addParseListener(listener);
}
- if (TestPerformance.BAIL_ON_ERROR || TestPerformance.TWO_STAGE_PARSING) {
+ if (TestPerformance.BAIL_ON_ERROR) {
parser.errorHandler = new BailErrorStrategy();
}
- // let parseMethod: Method = parserClass.getMethod(entryPoint);
- let parseResult: ParserRuleContext;
-
- try {
- if (TestPerformance.COMPUTE_CHECKSUM && !TestPerformance.BUILD_PARSE_TREES) {
- parser.addParseListener(new ChecksumParseTreeListener(checksum));
- }
-
- if (parser instanceof ParserInterpreter) {
- parseResult = parser.parse(parser.ruleNames.indexOf(entryPointName));
- }
- else {
- parseResult = entryPoint(parser);
- }
- } catch (ex) {
- if (!TestPerformance.TWO_STAGE_PARSING) {
- throw ex;
- }
-
- let sourceName: string = tokens.sourceName;
- sourceName = sourceName != null && sourceName.length > 0 ? sourceName + ": " : "";
- if (TestPerformance.REPORT_SECOND_STAGE_RETRY) {
- console.error(sourceName + "Forced to retry with full context.");
- }
-
- if (!(ex instanceof ParseCancellationException)) {
- throw ex;
- }
-
- tokens.seek(0);
- if (TestPerformance.REUSE_PARSER && TestPerformance.sharedParsers[thread] != null) {
- parser.inputStream = tokens;
- } else {
- if (TestPerformance.USE_PARSER_INTERPRETER) {
- let referenceParser: Parser = new parserCtor(tokens);
- parser = new ParserInterpreter(referenceParser.grammarFileName, referenceParser.vocabulary, referenceParser.ruleNames, referenceParser.atn, tokens);
- }
- else {
- parser = new parserCtor(tokens);
- }
-
- TestPerformance.sharedParsers[thread] = parser;
- }
-
- parser.removeParseListeners();
- parser.removeErrorListeners();
- parser.addErrorListener(DescriptiveErrorListener.INSTANCE);
- parser.addErrorListener(new SummarizingDiagnosticErrorListener());
- if (!TestPerformance.ENABLE_PARSER_DFA) {
- parser.interpreter = new NonCachingParserATNSimulator(parser.atn, parser);
- } else if (!TestPerformance.REUSE_PARSER_DFA) {
- parser.interpreter = new StatisticsParserATNSimulator(TestPerformance.sharedParserATNs[thread]!, parser);
- } else if (TestPerformance.COMPUTE_TRANSITION_STATS) {
- parser.interpreter = new StatisticsParserATNSimulator(parser.atn, parser);
- }
- parser.interpreter.setPredictionMode(TestPerformance.PREDICTION_MODE);
- parser.interpreter.force_global_context = TestPerformance.FORCE_GLOBAL_CONTEXT;
- parser.interpreter.always_try_local_context = TestPerformance.TRY_LOCAL_CONTEXT_FIRST;
- parser.interpreter.enable_global_context_dfa = TestPerformance.ENABLE_PARSER_FULL_CONTEXT_DFA;
- parser.interpreter.optimize_ll1 = TestPerformance.OPTIMIZE_LL1;
- parser.interpreter.optimize_unique_closure = TestPerformance.OPTIMIZE_UNIQUE_CLOSURE;
- parser.interpreter.optimize_tail_calls = TestPerformance.OPTIMIZE_TAIL_CALLS;
- parser.interpreter.tail_call_preserves_sll = TestPerformance.TAIL_CALL_PRESERVES_SLL;
- parser.interpreter.treat_sllk1_conflict_as_ambiguity = TestPerformance.TREAT_SLLK1_CONFLICT_AS_AMBIGUITY;
- parser.buildParseTree = TestPerformance.BUILD_PARSE_TREES;
- if (TestPerformance.COMPUTE_CHECKSUM && !TestPerformance.BUILD_PARSE_TREES) {
- parser.addParseListener(new ChecksumParseTreeListener(checksum));
- }
- if (!TestPerformance.BUILD_PARSE_TREES && TestPerformance.BLANK_LISTENER) {
- parser.addParseListener(listener);
- }
- if (TestPerformance.BAIL_ON_ERROR) {
- parser.errorHandler = new BailErrorStrategy();
- }
-
- if (parser instanceof ParserInterpreter) {
- parseResult = parser.parse(parser.ruleNames.indexOf(entryPointName));
- } else {
- parseResult = entryPoint(parser);
- }
- }
-
- if (TestPerformance.COMPUTE_CHECKSUM && TestPerformance.BUILD_PARSE_TREES) {
- ParseTreeWalker.DEFAULT.walk(new ChecksumParseTreeListener(checksum), parseResult);
- }
- if (TestPerformance.BUILD_PARSE_TREES && TestPerformance.BLANK_LISTENER) {
- ParseTreeWalker.DEFAULT.walk(listener, parseResult);
+ if (parser instanceof ParserInterpreter) {
+ parseResult = parser.parse(parser.ruleNames.indexOf(entryPointName));
+ } else {
+ parseResult = entryPoint(parser);
}
+ }
- return new FileParseResult(input.sourceName, checksum.getValue(), parseResult, tokens.size, TestPerformance.TIME_PARSE_ONLY ? parseStartTime : startTime, lexer, parser);
- } catch (e) {
- if (!TestPerformance.REPORT_SYNTAX_ERRORS && e instanceof ParseCancellationException) {
- return new FileParseResult("unknown", checksum.getValue(), undefined, 0, startTime, undefined, undefined);
- }
+ if (TestPerformance.COMPUTE_CHECKSUM && TestPerformance.BUILD_PARSE_TREES) {
+ ParseTreeWalker.DEFAULT.walk(new ChecksumParseTreeListener(checksum), parseResult);
+ }
+ if (TestPerformance.BUILD_PARSE_TREES && TestPerformance.BLANK_LISTENER) {
+ ParseTreeWalker.DEFAULT.walk(listener, parseResult);
+ }
- // e.printStackTrace(System.out);
- console.error(e);
- throw new Error("IllegalStateException: " + e);
+ return new FileParseResult(input.sourceName, checksum.getValue(), parseResult, tokens.size, TestPerformance.TIME_PARSE_ONLY ? parseStartTime : startTime, lexer, parser);
+ } catch (e) {
+ if (!TestPerformance.REPORT_SYNTAX_ERRORS && e instanceof ParseCancellationException) {
+ return new FileParseResult("unknown", checksum.getValue(), undefined, 0, startTime, undefined, undefined);
}
- },
- };
+
+ // e.printStackTrace(System.out);
+ console.error(e);
+ throw new Error("IllegalStateException: " + e);
+ }
+ },
+ };
// } catch (Exception e) {
// e.printStackTrace(System.out);
// Assert.fail(e.getMessage());
@@ -1454,7 +1455,7 @@ export class FileParseResult {
this.elapsedTime = this.startTime.elapsed();
if (lexer != null) {
- let interpreter: LexerATNSimulator = lexer.interpreter;
+ let interpreter: LexerATNSimulator = lexer.interpreter;
if (interpreter instanceof StatisticsLexerATNSimulator) {
this.lexerTotalTransitions = interpreter.totalTransitions;
this.lexerComputedTransitions = interpreter.computedTransitions;
@@ -1463,7 +1464,7 @@ export class FileParseResult {
this.lexerComputedTransitions = 0;
}
- let dfaSize: number = 0;
+ let dfaSize: number = 0;
for (let dfa of interpreter.atn.decisionToDFA) {
if (dfa != null) {
dfaSize += dfa.states.size;
@@ -1478,7 +1479,7 @@ export class FileParseResult {
}
if (parser != null) {
- let interpreter: ParserATNSimulator = parser.interpreter;
+ let interpreter: ParserATNSimulator = parser.interpreter;
if (interpreter instanceof StatisticsParserATNSimulator) {
this.decisionInvocations = interpreter.decisionInvocations;
this.fullContextFallback = interpreter.fullContextFallback;
@@ -1495,7 +1496,7 @@ export class FileParseResult {
this.parserFullContextTransitions = new Uint32Array(0);
}
- let dfaSize: number = 0;
+ let dfaSize: number = 0;
for (let dfa of interpreter.atn.decisionToDFA) {
if (dfa != null) {
dfaSize += dfa.states.size;
@@ -1610,7 +1611,7 @@ class StatisticsParserATNSimulator extends ParserATNSimulator {
}
class DescriptiveErrorListener implements ParserErrorListener {
- public static INSTANCE: DescriptiveErrorListener = new DescriptiveErrorListener();
+ public static INSTANCE: DescriptiveErrorListener = new DescriptiveErrorListener();
@Override
public syntaxError(recognizer: Recognizer, offendingSymbol: T | undefined, line: number, charPositionInLine: number, msg: string, e: RecognitionException | undefined): void {
@@ -1619,7 +1620,7 @@ class DescriptiveErrorListener implements ParserErrorListener {
}
let inputStream = recognizer.inputStream;
- let sourceName: string = inputStream != null ? inputStream.sourceName : "";
+ let sourceName: string = inputStream != null ? inputStream.sourceName : "";
if (sourceName.length > 0) {
sourceName = `${sourceName}:${line}:${charPositionInLine}: `;
}
@@ -1630,7 +1631,7 @@ class DescriptiveErrorListener implements ParserErrorListener {
}
class DescriptiveLexerErrorListener implements ANTLRErrorListener {
- public static INSTANCE: DescriptiveLexerErrorListener = new DescriptiveLexerErrorListener();
+ public static INSTANCE: DescriptiveLexerErrorListener = new DescriptiveLexerErrorListener();
@Override
public syntaxError(recognizer: Recognizer, offendingSymbol: T | undefined, line: number, charPositionInLine: number, msg: string, e: RecognitionException | undefined): void {
@@ -1639,7 +1640,7 @@ class DescriptiveLexerErrorListener implements ANTLRErrorListener {
}
let inputStream = recognizer.inputStream;
- let sourceName: string = inputStream != null ? inputStream.sourceName : "";
+ let sourceName: string = inputStream != null ? inputStream.sourceName : "";
if (sourceName.length > 0) {
sourceName = `${sourceName}:${line}:${charPositionInLine}: `;
}
@@ -1656,10 +1657,10 @@ class SummarizingDiagnosticErrorListener extends DiagnosticErrorListener {
@Override
public reportAmbiguity(recognizer: Parser, dfa: DFA, startIndex: number, stopIndex: number, exact: boolean, ambigAlts: BitSet | undefined, configs: ATNConfigSet): void {
if (TestPerformance.COMPUTE_TRANSITION_STATS && TestPerformance.DETAILED_DFA_STATE_STATS) {
- let sllPredictions: BitSet = this.getConflictingAlts(this._sllConflict, this._sllConfigs);
- let sllPrediction: number = sllPredictions.nextSetBit(0);
- let llPredictions: BitSet = this.getConflictingAlts(ambigAlts, configs);
- let llPrediction: number = llPredictions.cardinality() === 0 ? ATN.INVALID_ALT_NUMBER : llPredictions.nextSetBit(0);
+ let sllPredictions: BitSet = this.getConflictingAlts(this._sllConflict, this._sllConfigs);
+ let sllPrediction: number = sllPredictions.nextSetBit(0);
+ let llPredictions: BitSet = this.getConflictingAlts(ambigAlts, configs);
+ let llPrediction: number = llPredictions.cardinality() === 0 ? INVALID_ALT_NUMBER : llPredictions.nextSetBit(0);
if (sllPrediction !== llPrediction) {
(recognizer.interpreter as StatisticsParserATNSimulator).nonSll[dfa.decision]++;
}
@@ -1670,9 +1671,9 @@ class SummarizingDiagnosticErrorListener extends DiagnosticErrorListener {
}
// show the rule name along with the decision
- let decision: number = dfa.decision;
- let rule: string = recognizer.ruleNames[dfa.atnStartState.ruleIndex];
- let input: string = recognizer.inputStream.getText(Interval.of(startIndex, stopIndex));
+ let decision: number = dfa.decision;
+ let rule: string = recognizer.ruleNames[dfa.atnStartState.ruleIndex];
+ let input: string = recognizer.inputStream.getText(Interval.of(startIndex, stopIndex));
recognizer.notifyErrorListeners(`reportAmbiguity d=${decision} (${rule}): ambigAlts=${ambigAlts}, input='${input}'`);
}
@@ -1685,18 +1686,18 @@ class SummarizingDiagnosticErrorListener extends DiagnosticErrorListener {
}
// show the rule name and viable configs along with the base info
- let decision: number = dfa.decision;
- let rule: string = recognizer.ruleNames[dfa.atnStartState.ruleIndex];
- let input: string = recognizer.inputStream.getText(Interval.of(startIndex, stopIndex));
- let representedAlts: BitSet = this.getConflictingAlts(conflictingAlts, conflictState.s0.configs);
+ let decision: number = dfa.decision;
+ let rule: string = recognizer.ruleNames[dfa.atnStartState.ruleIndex];
+ let input: string = recognizer.inputStream.getText(Interval.of(startIndex, stopIndex));
+ let representedAlts: BitSet = this.getConflictingAlts(conflictingAlts, conflictState.s0.configs);
recognizer.notifyErrorListeners(`reportAttemptingFullContext d=${decision} (${rule}), input='${input}', viable=${representedAlts}`);
}
@Override
public reportContextSensitivity(recognizer: Parser, dfa: DFA, startIndex: number, stopIndex: number, prediction: number, acceptState: SimulatorState): void {
if (TestPerformance.COMPUTE_TRANSITION_STATS && TestPerformance.DETAILED_DFA_STATE_STATS) {
- let sllPredictions: BitSet = this.getConflictingAlts(this._sllConflict, this._sllConfigs);
- let sllPrediction: number = sllPredictions.nextSetBit(0);
+ let sllPredictions: BitSet = this.getConflictingAlts(this._sllConflict, this._sllConfigs);
+ let sllPrediction: number = sllPredictions.nextSetBit(0);
if (sllPrediction !== prediction) {
(recognizer.interpreter as StatisticsParserATNSimulator).nonSll[dfa.decision]++;
}
@@ -1707,9 +1708,9 @@ class SummarizingDiagnosticErrorListener extends DiagnosticErrorListener {
}
// show the rule name and viable configs along with the base info
- let decision: number = dfa.decision;
- let rule: string = recognizer.ruleNames[dfa.atnStartState.ruleIndex];
- let input: string = recognizer.inputStream.getText(Interval.of(startIndex, stopIndex));
+ let decision: number = dfa.decision;
+ let rule: string = recognizer.ruleNames[dfa.atnStartState.ruleIndex];
+ let input: string = recognizer.inputStream.getText(Interval.of(startIndex, stopIndex));
recognizer.notifyErrorListeners(`reportContextSensitivity d=${decision} (${rule}), input='${input}', viable={${prediction}}`);
}
}
@@ -1877,10 +1878,10 @@ class NonCachingParserATNSimulator extends StatisticsParserATNSimulator {
}
class ChecksumParseTreeListener implements ParseTreeListener {
- private static VISIT_TERMINAL: number = 1;
- private static VISIT_ERROR_NODE: number = 2;
- private static ENTER_RULE: number = 3;
- private static EXIT_RULE: number = 4;
+ private static VISIT_TERMINAL: number = 1;
+ private static VISIT_ERROR_NODE: number = 2;
+ private static ENTER_RULE: number = 3;
+ private static EXIT_RULE: number = 4;
private checksum: MurmurHashChecksum;
diff --git a/package-lock.json b/package-lock.json
index 7b6db89c..f3f082ee 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -364,6 +364,31 @@
"integrity": "sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw==",
"dev": true
},
+ "@rollup/pluginutils": {
+ "version": "3.1.0",
+ "resolved": "https://bnpm.byted.org/@rollup/pluginutils/download/@rollup/pluginutils-3.1.0.tgz",
+ "integrity": "sha1-cGtFJO5tyLEDs8mVUz5a1oDAK5s=",
+ "dev": true,
+ "requires": {
+ "@types/estree": "0.0.39",
+ "estree-walker": "^1.0.1",
+ "picomatch": "^2.2.2"
+ },
+ "dependencies": {
+ "@types/estree": {
+ "version": "0.0.39",
+ "resolved": "https://bnpm.byted.org/@types/estree/download/@types/estree-0.0.39.tgz",
+ "integrity": "sha1-4Xfmme4bjCLSMXTKqnQiZEOJUJ8=",
+ "dev": true
+ },
+ "estree-walker": {
+ "version": "1.0.1",
+ "resolved": "https://bnpm.byted.org/estree-walker/download/estree-walker-1.0.1.tgz",
+ "integrity": "sha1-MbxdYSyWtwQQa0d+bdXYqhOMtwA=",
+ "dev": true
+ }
+ }
+ },
"@tootallnate/once": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.0.0.tgz",
@@ -376,6 +401,12 @@
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
"dev": true
},
+ "@types/estree": {
+ "version": "0.0.45",
+ "resolved": "https://bnpm.byted.org/@types/estree/download/@types/estree-0.0.45.tgz",
+ "integrity": "sha1-6Th1cpmOXs2sIhlQ2rPow7Fq+IQ=",
+ "dev": true
+ },
"@types/minimatch": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
@@ -394,6 +425,15 @@
"integrity": "sha512-vHPAyBX1ffLcy4fQHmDyIUMUb42gHZjPHU66nhvbMzAWJqHnySGZ6STwN3rwrnSd1FHB0DI/RWgGELgKSYRDmw==",
"dev": true
},
+ "@types/resolve": {
+ "version": "0.0.8",
+ "resolved": "https://bnpm.byted.org/@types/resolve/download/@types/resolve-0.0.8.tgz",
+ "integrity": "sha1-8mB00jjgJlnjI84aE9BB7uKA4ZQ=",
+ "dev": true,
+ "requires": {
+ "@types/node": "*"
+ }
+ },
"@types/source-map-support": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/@types/source-map-support/-/source-map-support-0.4.0.tgz",
@@ -409,6 +449,23 @@
"integrity": "sha512-0PDd05AK/u41wFxr0ytOYhQz15uAhkmwe8fOp33UN506zGARdLVx/Yc/WSeGs+8zKjMMTp1vlB+OXGwD7HmImg==",
"dev": true
},
+ "abstract-leveldown": {
+ "version": "0.12.4",
+ "resolved": "https://bnpm.byted.org/abstract-leveldown/download/abstract-leveldown-0.12.4.tgz",
+ "integrity": "sha1-KeGOYy5g5OIh1YECR4UqY9ey5BA=",
+ "dev": true,
+ "requires": {
+ "xtend": "~3.0.0"
+ },
+ "dependencies": {
+ "xtend": {
+ "version": "3.0.0",
+ "resolved": "https://bnpm.byted.org/xtend/download/xtend-3.0.0.tgz",
+ "integrity": "sha1-XM50B7r2Qsunvs2laBEcST9ZZlo=",
+ "dev": true
+ }
+ }
+ },
"agent-base": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.0.tgz",
@@ -487,6 +544,32 @@
"integrity": "sha1-7L0W+JSbFXGDcRsb2jNPN4QBhas=",
"dev": true
},
+ "asn1.js": {
+ "version": "5.4.1",
+ "resolved": "https://bnpm.byted.org/asn1.js/download/asn1.js-5.4.1.tgz",
+ "integrity": "sha1-EamAuE67kXgc41sP3C7ilON4Pwc=",
+ "dev": true,
+ "requires": {
+ "bn.js": "^4.0.0",
+ "inherits": "^2.0.1",
+ "minimalistic-assert": "^1.0.0",
+ "safer-buffer": "^2.1.0"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://bnpm.byted.org/bn.js/download/bn.js-4.11.9.tgz",
+ "integrity": "sha1-JtVWgpRY+dHoH8SJUkk9C6NQeCg=",
+ "dev": true
+ }
+ }
+ },
+ "atob": {
+ "version": "2.1.2",
+ "resolved": "https://bnpm.byted.org/atob/download/atob-2.1.2.tgz",
+ "integrity": "sha1-bZUX654DDSQ2ZmZR6GvZ9vE1M8k=",
+ "dev": true
+ },
"babel-code-frame": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
@@ -513,6 +596,47 @@
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
"dev": true
},
+ "bl": {
+ "version": "0.8.2",
+ "resolved": "https://bnpm.byted.org/bl/download/bl-0.8.2.tgz",
+ "integrity": "sha1-yba8oI0bwuoA/Ir7Txpf0eHGbk4=",
+ "dev": true,
+ "requires": {
+ "readable-stream": "~1.0.26"
+ },
+ "dependencies": {
+ "isarray": {
+ "version": "0.0.1",
+ "resolved": "https://bnpm.byted.org/isarray/download/isarray-0.0.1.tgz",
+ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
+ "dev": true
+ },
+ "readable-stream": {
+ "version": "1.0.34",
+ "resolved": "https://bnpm.byted.org/readable-stream/download/readable-stream-1.0.34.tgz",
+ "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
+ "dev": true,
+ "requires": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.1",
+ "isarray": "0.0.1",
+ "string_decoder": "~0.10.x"
+ }
+ },
+ "string_decoder": {
+ "version": "0.10.31",
+ "resolved": "https://bnpm.byted.org/string_decoder/download/string_decoder-0.10.31.tgz",
+ "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
+ "dev": true
+ }
+ }
+ },
+ "bn.js": {
+ "version": "5.1.3",
+ "resolved": "https://bnpm.byted.org/bn.js/download/bn.js-5.1.3.tgz",
+ "integrity": "sha1-vsoAVAj2Quvr6oCwQrTRjSrA7ms=",
+ "dev": true
+ },
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
@@ -523,18 +647,136 @@
"concat-map": "0.0.1"
}
},
+ "brorand": {
+ "version": "1.1.0",
+ "resolved": "https://bnpm.byted.org/brorand/download/brorand-1.1.0.tgz",
+ "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=",
+ "dev": true
+ },
"browser-stdout": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz",
"integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==",
"dev": true
},
+ "browserify-aes": {
+ "version": "1.2.0",
+ "resolved": "https://bnpm.byted.org/browserify-aes/download/browserify-aes-1.2.0.tgz",
+ "integrity": "sha1-Mmc0ZC9APavDADIJhTu3CtQo70g=",
+ "dev": true,
+ "requires": {
+ "buffer-xor": "^1.0.3",
+ "cipher-base": "^1.0.0",
+ "create-hash": "^1.1.0",
+ "evp_bytestokey": "^1.0.3",
+ "inherits": "^2.0.1",
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "browserify-cipher": {
+ "version": "1.0.1",
+ "resolved": "https://bnpm.byted.org/browserify-cipher/download/browserify-cipher-1.0.1.tgz",
+ "integrity": "sha1-jWR0wbhwv9q807z8wZNKEOlPFfA=",
+ "dev": true,
+ "requires": {
+ "browserify-aes": "^1.0.4",
+ "browserify-des": "^1.0.0",
+ "evp_bytestokey": "^1.0.0"
+ }
+ },
+ "browserify-des": {
+ "version": "1.0.2",
+ "resolved": "https://bnpm.byted.org/browserify-des/download/browserify-des-1.0.2.tgz",
+ "integrity": "sha1-OvTx9Zg5QDVy8cZiBDdfen9wPpw=",
+ "dev": true,
+ "requires": {
+ "cipher-base": "^1.0.1",
+ "des.js": "^1.0.0",
+ "inherits": "^2.0.1",
+ "safe-buffer": "^5.1.2"
+ }
+ },
+ "browserify-fs": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/browserify-fs/-/browserify-fs-1.0.0.tgz",
+ "integrity": "sha1-8HWqinKdTRcW0GZiDjhvzBMRqW8=",
+ "dev": true,
+ "requires": {
+ "level-filesystem": "^1.0.1",
+ "level-js": "^2.1.3",
+ "levelup": "^0.18.2"
+ }
+ },
+ "browserify-rsa": {
+ "version": "4.1.0",
+ "resolved": "https://bnpm.byted.org/browserify-rsa/download/browserify-rsa-4.1.0.tgz",
+ "integrity": "sha1-sv0Gtbda4pf3zi3GUfkY9b4VjI0=",
+ "dev": true,
+ "requires": {
+ "bn.js": "^5.0.0",
+ "randombytes": "^2.0.1"
+ }
+ },
+ "browserify-sign": {
+ "version": "4.2.1",
+ "resolved": "https://bnpm.byted.org/browserify-sign/download/browserify-sign-4.2.1.tgz",
+ "integrity": "sha1-6vSt1G3VS+O7OzbAzxWrvrp5VsM=",
+ "dev": true,
+ "requires": {
+ "bn.js": "^5.1.1",
+ "browserify-rsa": "^4.0.1",
+ "create-hash": "^1.2.0",
+ "create-hmac": "^1.1.7",
+ "elliptic": "^6.5.3",
+ "inherits": "^2.0.4",
+ "parse-asn1": "^5.1.5",
+ "readable-stream": "^3.6.0",
+ "safe-buffer": "^5.2.0"
+ },
+ "dependencies": {
+ "inherits": {
+ "version": "2.0.4",
+ "resolved": "https://bnpm.byted.org/inherits/download/inherits-2.0.4.tgz",
+ "integrity": "sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w=",
+ "dev": true
+ },
+ "readable-stream": {
+ "version": "3.6.0",
+ "resolved": "https://bnpm.byted.org/readable-stream/download/readable-stream-3.6.0.tgz",
+ "integrity": "sha1-M3u9o63AcGvT4CRCaihtS0sskZg=",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://bnpm.byted.org/safe-buffer/download/safe-buffer-5.2.1.tgz",
+ "integrity": "sha1-Hq+fqb2x/dTsdfWPnNtOa3gn7sY=",
+ "dev": true
+ }
+ }
+ },
+ "buffer-es6": {
+ "version": "4.9.3",
+ "resolved": "https://registry.npmjs.org/buffer-es6/-/buffer-es6-4.9.3.tgz",
+ "integrity": "sha1-8mNHuC33b9N+GLy1KIxJcM/VxAQ=",
+ "dev": true
+ },
"buffer-from": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.0.0.tgz",
"integrity": "sha512-83apNb8KK0Se60UE1+4Ukbe3HbfELJ6UlI4ldtOGs7So4KD26orJM8hIY9lxdzP+UpItH1Yh/Y8GUvNFWFFRxA==",
"dev": true
},
+ "buffer-xor": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz",
+ "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=",
+ "dev": true
+ },
"builtin-modules": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz",
@@ -580,6 +822,16 @@
}
}
},
+ "cipher-base": {
+ "version": "1.0.4",
+ "resolved": "https://bnpm.byted.org/cipher-base/download/cipher-base-1.0.4.tgz",
+ "integrity": "sha1-h2Dk7MJy9MNjUy+SbYdKriwTl94=",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.1",
+ "safe-buffer": "^5.0.1"
+ }
+ },
"clean-stack": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz",
@@ -667,6 +919,12 @@
}
}
},
+ "clone": {
+ "version": "0.1.19",
+ "resolved": "https://bnpm.byted.org/clone/download/clone-0.1.19.tgz",
+ "integrity": "sha1-YT+2hjmyaklKxTJT4Vsaa9iK2oU=",
+ "dev": true
+ },
"co": {
"version": "4.6.0",
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
@@ -725,6 +983,18 @@
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
"dev": true
},
+ "concat-stream": {
+ "version": "1.6.2",
+ "resolved": "https://bnpm.byted.org/concat-stream/download/concat-stream-1.6.2.tgz",
+ "integrity": "sha1-kEvfGUzTEi/Gdcd/xKw9T/D9GjQ=",
+ "dev": true,
+ "requires": {
+ "buffer-from": "^1.0.0",
+ "inherits": "^2.0.3",
+ "readable-stream": "^2.2.2",
+ "typedarray": "^0.0.6"
+ }
+ },
"convert-source-map": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.7.0.tgz",
@@ -734,6 +1004,57 @@
"safe-buffer": "~5.1.1"
}
},
+ "core-util-is": {
+ "version": "1.0.2",
+ "resolved": "https://bnpm.byted.org/core-util-is/download/core-util-is-1.0.2.tgz",
+ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=",
+ "dev": true
+ },
+ "create-ecdh": {
+ "version": "4.0.4",
+ "resolved": "https://bnpm.byted.org/create-ecdh/download/create-ecdh-4.0.4.tgz",
+ "integrity": "sha1-1uf0v/pmc2CFoHYv06YyaE2rzE4=",
+ "dev": true,
+ "requires": {
+ "bn.js": "^4.1.0",
+ "elliptic": "^6.5.3"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://bnpm.byted.org/bn.js/download/bn.js-4.11.9.tgz",
+ "integrity": "sha1-JtVWgpRY+dHoH8SJUkk9C6NQeCg=",
+ "dev": true
+ }
+ }
+ },
+ "create-hash": {
+ "version": "1.2.0",
+ "resolved": "https://bnpm.byted.org/create-hash/download/create-hash-1.2.0.tgz",
+ "integrity": "sha1-iJB4rxGmN1a8+1m9IhmWvjqe8ZY=",
+ "dev": true,
+ "requires": {
+ "cipher-base": "^1.0.1",
+ "inherits": "^2.0.1",
+ "md5.js": "^1.3.4",
+ "ripemd160": "^2.0.1",
+ "sha.js": "^2.4.0"
+ }
+ },
+ "create-hmac": {
+ "version": "1.1.7",
+ "resolved": "https://bnpm.byted.org/create-hmac/download/create-hmac-1.1.7.tgz",
+ "integrity": "sha1-aRcMeLOrlXFHsriwRXLkfq0iQ/8=",
+ "dev": true,
+ "requires": {
+ "cipher-base": "^1.0.3",
+ "create-hash": "^1.1.0",
+ "inherits": "^2.0.1",
+ "ripemd160": "^2.0.0",
+ "safe-buffer": "^5.0.1",
+ "sha.js": "^2.4.8"
+ }
+ },
"cross-spawn": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
@@ -745,6 +1066,25 @@
"which": "^1.2.9"
}
},
+ "crypto-browserify": {
+ "version": "3.12.0",
+ "resolved": "https://bnpm.byted.org/crypto-browserify/download/crypto-browserify-3.12.0.tgz",
+ "integrity": "sha1-OWz58xN/A+S45TLFj2mCVOAPgOw=",
+ "dev": true,
+ "requires": {
+ "browserify-cipher": "^1.0.0",
+ "browserify-sign": "^4.0.0",
+ "create-ecdh": "^4.0.0",
+ "create-hash": "^1.1.0",
+ "create-hmac": "^1.1.0",
+ "diffie-hellman": "^5.0.0",
+ "inherits": "^2.0.1",
+ "pbkdf2": "^3.0.3",
+ "public-encrypt": "^4.0.0",
+ "randombytes": "^2.0.0",
+ "randomfill": "^1.0.3"
+ }
+ },
"debounce": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.0.tgz",
@@ -766,6 +1106,12 @@
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=",
"dev": true
},
+ "decode-uri-component": {
+ "version": "0.2.0",
+ "resolved": "https://bnpm.byted.org/decode-uri-component/download/decode-uri-component-0.2.0.tgz",
+ "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=",
+ "dev": true
+ },
"default-require-extensions": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.0.tgz",
@@ -783,24 +1129,94 @@
}
}
},
+ "deferred-leveldown": {
+ "version": "0.2.0",
+ "resolved": "https://bnpm.byted.org/deferred-leveldown/download/deferred-leveldown-0.2.0.tgz",
+ "integrity": "sha1-LO8fER4cV4cNi7uK8mUOWHzS9bQ=",
+ "dev": true,
+ "requires": {
+ "abstract-leveldown": "~0.12.1"
+ }
+ },
+ "des.js": {
+ "version": "1.0.1",
+ "resolved": "https://bnpm.byted.org/des.js/download/des.js-1.0.1.tgz",
+ "integrity": "sha1-U4IULhvcU/hdhtU+X0qn3rkeCEM=",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.1",
+ "minimalistic-assert": "^1.0.0"
+ }
+ },
"diff": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
"integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
"dev": true
},
+ "diffie-hellman": {
+ "version": "5.0.3",
+ "resolved": "https://bnpm.byted.org/diffie-hellman/download/diffie-hellman-5.0.3.tgz",
+ "integrity": "sha1-QOjumPVaIUlgcUaSHGPhrl89KHU=",
+ "dev": true,
+ "requires": {
+ "bn.js": "^4.1.0",
+ "miller-rabin": "^4.0.0",
+ "randombytes": "^2.0.0"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://bnpm.byted.org/bn.js/download/bn.js-4.11.9.tgz",
+ "integrity": "sha1-JtVWgpRY+dHoH8SJUkk9C6NQeCg=",
+ "dev": true
+ }
+ }
+ },
"duplexer": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
"integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=",
"dev": true
},
+ "elliptic": {
+ "version": "6.5.3",
+ "resolved": "https://bnpm.byted.org/elliptic/download/elliptic-6.5.3.tgz",
+ "integrity": "sha1-y1nrLv2vc6C9eMzXAVpirW4Pk9Y=",
+ "dev": true,
+ "requires": {
+ "bn.js": "^4.4.0",
+ "brorand": "^1.0.1",
+ "hash.js": "^1.0.0",
+ "hmac-drbg": "^1.0.0",
+ "inherits": "^2.0.1",
+ "minimalistic-assert": "^1.0.0",
+ "minimalistic-crypto-utils": "^1.0.0"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://bnpm.byted.org/bn.js/download/bn.js-4.11.9.tgz",
+ "integrity": "sha1-JtVWgpRY+dHoH8SJUkk9C6NQeCg=",
+ "dev": true
+ }
+ }
+ },
"emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"dev": true
},
+ "errno": {
+ "version": "0.1.7",
+ "resolved": "https://bnpm.byted.org/errno/download/errno-0.1.7.tgz",
+ "integrity": "sha1-RoTXF3mtOa8Xfj8AeZb3xnyFJhg=",
+ "dev": true,
+ "requires": {
+ "prr": "~1.0.1"
+ }
+ },
"error-ex": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz",
@@ -828,12 +1244,28 @@
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true
},
+ "estree-walker": {
+ "version": "0.6.1",
+ "resolved": "https://bnpm.byted.org/estree-walker/download/estree-walker-0.6.1.tgz",
+ "integrity": "sha1-UwSRQ/QMbrkYsjZx0f4yGfOhs2I=",
+ "dev": true
+ },
"esutils": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
"integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=",
"dev": true
},
+ "evp_bytestokey": {
+ "version": "1.0.3",
+ "resolved": "https://bnpm.byted.org/evp_bytestokey/download/evp_bytestokey-1.0.3.tgz",
+ "integrity": "sha1-f8vbGY3HGVlDLv4ThCaE4FJaywI=",
+ "dev": true,
+ "requires": {
+ "md5.js": "^1.3.4",
+ "safe-buffer": "^5.1.1"
+ }
+ },
"find-cache-dir": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz",
@@ -861,6 +1293,12 @@
"pinkie-promise": "^2.0.0"
}
},
+ "foreach": {
+ "version": "2.0.5",
+ "resolved": "https://bnpm.byted.org/foreach/download/foreach-2.0.5.tgz",
+ "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=",
+ "dev": true
+ },
"foreground-child": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz",
@@ -939,6 +1377,54 @@
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
"dev": true
},
+ "fsevents": {
+ "version": "2.1.3",
+ "resolved": "https://bnpm.byted.org/fsevents/download/fsevents-2.1.3.tgz",
+ "integrity": "sha1-+3OHA66NL5/pAMM4Nt3r7ouX8j4=",
+ "dev": true,
+ "optional": true
+ },
+ "function-bind": {
+ "version": "1.1.1",
+ "resolved": "https://bnpm.byted.org/function-bind/download/function-bind-1.1.1.tgz",
+ "integrity": "sha1-pWiZ0+o8m6uHS7l3O3xe3pL0iV0=",
+ "dev": true
+ },
+ "fwd-stream": {
+ "version": "1.0.4",
+ "resolved": "https://bnpm.byted.org/fwd-stream/download/fwd-stream-1.0.4.tgz",
+ "integrity": "sha1-7Sgcq+1G/uz5Ie4y3ExQs3KsfPo=",
+ "dev": true,
+ "requires": {
+ "readable-stream": "~1.0.26-4"
+ },
+ "dependencies": {
+ "isarray": {
+ "version": "0.0.1",
+ "resolved": "https://bnpm.byted.org/isarray/download/isarray-0.0.1.tgz",
+ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
+ "dev": true
+ },
+ "readable-stream": {
+ "version": "1.0.34",
+ "resolved": "https://bnpm.byted.org/readable-stream/download/readable-stream-1.0.34.tgz",
+ "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
+ "dev": true,
+ "requires": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.1",
+ "isarray": "0.0.1",
+ "string_decoder": "~0.10.x"
+ }
+ },
+ "string_decoder": {
+ "version": "0.10.31",
+ "resolved": "https://bnpm.byted.org/string_decoder/download/string_decoder-0.10.31.tgz",
+ "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
+ "dev": true
+ }
+ }
+ },
"gensync": {
"version": "1.0.0-beta.1",
"resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.1.tgz",
@@ -1012,6 +1498,15 @@
}
}
},
+ "has": {
+ "version": "1.0.3",
+ "resolved": "https://bnpm.byted.org/has/download/has-1.0.3.tgz",
+ "integrity": "sha1-ci18v8H2qoJB8W3YFOAR4fQeh5Y=",
+ "dev": true,
+ "requires": {
+ "function-bind": "^1.1.1"
+ }
+ },
"has-ansi": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz",
@@ -1027,6 +1522,52 @@
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
},
+ "hash-base": {
+ "version": "3.1.0",
+ "resolved": "https://bnpm.byted.org/hash-base/download/hash-base-3.1.0.tgz",
+ "integrity": "sha1-VcOB2eBuHSmXqIO0o/3f5/DTrzM=",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.4",
+ "readable-stream": "^3.6.0",
+ "safe-buffer": "^5.2.0"
+ },
+ "dependencies": {
+ "inherits": {
+ "version": "2.0.4",
+ "resolved": "https://bnpm.byted.org/inherits/download/inherits-2.0.4.tgz",
+ "integrity": "sha1-D6LGT5MpF8NDOg3tVTY6rjdBa3w=",
+ "dev": true
+ },
+ "readable-stream": {
+ "version": "3.6.0",
+ "resolved": "https://bnpm.byted.org/readable-stream/download/readable-stream-3.6.0.tgz",
+ "integrity": "sha1-M3u9o63AcGvT4CRCaihtS0sskZg=",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.3",
+ "string_decoder": "^1.1.1",
+ "util-deprecate": "^1.0.1"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://bnpm.byted.org/safe-buffer/download/safe-buffer-5.2.1.tgz",
+ "integrity": "sha1-Hq+fqb2x/dTsdfWPnNtOa3gn7sY=",
+ "dev": true
+ }
+ }
+ },
+ "hash.js": {
+ "version": "1.1.7",
+ "resolved": "https://bnpm.byted.org/hash.js/download/hash.js-1.1.7.tgz",
+ "integrity": "sha1-C6vKU46NTuSg+JiNaIZlN6ADz0I=",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.3",
+ "minimalistic-assert": "^1.0.1"
+ }
+ },
"hasha": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.0.tgz",
@@ -1049,6 +1590,17 @@
"integrity": "sha512-feMUrVLZvjy0oC7FVJQcSQRqbBq9kwqnYE4+Kj9ZjbHh3g+BisiPgF49NyQbVLNdrL/qqZr3Ca9yOKwgn2i/tw==",
"dev": true
},
+ "hmac-drbg": {
+ "version": "1.0.1",
+ "resolved": "https://bnpm.byted.org/hmac-drbg/download/hmac-drbg-1.0.1.tgz",
+ "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=",
+ "dev": true,
+ "requires": {
+ "hash.js": "^1.0.3",
+ "minimalistic-assert": "^1.0.0",
+ "minimalistic-crypto-utils": "^1.0.1"
+ }
+ },
"hosted-git-info": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.6.0.tgz",
@@ -1122,6 +1674,12 @@
}
}
},
+ "idb-wrapper": {
+ "version": "1.7.2",
+ "resolved": "https://bnpm.byted.org/idb-wrapper/download/idb-wrapper-1.7.2.tgz",
+ "integrity": "sha1-glGv1ed/6VVoscFhUutEs5Z2fqI=",
+ "dev": true
+ },
"ignore-walk": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz",
@@ -1143,6 +1701,12 @@
"integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
"dev": true
},
+ "indexof": {
+ "version": "0.0.1",
+ "resolved": "https://bnpm.byted.org/indexof/download/indexof-0.0.1.tgz",
+ "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=",
+ "dev": true
+ },
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
@@ -1171,6 +1735,12 @@
"integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=",
"dev": true
},
+ "is": {
+ "version": "0.2.7",
+ "resolved": "https://bnpm.byted.org/is/download/is-0.2.7.tgz",
+ "integrity": "sha1-OzSixI81mXLzUEKEkZOucmS2NWI=",
+ "dev": true
+ },
"is-arrayish": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
@@ -1186,6 +1756,15 @@
"builtin-modules": "^1.0.0"
}
},
+ "is-core-module": {
+ "version": "2.1.0",
+ "resolved": "https://bnpm.byted.org/is-core-module/download/is-core-module-2.1.0.tgz",
+ "integrity": "sha1-pMwDHZsaymPuy9GKZQ4Ty07quUY=",
+ "dev": true,
+ "requires": {
+ "has": "^1.0.3"
+ }
+ },
"is-fullwidth-code-point": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz",
@@ -1195,6 +1774,27 @@
"number-is-nan": "^1.0.0"
}
},
+ "is-module": {
+ "version": "1.0.0",
+ "resolved": "https://bnpm.byted.org/is-module/download/is-module-1.0.0.tgz",
+ "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=",
+ "dev": true
+ },
+ "is-object": {
+ "version": "0.1.2",
+ "resolved": "https://bnpm.byted.org/is-object/download/is-object-0.1.2.tgz",
+ "integrity": "sha1-AO+8CIFsM8/ErIJR0TLhDcZQmNc=",
+ "dev": true
+ },
+ "is-reference": {
+ "version": "1.2.1",
+ "resolved": "https://bnpm.byted.org/is-reference/download/is-reference-1.2.1.tgz",
+ "integrity": "sha1-iy2sCzcfS8mU/eq6nrVC0DAC0Lc=",
+ "dev": true,
+ "requires": {
+ "@types/estree": "*"
+ }
+ },
"is-stream": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz",
@@ -1219,6 +1819,18 @@
"integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==",
"dev": true
},
+ "isarray": {
+ "version": "1.0.0",
+ "resolved": "https://bnpm.byted.org/isarray/download/isarray-1.0.0.tgz",
+ "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=",
+ "dev": true
+ },
+ "isbuffer": {
+ "version": "0.0.0",
+ "resolved": "https://bnpm.byted.org/isbuffer/download/isbuffer-0.0.0.tgz",
+ "integrity": "sha1-OMFG2d9Si4v5sHAcPUPPEt8/w5s=",
+ "dev": true
+ },
"isexe": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
@@ -1411,49 +2023,250 @@
"integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==",
"dev": true,
"requires": {
- "argparse": "^1.0.7",
- "esprima": "^4.0.0"
+ "argparse": "^1.0.7",
+ "esprima": "^4.0.0"
+ }
+ },
+ "jsesc": {
+ "version": "2.5.2",
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
+ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==",
+ "dev": true
+ },
+ "json5": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.2.tgz",
+ "integrity": "sha512-MoUOQ4WdiN3yxhm7NEVJSJrieAo5hNSLQ5sj05OTRHPL9HOBy8u4Bu88jsC1jvqAdN+E1bJmsUcZH+1HQxliqQ==",
+ "dev": true,
+ "requires": {
+ "minimist": "^1.2.5"
+ },
+ "dependencies": {
+ "minimist": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
+ "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
+ "dev": true
+ }
+ }
+ },
+ "jsonfile": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
+ "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.6"
+ }
+ },
+ "lcid": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz",
+ "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=",
+ "dev": true,
+ "requires": {
+ "invert-kv": "^1.0.0"
+ }
+ },
+ "level-blobs": {
+ "version": "0.1.7",
+ "resolved": "https://bnpm.byted.org/level-blobs/download/level-blobs-0.1.7.tgz",
+ "integrity": "sha1-mrm5e7mfHtv594o0M+Ie1WOGva8=",
+ "dev": true,
+ "requires": {
+ "level-peek": "1.0.6",
+ "once": "^1.3.0",
+ "readable-stream": "^1.0.26-4"
+ },
+ "dependencies": {
+ "isarray": {
+ "version": "0.0.1",
+ "resolved": "https://bnpm.byted.org/isarray/download/isarray-0.0.1.tgz",
+ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
+ "dev": true
+ },
+ "readable-stream": {
+ "version": "1.1.14",
+ "resolved": "https://bnpm.byted.org/readable-stream/download/readable-stream-1.1.14.tgz",
+ "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
+ "dev": true,
+ "requires": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.1",
+ "isarray": "0.0.1",
+ "string_decoder": "~0.10.x"
+ }
+ },
+ "string_decoder": {
+ "version": "0.10.31",
+ "resolved": "https://bnpm.byted.org/string_decoder/download/string_decoder-0.10.31.tgz",
+ "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
+ "dev": true
+ }
+ }
+ },
+ "level-filesystem": {
+ "version": "1.2.0",
+ "resolved": "https://bnpm.byted.org/level-filesystem/download/level-filesystem-1.2.0.tgz",
+ "integrity": "sha1-oArKmRnEpN+v3KaoEI0iWq3/Y7M=",
+ "dev": true,
+ "requires": {
+ "concat-stream": "^1.4.4",
+ "errno": "^0.1.1",
+ "fwd-stream": "^1.0.4",
+ "level-blobs": "^0.1.7",
+ "level-peek": "^1.0.6",
+ "level-sublevel": "^5.2.0",
+ "octal": "^1.0.0",
+ "once": "^1.3.0",
+ "xtend": "^2.2.0"
}
},
- "jsesc": {
- "version": "2.5.2",
- "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
- "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==",
+ "level-fix-range": {
+ "version": "1.0.2",
+ "resolved": "https://bnpm.byted.org/level-fix-range/download/level-fix-range-1.0.2.tgz",
+ "integrity": "sha1-vxW5Fa422EcMgh6IPd95zRZCCCg=",
"dev": true
},
- "json5": {
- "version": "2.1.2",
- "resolved": "https://registry.npmjs.org/json5/-/json5-2.1.2.tgz",
- "integrity": "sha512-MoUOQ4WdiN3yxhm7NEVJSJrieAo5hNSLQ5sj05OTRHPL9HOBy8u4Bu88jsC1jvqAdN+E1bJmsUcZH+1HQxliqQ==",
+ "level-hooks": {
+ "version": "4.5.0",
+ "resolved": "https://bnpm.byted.org/level-hooks/download/level-hooks-4.5.0.tgz",
+ "integrity": "sha1-G5rmGSKTDzMF0aYfxNg8gQLA3ZM=",
"dev": true,
"requires": {
- "minimist": "^1.2.5"
+ "string-range": "~1.2"
+ }
+ },
+ "level-js": {
+ "version": "2.2.4",
+ "resolved": "https://bnpm.byted.org/level-js/download/level-js-2.2.4.tgz",
+ "integrity": "sha1-vAVfQYBjXUSJtWHJSG+jcOjBFpc=",
+ "dev": true,
+ "requires": {
+ "abstract-leveldown": "~0.12.0",
+ "idb-wrapper": "^1.5.0",
+ "isbuffer": "~0.0.0",
+ "ltgt": "^2.1.2",
+ "typedarray-to-buffer": "~1.0.0",
+ "xtend": "~2.1.2"
},
"dependencies": {
- "minimist": {
- "version": "1.2.5",
- "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
- "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==",
+ "object-keys": {
+ "version": "0.4.0",
+ "resolved": "https://bnpm.byted.org/object-keys/download/object-keys-0.4.0.tgz",
+ "integrity": "sha1-KKaq50KN0sOpLz2V8hM13SBOAzY=",
"dev": true
+ },
+ "xtend": {
+ "version": "2.1.2",
+ "resolved": "https://bnpm.byted.org/xtend/download/xtend-2.1.2.tgz",
+ "integrity": "sha1-bv7MKk2tjmlixJAbM3znuoe10os=",
+ "dev": true,
+ "requires": {
+ "object-keys": "~0.4.0"
+ }
}
}
},
- "jsonfile": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
- "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
+ "level-peek": {
+ "version": "1.0.6",
+ "resolved": "https://bnpm.byted.org/level-peek/download/level-peek-1.0.6.tgz",
+ "integrity": "sha1-vsUccqgu5GTTNkNMfIdsP8vM538=",
"dev": true,
"requires": {
- "graceful-fs": "^4.1.6"
+ "level-fix-range": "~1.0.2"
}
},
- "lcid": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz",
- "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=",
+ "level-sublevel": {
+ "version": "5.2.3",
+ "resolved": "https://bnpm.byted.org/level-sublevel/download/level-sublevel-5.2.3.tgz",
+ "integrity": "sha1-dEwSxy0ucr543eO5tc2E1iGRQTo=",
"dev": true,
"requires": {
- "invert-kv": "^1.0.0"
+ "level-fix-range": "2.0",
+ "level-hooks": ">=4.4.0 <5",
+ "string-range": "~1.2.1",
+ "xtend": "~2.0.4"
+ },
+ "dependencies": {
+ "level-fix-range": {
+ "version": "2.0.0",
+ "resolved": "https://bnpm.byted.org/level-fix-range/download/level-fix-range-2.0.0.tgz",
+ "integrity": "sha1-xBfWIVlEIVGhnZojZ4aPFyTC1Ug=",
+ "dev": true,
+ "requires": {
+ "clone": "~0.1.9"
+ }
+ },
+ "xtend": {
+ "version": "2.0.6",
+ "resolved": "https://bnpm.byted.org/xtend/download/xtend-2.0.6.tgz",
+ "integrity": "sha1-XqZXptukRwacLlnFihE4ywxebO4=",
+ "dev": true,
+ "requires": {
+ "is-object": "~0.1.2",
+ "object-keys": "~0.2.0"
+ }
+ }
+ }
+ },
+ "levelup": {
+ "version": "0.18.6",
+ "resolved": "https://bnpm.byted.org/levelup/download/levelup-0.18.6.tgz",
+ "integrity": "sha1-5qAcsIlhbI7MApHCqb0/DETj5es=",
+ "dev": true,
+ "requires": {
+ "bl": "~0.8.1",
+ "deferred-leveldown": "~0.2.0",
+ "errno": "~0.1.1",
+ "prr": "~0.0.0",
+ "readable-stream": "~1.0.26",
+ "semver": "~2.3.1",
+ "xtend": "~3.0.0"
+ },
+ "dependencies": {
+ "isarray": {
+ "version": "0.0.1",
+ "resolved": "https://bnpm.byted.org/isarray/download/isarray-0.0.1.tgz",
+ "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
+ "dev": true
+ },
+ "prr": {
+ "version": "0.0.0",
+ "resolved": "https://bnpm.byted.org/prr/download/prr-0.0.0.tgz",
+ "integrity": "sha1-GoS4WQgyVQFBGFPQCB7j+obikmo=",
+ "dev": true
+ },
+ "readable-stream": {
+ "version": "1.0.34",
+ "resolved": "https://bnpm.byted.org/readable-stream/download/readable-stream-1.0.34.tgz",
+ "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
+ "dev": true,
+ "requires": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.1",
+ "isarray": "0.0.1",
+ "string_decoder": "~0.10.x"
+ }
+ },
+ "semver": {
+ "version": "2.3.2",
+ "resolved": "https://bnpm.byted.org/semver/download/semver-2.3.2.tgz",
+ "integrity": "sha1-uYSPJdbPNjMwc+ye+IVtQvEjPlI=",
+ "dev": true
+ },
+ "string_decoder": {
+ "version": "0.10.31",
+ "resolved": "https://bnpm.byted.org/string_decoder/download/string_decoder-0.10.31.tgz",
+ "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
+ "dev": true
+ },
+ "xtend": {
+ "version": "3.0.0",
+ "resolved": "https://bnpm.byted.org/xtend/download/xtend-3.0.0.tgz",
+ "integrity": "sha1-XM50B7r2Qsunvs2laBEcST9ZZlo=",
+ "dev": true
+ }
}
},
"load-json-file": {
@@ -1500,12 +2313,27 @@
"yallist": "^2.1.2"
}
},
+ "ltgt": {
+ "version": "2.2.1",
+ "resolved": "https://bnpm.byted.org/ltgt/download/ltgt-2.2.1.tgz",
+ "integrity": "sha1-81ypHEk/e3PaDgdJUwTxezH4fuU=",
+ "dev": true
+ },
"lunr": {
"version": "2.3.8",
"resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.8.tgz",
"integrity": "sha512-oxMeX/Y35PNFuZoHp+jUj5OSEmLCaIH4KTFJh7a93cHBoFmpw2IoPs22VIz7vyO2YUnx2Tn9dzIwO2P/4quIRg==",
"dev": true
},
+ "magic-string": {
+ "version": "0.25.7",
+ "resolved": "https://bnpm.byted.org/magic-string/download/magic-string-0.25.7.tgz",
+ "integrity": "sha1-P0l9b9NMZpxnmNy4IfLvMfVEUFE=",
+ "dev": true,
+ "requires": {
+ "sourcemap-codec": "^1.4.4"
+ }
+ },
"make-dir": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.0.2.tgz",
@@ -1529,6 +2357,47 @@
"integrity": "sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg==",
"dev": true
},
+ "md5.js": {
+ "version": "1.3.5",
+ "resolved": "https://bnpm.byted.org/md5.js/download/md5.js-1.3.5.tgz",
+ "integrity": "sha1-tdB7jjIW4+J81yjXL3DR5qNCAF8=",
+ "dev": true,
+ "requires": {
+ "hash-base": "^3.0.0",
+ "inherits": "^2.0.1",
+ "safe-buffer": "^5.1.2"
+ }
+ },
+ "miller-rabin": {
+ "version": "4.0.1",
+ "resolved": "https://bnpm.byted.org/miller-rabin/download/miller-rabin-4.0.1.tgz",
+ "integrity": "sha1-8IA1HIZbDcViqEYpZtqlNUPHik0=",
+ "dev": true,
+ "requires": {
+ "bn.js": "^4.0.0",
+ "brorand": "^1.0.1"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://bnpm.byted.org/bn.js/download/bn.js-4.11.9.tgz",
+ "integrity": "sha1-JtVWgpRY+dHoH8SJUkk9C6NQeCg=",
+ "dev": true
+ }
+ }
+ },
+ "minimalistic-assert": {
+ "version": "1.0.1",
+ "resolved": "https://bnpm.byted.org/minimalistic-assert/download/minimalistic-assert-1.0.1.tgz",
+ "integrity": "sha1-LhlN4ERibUoQ5/f7wAznPoPk1cc=",
+ "dev": true
+ },
+ "minimalistic-crypto-utils": {
+ "version": "1.0.1",
+ "resolved": "https://bnpm.byted.org/minimalistic-crypto-utils/download/minimalistic-crypto-utils-1.0.1.tgz",
+ "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=",
+ "dev": true
+ },
"minimatch": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
@@ -1774,6 +2643,23 @@
}
}
},
+ "object-keys": {
+ "version": "0.2.0",
+ "resolved": "https://bnpm.byted.org/object-keys/download/object-keys-0.2.0.tgz",
+ "integrity": "sha1-zd7AKZiwkb5CvxA1rjLknxy26mc=",
+ "dev": true,
+ "requires": {
+ "foreach": "~2.0.1",
+ "indexof": "~0.0.1",
+ "is": "~0.2.6"
+ }
+ },
+ "octal": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/octal/-/octal-1.0.0.tgz",
+ "integrity": "sha1-Y+cWKmjvvrniE1iNWOmJ0eXEUws=",
+ "dev": true
+ },
"once": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
@@ -1863,6 +2749,19 @@
}
}
},
+ "parse-asn1": {
+ "version": "5.1.6",
+ "resolved": "https://bnpm.byted.org/parse-asn1/download/parse-asn1-5.1.6.tgz",
+ "integrity": "sha1-OFCAo+wTy2KmLTlAnLPoiETNrtQ=",
+ "dev": true,
+ "requires": {
+ "asn1.js": "^5.2.0",
+ "browserify-aes": "^1.0.0",
+ "evp_bytestokey": "^1.0.0",
+ "pbkdf2": "^3.0.3",
+ "safe-buffer": "^5.1.1"
+ }
+ },
"parse-json": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz",
@@ -1910,6 +2809,25 @@
"pinkie-promise": "^2.0.0"
}
},
+ "pbkdf2": {
+ "version": "3.1.1",
+ "resolved": "https://bnpm.byted.org/pbkdf2/download/pbkdf2-3.1.1.tgz",
+ "integrity": "sha1-y4cksPramEWWhW0abrr9NYRlS5Q=",
+ "dev": true,
+ "requires": {
+ "create-hash": "^1.1.2",
+ "create-hmac": "^1.1.4",
+ "ripemd160": "^2.0.1",
+ "safe-buffer": "^5.0.1",
+ "sha.js": "^2.4.8"
+ }
+ },
+ "picomatch": {
+ "version": "2.2.2",
+ "resolved": "https://bnpm.byted.org/picomatch/download/picomatch-2.2.2.tgz",
+ "integrity": "sha1-IfMz6ba46v8CRo9RRupAbTRfTa0=",
+ "dev": true
+ },
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
@@ -1958,6 +2876,18 @@
}
}
},
+ "process-es6": {
+ "version": "0.11.6",
+ "resolved": "https://bnpm.byted.org/process-es6/download/process-es6-0.11.6.tgz",
+ "integrity": "sha1-xrs4n5qVH4K9TrFpYAEFvS/5x3g=",
+ "dev": true
+ },
+ "process-nextick-args": {
+ "version": "2.0.1",
+ "resolved": "https://bnpm.byted.org/process-nextick-args/download/process-nextick-args-2.0.1.tgz",
+ "integrity": "sha1-eCDZsWEgzFXKmud5JoCufbptf+I=",
+ "dev": true
+ },
"process-on-spawn": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/process-on-spawn/-/process-on-spawn-1.0.0.tgz",
@@ -1973,12 +2903,59 @@
"integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==",
"dev": true
},
+ "prr": {
+ "version": "1.0.1",
+ "resolved": "https://bnpm.byted.org/prr/download/prr-1.0.1.tgz",
+ "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=",
+ "dev": true
+ },
"pseudomap": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
"integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=",
"dev": true
},
+ "public-encrypt": {
+ "version": "4.0.3",
+ "resolved": "https://bnpm.byted.org/public-encrypt/download/public-encrypt-4.0.3.tgz",
+ "integrity": "sha1-T8ydd6B+SLp1J+fL4N4z0HATMeA=",
+ "dev": true,
+ "requires": {
+ "bn.js": "^4.1.0",
+ "browserify-rsa": "^4.0.0",
+ "create-hash": "^1.1.0",
+ "parse-asn1": "^5.0.0",
+ "randombytes": "^2.0.1",
+ "safe-buffer": "^5.1.2"
+ },
+ "dependencies": {
+ "bn.js": {
+ "version": "4.11.9",
+ "resolved": "https://bnpm.byted.org/bn.js/download/bn.js-4.11.9.tgz",
+ "integrity": "sha1-JtVWgpRY+dHoH8SJUkk9C6NQeCg=",
+ "dev": true
+ }
+ }
+ },
+ "randombytes": {
+ "version": "2.1.0",
+ "resolved": "https://bnpm.byted.org/randombytes/download/randombytes-2.1.0.tgz",
+ "integrity": "sha1-32+ENy8CcNxlzfYpE0mrekc9Tyo=",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "^5.1.0"
+ }
+ },
+ "randomfill": {
+ "version": "1.0.4",
+ "resolved": "https://bnpm.byted.org/randomfill/download/randomfill-1.0.4.tgz",
+ "integrity": "sha1-ySGW/IarQr6YPxvzF3giSTHWFFg=",
+ "dev": true,
+ "requires": {
+ "randombytes": "^2.0.5",
+ "safe-buffer": "^5.1.0"
+ }
+ },
"read-pkg": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
@@ -2000,6 +2977,21 @@
"read-pkg": "^1.0.0"
}
},
+ "readable-stream": {
+ "version": "2.3.7",
+ "resolved": "https://bnpm.byted.org/readable-stream/download/readable-stream-2.3.7.tgz",
+ "integrity": "sha1-Hsoc9xGu+BTAT2IlKjamL2yyO1c=",
+ "dev": true,
+ "requires": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.3",
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~2.0.0",
+ "safe-buffer": "~5.1.1",
+ "string_decoder": "~1.1.1",
+ "util-deprecate": "~1.0.1"
+ }
+ },
"rechoir": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
@@ -2051,12 +3043,171 @@
"glob": "^7.1.3"
}
},
+ "ripemd160": {
+ "version": "2.0.2",
+ "resolved": "https://bnpm.byted.org/ripemd160/download/ripemd160-2.0.2.tgz",
+ "integrity": "sha1-ocGm9iR1FXe6XQeRTLyShQWFiQw=",
+ "dev": true,
+ "requires": {
+ "hash-base": "^3.0.0",
+ "inherits": "^2.0.1"
+ }
+ },
+ "rollup": {
+ "version": "2.33.3",
+ "resolved": "https://bnpm.byted.org/rollup/download/rollup-2.33.3.tgz",
+ "integrity": "sha1-rnLOMfmSsJpYAHKVG/6nbp3xc0I=",
+ "dev": true,
+ "requires": {
+ "fsevents": "~2.1.2"
+ }
+ },
+ "rollup-plugin-commonjs": {
+ "version": "10.1.0",
+ "resolved": "https://bnpm.byted.org/rollup-plugin-commonjs/download/rollup-plugin-commonjs-10.1.0.tgz",
+ "integrity": "sha1-QXrztUUDh44ITRJ6300cr4vrhvs=",
+ "dev": true,
+ "requires": {
+ "estree-walker": "^0.6.1",
+ "is-reference": "^1.1.2",
+ "magic-string": "^0.25.2",
+ "resolve": "^1.11.0",
+ "rollup-pluginutils": "^2.8.1"
+ },
+ "dependencies": {
+ "resolve": {
+ "version": "1.19.0",
+ "resolved": "https://bnpm.byted.org/resolve/download/resolve-1.19.0.tgz",
+ "integrity": "sha1-GvW/YwQJc0oGfK4pMYqsf6KaJnw=",
+ "dev": true,
+ "requires": {
+ "is-core-module": "^2.1.0",
+ "path-parse": "^1.0.6"
+ }
+ }
+ }
+ },
+ "rollup-plugin-json": {
+ "version": "4.0.0",
+ "resolved": "https://bnpm.byted.org/rollup-plugin-json/download/rollup-plugin-json-4.0.0.tgz",
+ "integrity": "sha1-oY2gpLML9coe523bFCKvu4SuK54=",
+ "dev": true,
+ "requires": {
+ "rollup-pluginutils": "^2.5.0"
+ }
+ },
+ "rollup-plugin-node-builtins": {
+ "version": "2.1.2",
+ "resolved": "https://bnpm.byted.org/rollup-plugin-node-builtins/download/rollup-plugin-node-builtins-2.1.2.tgz",
+ "integrity": "sha1-JKH+1KQyV7a2Q3HYq8bOGrFFl+k=",
+ "dev": true,
+ "requires": {
+ "browserify-fs": "^1.0.0",
+ "buffer-es6": "^4.9.2",
+ "crypto-browserify": "^3.11.0",
+ "process-es6": "^0.11.2"
+ }
+ },
+ "rollup-plugin-node-resolve": {
+ "version": "5.2.0",
+ "resolved": "https://bnpm.byted.org/rollup-plugin-node-resolve/download/rollup-plugin-node-resolve-5.2.0.tgz",
+ "integrity": "sha1-cw+T0Q7SAkc7H7VKWZen24xthSM=",
+ "dev": true,
+ "requires": {
+ "@types/resolve": "0.0.8",
+ "builtin-modules": "^3.1.0",
+ "is-module": "^1.0.0",
+ "resolve": "^1.11.1",
+ "rollup-pluginutils": "^2.8.1"
+ },
+ "dependencies": {
+ "builtin-modules": {
+ "version": "3.1.0",
+ "resolved": "https://bnpm.byted.org/builtin-modules/download/builtin-modules-3.1.0.tgz",
+ "integrity": "sha1-qtl8FRMet2tltQ7yCOdYTNdqdIQ=",
+ "dev": true
+ },
+ "resolve": {
+ "version": "1.19.0",
+ "resolved": "https://bnpm.byted.org/resolve/download/resolve-1.19.0.tgz",
+ "integrity": "sha1-GvW/YwQJc0oGfK4pMYqsf6KaJnw=",
+ "dev": true,
+ "requires": {
+ "is-core-module": "^2.1.0",
+ "path-parse": "^1.0.6"
+ }
+ }
+ }
+ },
+ "rollup-plugin-sourcemaps": {
+ "version": "0.6.3",
+ "resolved": "https://bnpm.byted.org/rollup-plugin-sourcemaps/download/rollup-plugin-sourcemaps-0.6.3.tgz",
+ "integrity": "sha1-v5ORP/4FbkFEGWB/HQJ4DX7OhO0=",
+ "dev": true,
+ "requires": {
+ "@rollup/pluginutils": "^3.0.9",
+ "source-map-resolve": "^0.6.0"
+ }
+ },
+ "rollup-plugin-typescript2": {
+ "version": "0.29.0",
+ "resolved": "https://bnpm.byted.org/rollup-plugin-typescript2/download/rollup-plugin-typescript2-0.29.0.tgz",
+ "integrity": "sha1-t62D9SQdvFvfHpjZw/ygBf/jnho=",
+ "dev": true,
+ "requires": {
+ "@rollup/pluginutils": "^3.1.0",
+ "find-cache-dir": "^3.3.1",
+ "fs-extra": "8.1.0",
+ "resolve": "1.17.0",
+ "tslib": "2.0.1"
+ },
+ "dependencies": {
+ "resolve": {
+ "version": "1.17.0",
+ "resolved": "https://bnpm.byted.org/resolve/download/resolve-1.17.0.tgz",
+ "integrity": "sha1-sllBtUloIxzC0bt2p5y38sC/hEQ=",
+ "dev": true,
+ "requires": {
+ "path-parse": "^1.0.6"
+ }
+ },
+ "tslib": {
+ "version": "2.0.1",
+ "resolved": "https://bnpm.byted.org/tslib/download/tslib-2.0.1.tgz",
+ "integrity": "sha1-QQ6w0RPltjVkkO7HSWA3JbAhtD4=",
+ "dev": true
+ }
+ }
+ },
+ "rollup-pluginutils": {
+ "version": "2.8.2",
+ "resolved": "https://bnpm.byted.org/rollup-pluginutils/download/rollup-pluginutils-2.8.2.tgz",
+ "integrity": "sha1-cvKvB0i1kjZNvTOJ5gDlqURKNR4=",
+ "dev": true,
+ "requires": {
+ "estree-walker": "^0.6.1"
+ },
+ "dependencies": {
+ "estree-walker": {
+ "version": "0.6.1",
+ "resolved": "https://bnpm.byted.org/estree-walker/download/estree-walker-0.6.1.tgz",
+ "integrity": "sha1-UwSRQ/QMbrkYsjZx0f4yGfOhs2I=",
+ "dev": true
+ }
+ }
+ },
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true
},
+ "safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://bnpm.byted.org/safer-buffer/download/safer-buffer-2.1.2.tgz",
+ "integrity": "sha1-RPoWGwGHuVSd2Eu5GAL5vYOFzWo=",
+ "dev": true
+ },
"semver": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz",
@@ -2069,6 +3220,16 @@
"integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
"dev": true
},
+ "sha.js": {
+ "version": "2.4.11",
+ "resolved": "https://bnpm.byted.org/sha.js/download/sha.js-2.4.11.tgz",
+ "integrity": "sha1-N6XPC4HsvGlD3hCbopYNGyZYSuc=",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.1",
+ "safe-buffer": "^5.0.1"
+ }
+ },
"shebang-command": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
@@ -2113,6 +3274,16 @@
"integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=",
"dev": true
},
+ "source-map-resolve": {
+ "version": "0.6.0",
+ "resolved": "https://bnpm.byted.org/source-map-resolve/download/source-map-resolve-0.6.0.tgz",
+ "integrity": "sha1-PZ34fiNrU/FtAeWBUPx3EROOXtI=",
+ "dev": true,
+ "requires": {
+ "atob": "^2.1.2",
+ "decode-uri-component": "^0.2.0"
+ }
+ },
"source-map-support": {
"version": "0.5.6",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.6.tgz",
@@ -2131,6 +3302,12 @@
}
}
},
+ "sourcemap-codec": {
+ "version": "1.4.8",
+ "resolved": "https://bnpm.byted.org/sourcemap-codec/download/sourcemap-codec-1.4.8.tgz",
+ "integrity": "sha1-6oBL2UhXQC5pktBaOO8a41qatMQ=",
+ "dev": true
+ },
"spawn-wrap": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-2.0.0.tgz",
@@ -2212,6 +3389,12 @@
"stubs": "^3.0.0"
}
},
+ "string-range": {
+ "version": "1.2.2",
+ "resolved": "https://bnpm.byted.org/string-range/download/string-range-1.2.2.tgz",
+ "integrity": "sha1-qJPtNH5yKZvIO++78qaSqNI51d0=",
+ "dev": true
+ },
"string-width": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz",
@@ -2223,6 +3406,15 @@
"strip-ansi": "^3.0.0"
}
},
+ "string_decoder": {
+ "version": "1.1.1",
+ "resolved": "https://bnpm.byted.org/string_decoder/download/string_decoder-1.1.1.tgz",
+ "integrity": "sha1-nPFhG6YmhdcDCunkujQUnDrwP8g=",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "~5.1.0"
+ }
+ },
"strip-ansi": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz",
@@ -2404,14 +3596,17 @@
"integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==",
"dev": true
},
+ "typedarray": {
+ "version": "0.0.6",
+ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
+ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
+ "dev": true
+ },
"typedarray-to-buffer": {
- "version": "3.1.5",
- "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz",
- "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==",
- "dev": true,
- "requires": {
- "is-typedarray": "^1.0.0"
- }
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-1.0.4.tgz",
+ "integrity": "sha1-m7i6DoQfs/TPH+fCRenz+opf6Zw=",
+ "dev": true
},
"typedoc": {
"version": "0.15.2",
@@ -2509,6 +3704,12 @@
"integrity": "sha1-iS/pWWCAXoVRnxzUOJ8stMu3ZS8=",
"dev": true
},
+ "util-deprecate": {
+ "version": "1.0.2",
+ "resolved": "https://bnpm.byted.org/util-deprecate/download/util-deprecate-1.0.2.tgz",
+ "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=",
+ "dev": true
+ },
"uuid": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz",
@@ -2566,8 +3767,25 @@
"is-typedarray": "^1.0.0",
"signal-exit": "^3.0.2",
"typedarray-to-buffer": "^3.1.5"
+ },
+ "dependencies": {
+ "typedarray-to-buffer": {
+ "version": "3.1.5",
+ "resolved": "https://bnpm.byted.org/typedarray-to-buffer/download/typedarray-to-buffer-3.1.5.tgz",
+ "integrity": "sha1-qX7nqf9CaRufeD/xvFES/j/KkIA=",
+ "dev": true,
+ "requires": {
+ "is-typedarray": "^1.0.0"
+ }
+ }
}
},
+ "xtend": {
+ "version": "2.2.0",
+ "resolved": "https://bnpm.byted.org/xtend/download/xtend-2.2.0.tgz",
+ "integrity": "sha1-7vax8ZjByN6vrYsXZaBNrUoBxak=",
+ "dev": true
+ },
"y18n": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz",
diff --git a/package.json b/package.json
index 69119d5a..2137f368 100644
--- a/package.json
+++ b/package.json
@@ -5,9 +5,10 @@
"private": true,
"main": "index.js",
"scripts": {
- "prepare": "npm run buildtool && npm link antlr4ts-cli && npm run antlr4ts && npm run tsc && npm link target/src && npm run buildrts",
+ "prepare": "npm run buildtool && npm link antlr4ts-cli && npm run antlr4ts && npm run tsc && npm link target/src && npm run buildrts && npm run bundle",
"unlink": "npm unlink antlr4ts && npm unlink target/src && npm unlink antlr4ts-cli && npm run unlinkruntime && npm run unlinktool",
"unlinkruntime": "cd target/src && npm unlink",
+ "bundle": "rollup -c rollup.config.js",
"buildtool": "cd tool && npm link -force",
"unlinktool": "cd tool && npm unlink",
"clean": "npm run unlink && git clean -idx",
@@ -77,11 +78,17 @@
"mocha": "^5.2.0",
"mocha-typescript": "^1.1.14",
"nyc": "^15.0.0",
+ "rollup": "^2.33.3",
+ "rollup-plugin-commonjs": "^10.1.0",
+ "rollup-plugin-json": "^4.0.0",
+ "rollup-plugin-node-builtins": "^2.1.2",
+ "rollup-plugin-node-resolve": "^5.2.0",
+ "rollup-plugin-sourcemaps": "^0.6.3",
+ "rollup-plugin-typescript2": "^0.29.0",
"source-map-support": "^0.5.6",
"std-mocks": "^1.0.1",
"tslint": "^5.11.0",
"typedoc": "^0.15.2",
"typescript": "^4.0.5"
- },
- "dependencies": {}
+ }
}
diff --git a/rollup.config.js b/rollup.config.js
new file mode 100644
index 00000000..f33bc5ea
--- /dev/null
+++ b/rollup.config.js
@@ -0,0 +1,42 @@
+import resolve from "rollup-plugin-node-resolve";
+import commonjs from "rollup-plugin-commonjs";
+import sourceMaps from "rollup-plugin-sourcemaps";
+import typescript from "rollup-plugin-typescript2";
+import json from "rollup-plugin-json";
+import builtins from 'rollup-plugin-node-builtins';
+
+var pkg = require(`./package.json`)
+const external = Object.keys(pkg.dependencies || {})
+export default {
+ // Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
+
+ external,
+ input: `./src/index.ts`,
+ output: [
+ { file: "./target/src/index.umd.js", name: 'antlr4ts', format: "umd", sourcemap: true },
+ { file: "./target/src/index.es.js", name: 'antlr4ts', format: "es", sourcemap: true },
+ { file: "./target/src/index.cjs.js", name: 'antlr4ts', format: "cjs", sourcemap: true },
+ ],
+ plugins: [
+ // Allow json resolution
+ json(),
+ // Compile TypeScript files
+ typescript(),
+ // Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
+ commonjs(),
+ // Allow node_modules resolution, so you can use 'external' to control
+ // which external modules to include in the bundle
+ // https://github.com/rollup/rollup-plugin-node-resolve#usage
+ resolve({
+ preferBuiltins: true,
+ mainFields: ['browser']
+ }),
+
+ // Resolve source maps to the original source
+ sourceMaps(),
+ builtins(),
+ ],
+ watch: {
+ include: "src/**",
+ },
+};
diff --git a/src/ANTLRInputStream.ts b/src/ANTLRInputStream.ts
index 751483bc..b057ca1a 100644
--- a/src/ANTLRInputStream.ts
+++ b/src/ANTLRInputStream.ts
@@ -4,7 +4,7 @@
*/
// ConvertTo-TS run at 2016-10-04T11:26:49.0828748-07:00
-import * as assert from "assert";
+import assert from "assert";
import { CharStream } from "./CharStream";
import { Arrays } from "./misc/Arrays";
import { Override } from "./Decorators";
diff --git a/src/BufferedTokenStream.ts b/src/BufferedTokenStream.ts
index 7773e43c..bfdeeeca 100644
--- a/src/BufferedTokenStream.ts
+++ b/src/BufferedTokenStream.ts
@@ -5,7 +5,7 @@
// ConvertTo-TS run at 2016-10-04T11:26:49.6074365-07:00
-import * as assert from "assert";
+import assert from "assert";
import { CommonToken } from "./CommonToken";
import { Interval } from "./misc/Interval";
import { Lexer } from "./Lexer";
diff --git a/src/CodePointBuffer.ts b/src/CodePointBuffer.ts
index ab2afc16..d619ae3c 100644
--- a/src/CodePointBuffer.ts
+++ b/src/CodePointBuffer.ts
@@ -3,7 +3,7 @@
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
-import * as assert from "assert";
+import assert from "assert";
import * as Character from "./misc/Character";
/**
diff --git a/src/CodePointCharStream.ts b/src/CodePointCharStream.ts
index 6c357798..3aa6b244 100644
--- a/src/CodePointCharStream.ts
+++ b/src/CodePointCharStream.ts
@@ -3,7 +3,7 @@
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
-import * as assert from "assert";
+import assert from "assert";
import { CharStream } from "./CharStream";
import { CodePointBuffer } from "./CodePointBuffer";
import { IntStream } from "./IntStream";
diff --git a/src/FailedPredicateException.ts b/src/FailedPredicateException.ts
index 2d482894..39ede802 100644
--- a/src/FailedPredicateException.ts
+++ b/src/FailedPredicateException.ts
@@ -32,6 +32,8 @@ export class FailedPredicateException extends RecognitionException {
recognizer.inputStream,
recognizer.context,
FailedPredicateException.formatMessage(predicate, message));
+ Object.setPrototypeOf(this, FailedPredicateException.prototype);
+
let s: ATNState = recognizer.interpreter.atn.states[recognizer.state];
let trans = s.transition(0) as AbstractPredicateTransition;
diff --git a/src/InputMismatchException.ts b/src/InputMismatchException.ts
index 7c04d410..ef136b5c 100644
--- a/src/InputMismatchException.ts
+++ b/src/InputMismatchException.ts
@@ -24,6 +24,7 @@ export class InputMismatchException extends RecognitionException {
}
super(recognizer, recognizer.inputStream, context);
+ Object.setPrototypeOf(this, InputMismatchException.prototype);
if (state !== undefined) {
this.setOffendingState(state);
diff --git a/src/LexerNoViableAltException.ts b/src/LexerNoViableAltException.ts
index 738e681f..8620605b 100644
--- a/src/LexerNoViableAltException.ts
+++ b/src/LexerNoViableAltException.ts
@@ -28,6 +28,8 @@ export class LexerNoViableAltException extends RecognitionException {
startIndex: number,
deadEndConfigs: ATNConfigSet | undefined) {
super(lexer, input);
+ Object.setPrototypeOf(this, LexerNoViableAltException.prototype);
+
this._startIndex = startIndex;
this._deadEndConfigs = deadEndConfigs;
}
@@ -42,7 +44,7 @@ export class LexerNoViableAltException extends RecognitionException {
@Override
get inputStream(): CharStream {
- return super.inputStream as CharStream;
+ return this.input as CharStream;
}
@Override
diff --git a/src/NoViableAltException.ts b/src/NoViableAltException.ts
index 5fcb7b99..1f3c6eac 100644
--- a/src/NoViableAltException.ts
+++ b/src/NoViableAltException.ts
@@ -74,6 +74,8 @@ export class NoViableAltException extends RecognitionException {
}
super(recognizer, input, ctx);
+ Object.setPrototypeOf(this, NoViableAltException.prototype);
+
this._deadEndConfigs = deadEndConfigs;
this._startToken = startToken as Token;
this.setOffendingToken(recognizer, offendingToken);
diff --git a/src/Parser.ts b/src/Parser.ts
index fdf8dea8..d6121333 100644
--- a/src/Parser.ts
+++ b/src/Parser.ts
@@ -24,6 +24,7 @@ import { IntStream } from "./IntStream";
import { Lexer } from "./Lexer";
import { Override, NotNull, Nullable } from "./Decorators";
import { ParseInfo } from "./atn/ParseInfo";
+import { ProfilingATNSimulator } from "./atn/ProfilingATNSimulator";
import { ParserATNSimulator } from "./atn/ParserATNSimulator";
import { ParserErrorListener } from "./ParserErrorListener";
import { ParserRuleContext } from "./ParserRuleContext";
@@ -39,6 +40,7 @@ import { Token } from "./Token";
import { TokenFactory } from "./TokenFactory";
import { TokenSource } from "./TokenSource";
import { TokenStream } from "./TokenStream";
+import { ParseTreePatternMatcher } from "./tree/pattern/ParseTreePatternMatcher";
class TraceListener implements ParseTreeListener {
constructor(private ruleNames: string[], private tokenStream: TokenStream) {
@@ -446,8 +448,7 @@ export abstract class Parser extends Recognizer {
}
let currentLexer = lexer;
- let m = await import("./tree/pattern/ParseTreePatternMatcher");
- let matcher = new m.ParseTreePatternMatcher(currentLexer, this);
+ let matcher = new ParseTreePatternMatcher(currentLexer, this);
return matcher.compile(pattern, patternRuleIndex);
}
@@ -755,7 +756,7 @@ export abstract class Parser extends Recognizer {
* the ATN, otherwise `false`.
*/
public isExpectedToken(symbol: number): boolean {
-// return interpreter.atn.nextTokens(_ctx);
+ // return interpreter.atn.nextTokens(_ctx);
let atn: ATN = this.interpreter.atn;
let ctx: ParserRuleContext = this._ctx;
let s: ATNState = atn.states[this.state];
@@ -763,7 +764,7 @@ export abstract class Parser extends Recognizer {
if (following.contains(symbol)) {
return true;
}
-// System.out.println("following "+s+"="+following);
+ // System.out.println("following "+s+"="+following);
if (!following.contains(Token.EPSILON)) {
return false;
}
@@ -875,13 +876,12 @@ export abstract class Parser extends Recognizer {
@Override
get parseInfo(): Promise {
- return import("./atn/ProfilingATNSimulator").then((m) => {
+ return new Promise((resolve, reject) => {
let interp: ParserATNSimulator = this.interpreter;
- if (interp instanceof m.ProfilingATNSimulator) {
- return new ParseInfo(interp);
+ if (interp instanceof ProfilingATNSimulator) {
+ resolve(new ParseInfo(interp));
}
-
- return undefined;
+ resolve();
});
}
@@ -889,13 +889,12 @@ export abstract class Parser extends Recognizer {
* @since 4.3
*/
public async setProfile(profile: boolean): Promise {
- let m = await import("./atn/ProfilingATNSimulator");
let interp: ParserATNSimulator = this.interpreter;
if (profile) {
- if (!(interp instanceof m.ProfilingATNSimulator)) {
- this.interpreter = new m.ProfilingATNSimulator(this);
+ if (!(interp instanceof ProfilingATNSimulator)) {
+ this.interpreter = new ProfilingATNSimulator(this);
}
- } else if (interp instanceof m.ProfilingATNSimulator) {
+ } else if (interp instanceof ProfilingATNSimulator) {
this.interpreter = new ParserATNSimulator(this.atn, this);
}
diff --git a/src/ParserInterpreter.ts b/src/ParserInterpreter.ts
index c22aff17..76ca9c50 100644
--- a/src/ParserInterpreter.ts
+++ b/src/ParserInterpreter.ts
@@ -5,6 +5,8 @@
// ConvertTo-TS run at 2016-10-04T11:26:53.1043451-07:00
+import { Parser } from "./Parser";
+import { ParserATNSimulator } from "./atn/ParserATNSimulator";
import { ActionTransition } from "./atn/ActionTransition";
import { ATN } from "./atn/ATN";
import { ATNState } from "./atn/ATNState";
@@ -18,8 +20,6 @@ import { InterpreterRuleContext } from "./InterpreterRuleContext";
import { LoopEndState } from "./atn/LoopEndState";
import { NotNull } from "./Decorators";
import { Override } from "./Decorators";
-import { Parser } from "./Parser";
-import { ParserATNSimulator } from "./atn/ParserATNSimulator";
import { ParserRuleContext } from "./ParserRuleContext";
import { PrecedencePredicateTransition } from "./atn/PrecedencePredicateTransition";
import { PredicateTransition } from "./atn/PredicateTransition";
diff --git a/src/ParserRuleContext.ts b/src/ParserRuleContext.ts
index ec2826eb..29ef6a53 100644
--- a/src/ParserRuleContext.ts
+++ b/src/ParserRuleContext.ts
@@ -66,7 +66,7 @@ export class ParserRuleContext extends RuleContext {
*
* This does not trace states visited during prediction.
*/
-// public Array states;
+ // public Array states;
public _start: Token;
public _stop: Token | undefined;
@@ -214,10 +214,10 @@ export class ParserRuleContext extends RuleContext {
}
}
-// public void trace(int s) {
-// if ( states==null ) states = new ArrayList();
-// states.add(s);
-// }
+ // public void trace(int s) {
+ // if ( states==null ) states = new ArrayList();
+ // states.add(s);
+ // }
/** Used by enterOuterAlt to toss out a RuleContext previously added as
* we entered a rule. If we have # label, we will need to remove
@@ -232,7 +232,7 @@ export class ParserRuleContext extends RuleContext {
@Override
/** Override to make type more specific */
get parent(): ParserRuleContext | undefined {
- let parent = super.parent;
+ let parent = this._parent;
if (parent === undefined || parent instanceof ParserRuleContext) {
return parent;
}
@@ -241,9 +241,9 @@ export class ParserRuleContext extends RuleContext {
}
public getChild(i: number): ParseTree;
- public getChild(i: number, ctxType: { new (...args: any[]): T; }): T;
+ public getChild(i: number, ctxType: { new(...args: any[]): T; }): T;
// Note: in TypeScript, order or arguments reversed
- public getChild(i: number, ctxType?: { new (...args: any[]): T; }): ParseTree {
+ public getChild(i: number, ctxType?: { new(...args: any[]): T; }): ParseTree {
if (!this.children || i < 0 || i >= this.children.length) {
throw new RangeError("index parameter must be between >= 0 and <= number of children.");
}
@@ -260,7 +260,7 @@ export class ParserRuleContext extends RuleContext {
return result;
}
- public tryGetChild(i: number, ctxType: { new (...args: any[]): T; }): T | undefined {
+ public tryGetChild(i: number, ctxType: { new(...args: any[]): T; }): T | undefined {
if (!this.children || i < 0 || i >= this.children.length) {
return undefined;
}
@@ -332,15 +332,15 @@ export class ParserRuleContext extends RuleContext {
}
// NOTE: argument order change from Java version
- public getRuleContext(i: number, ctxType: { new (...args: any[]): T; }): T {
+ public getRuleContext(i: number, ctxType: { new(...args: any[]): T; }): T {
return this.getChild(i, ctxType);
}
- public tryGetRuleContext(i: number, ctxType: { new (...args: any[]): T; }): T | undefined {
+ public tryGetRuleContext(i: number, ctxType: { new(...args: any[]): T; }): T | undefined {
return this.tryGetChild(i, ctxType);
}
- public getRuleContexts(ctxType: { new (...args: any[]): T; }): T[] {
+ public getRuleContexts(ctxType: { new(...args: any[]): T; }): T[] {
let contexts: T[] = [];
if (!this.children) {
return contexts;
diff --git a/src/RecognitionException.ts b/src/RecognitionException.ts
index 3ee4e649..e70160f7 100644
--- a/src/RecognitionException.ts
+++ b/src/RecognitionException.ts
@@ -29,7 +29,7 @@ export class RecognitionException extends Error {
private ctx?: RuleContext;
- private input?: IntStream;
+ protected input?: IntStream;
/**
* The current {@link Token} when an error occurred. Since not all streams
@@ -68,6 +68,8 @@ export class RecognitionException extends Error {
if (recognizer) {
this._offendingState = recognizer.state;
}
+ // see https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
+ Object.setPrototypeOf(this, RecognitionException.prototype);
}
/**
diff --git a/src/RuleContext.ts b/src/RuleContext.ts
index 9a333d0e..8513dbdf 100644
--- a/src/RuleContext.ts
+++ b/src/RuleContext.ts
@@ -5,7 +5,7 @@
// ConvertTo-TS run at 2016-10-04T11:26:57.3490837-07:00
-import { ATN } from "./atn/ATN";
+import { INVALID_ALT_NUMBER } from "./atn/Constant";
import { Parser } from "./Parser";
import { Recognizer } from "./Recognizer";
import { RuleNode } from "./tree/RuleNode";
@@ -153,7 +153,7 @@ export class RuleContext extends RuleNode {
*
* @since 4.5.3
*/
- get altNumber(): number { return ATN.INVALID_ALT_NUMBER; }
+ get altNumber(): number { return INVALID_ALT_NUMBER; }
/** Set the outer alternative number for this context node. Default
* implementation does nothing to avoid backing field overhead for
diff --git a/src/RuleContextWithAltNum.ts b/src/RuleContextWithAltNum.ts
index 9732d835..0867f9e8 100644
--- a/src/RuleContextWithAltNum.ts
+++ b/src/RuleContextWithAltNum.ts
@@ -5,7 +5,7 @@
// ConvertTo-TS run at 2016-10-04T11:26:57.4741196-07:00
-import { ATN } from "./atn/ATN";
+import { INVALID_ALT_NUMBER } from "./atn/Constant";
import { Override } from "./Decorators";
import { ParserRuleContext } from "./ParserRuleContext";
@@ -31,7 +31,7 @@ export class RuleContextWithAltNum extends ParserRuleContext {
super();
}
- this._altNumber = ATN.INVALID_ALT_NUMBER;
+ this._altNumber = INVALID_ALT_NUMBER;
}
@Override
diff --git a/src/atn/ATN.ts b/src/atn/ATN.ts
index a278866a..c88d4c8c 100644
--- a/src/atn/ATN.ts
+++ b/src/atn/ATN.ts
@@ -24,7 +24,7 @@ import { RuleTransition } from "./RuleTransition";
import { Token } from "../Token";
import { TokensStartState } from "./TokensStartState";
-import * as assert from "assert";
+import assert from "assert";
/** */
export class ATN {
@@ -263,8 +263,4 @@ export class ATN {
return expected;
}
-}
-
-export namespace ATN {
- export const INVALID_ALT_NUMBER: number = 0;
-}
+}
\ No newline at end of file
diff --git a/src/atn/ATNConfig.ts b/src/atn/ATNConfig.ts
index 4532f7ff..5fb1e444 100644
--- a/src/atn/ATNConfig.ts
+++ b/src/atn/ATNConfig.ts
@@ -14,11 +14,11 @@ import { MurmurHash } from "../misc/MurmurHash";
import { NotNull, Override } from "../Decorators";
import { ObjectEqualityComparator } from "../misc/ObjectEqualityComparator";
import { PredictionContext } from "./PredictionContext";
-import { PredictionContextCache } from "./PredictionContextCache";
+import { PredictionContextCache } from "./PredictionContext";
import { Recognizer } from "../Recognizer";
import { SemanticContext } from "./SemanticContext";
-import * as assert from "assert";
+import assert from "assert";
/**
* This field stores the bit mask for implementing the
diff --git a/src/atn/ATNConfigSet.ts b/src/atn/ATNConfigSet.ts
index 3a43ab17..685ee656 100644
--- a/src/atn/ATNConfigSet.ts
+++ b/src/atn/ATNConfigSet.ts
@@ -8,7 +8,7 @@
import { Array2DHashMap } from "../misc/Array2DHashMap";
import { Array2DHashSet } from "../misc/Array2DHashSet";
import { ArrayEqualityComparator } from "../misc/ArrayEqualityComparator";
-import { ATN } from "./ATN";
+import { INVALID_ALT_NUMBER } from "./Constant";
import { ATNConfig } from "./ATNConfig";
import { ATNSimulator } from "./ATNSimulator";
import { ATNState } from "./ATNState";
@@ -19,10 +19,10 @@ import { JavaSet } from "../misc/Stubs";
import { NotNull, Override } from "../Decorators";
import { ObjectEqualityComparator } from "../misc/ObjectEqualityComparator";
import { PredictionContext } from "./PredictionContext";
-import { PredictionContextCache } from "./PredictionContextCache";
+import { PredictionContextCache } from "./PredictionContext";
import { SemanticContext } from "./SemanticContext";
-import * as assert from "assert";
+import assert from "assert";
import * as Utils from "../misc/Utils";
interface KeyType { state: number; alt: number; }
@@ -114,7 +114,7 @@ export class ATNConfigSet implements JavaSet {
this.unmerged = [];
this.configs = [];
- this._uniqueAlt = ATN.INVALID_ALT_NUMBER;
+ this._uniqueAlt = INVALID_ALT_NUMBER;
} else {
if (readonly) {
@@ -336,7 +336,7 @@ export class ATNConfigSet implements JavaSet {
if (this.configs.length === 1) {
this._uniqueAlt = config.alt;
} else if (this._uniqueAlt !== config.alt) {
- this._uniqueAlt = ATN.INVALID_ALT_NUMBER;
+ this._uniqueAlt = INVALID_ALT_NUMBER;
}
this._hasSemanticContext = this._hasSemanticContext || !SemanticContext.NONE.equals(config.semanticContext);
@@ -403,7 +403,7 @@ export class ATNConfigSet implements JavaSet {
this._dipsIntoOuterContext = false;
this._hasSemanticContext = false;
- this._uniqueAlt = ATN.INVALID_ALT_NUMBER;
+ this._uniqueAlt = INVALID_ALT_NUMBER;
this._conflictInfo = undefined;
}
@@ -472,7 +472,7 @@ export class ATNConfigSet implements JavaSet {
if (this._hasSemanticContext) {
buf += (",hasSemanticContext=") + (this._hasSemanticContext);
}
- if (this._uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
+ if (this._uniqueAlt !== INVALID_ALT_NUMBER) {
buf += (",uniqueAlt=") + (this._uniqueAlt);
}
if (this._conflictInfo != null) {
diff --git a/src/atn/Constant.ts b/src/atn/Constant.ts
new file mode 100644
index 00000000..1eb9e20e
--- /dev/null
+++ b/src/atn/Constant.ts
@@ -0,0 +1 @@
+export const INVALID_ALT_NUMBER: number = 0;
diff --git a/src/atn/LexerATNSimulator.ts b/src/atn/LexerATNSimulator.ts
index 09b654d4..812539d3 100644
--- a/src/atn/LexerATNSimulator.ts
+++ b/src/atn/LexerATNSimulator.ts
@@ -8,6 +8,7 @@
import { AcceptStateInfo } from "../dfa/AcceptStateInfo";
import { ActionTransition } from "./ActionTransition";
import { ATN } from "./ATN";
+import { INVALID_ALT_NUMBER } from "./Constant";
import { ATNConfig } from "./ATNConfig";
import { ATNConfigSet } from "./ATNConfigSet";
import { ATNSimulator } from "./ATNSimulator";
@@ -29,7 +30,7 @@ import { RuleTransition } from "./RuleTransition";
import { Token } from "../Token";
import { Transition } from "./Transition";
import { TransitionType } from "./TransitionType";
-import * as assert from "assert";
+import assert from "assert";
/** "dup" of ParserInterpreter */
export class LexerATNSimulator extends ATNSimulator {
@@ -285,7 +286,7 @@ export class LexerATNSimulator extends ATNSimulator {
protected getReachableConfigSet(@NotNull input: CharStream, @NotNull closure: ATNConfigSet, @NotNull reach: ATNConfigSet, t: number): void {
// this is used to skip processing for configs which have a lower priority
// than a config that already reached an accept state for the same rule
- let skipAlt: number = ATN.INVALID_ALT_NUMBER;
+ let skipAlt: number = INVALID_ALT_NUMBER;
for (let c of closure) {
let currentAltReachedAcceptState: boolean = c.alt === skipAlt;
if (currentAltReachedAcceptState && c.hasPassedThroughNonGreedyDecision) {
diff --git a/src/atn/ParserATNSimulator.ts b/src/atn/ParserATNSimulator.ts
index f06c379a..5d537834 100644
--- a/src/atn/ParserATNSimulator.ts
+++ b/src/atn/ParserATNSimulator.ts
@@ -5,11 +5,13 @@
// ConvertTo-TS run at 2016-10-04T11:26:31.1989835-07:00
+import { Parser } from "../Parser";
import { AcceptStateInfo } from "../dfa/AcceptStateInfo";
import { ActionTransition } from "./ActionTransition";
import { Array2DHashSet } from "../misc/Array2DHashSet";
import { Arrays } from "../misc/Arrays";
import { ATN } from "./ATN";
+import { INVALID_ALT_NUMBER } from "./Constant";
import { ATNConfig } from "./ATNConfig";
import { ATNConfigSet } from "./ATNConfigSet";
import { ATNSimulator } from "./ATNSimulator";
@@ -29,12 +31,11 @@ import { NotNull, Nullable, Override } from "../Decorators";
import { NotSetTransition } from "./NotSetTransition";
import { NoViableAltException } from "../NoViableAltException";
import { ObjectEqualityComparator } from "../misc/ObjectEqualityComparator";
-import { Parser } from "../Parser";
import { ParserRuleContext } from "../ParserRuleContext";
import { PrecedencePredicateTransition } from "./PrecedencePredicateTransition";
import { PredicateTransition } from "./PredicateTransition";
import { PredictionContext } from "./PredictionContext";
-import { PredictionContextCache } from "./PredictionContextCache";
+import { PredictionContextCache } from "./PredictionContext";
import { PredictionMode } from "./PredictionMode";
import { RuleContext } from "../RuleContext";
import { RuleStopState } from "./RuleStopState";
@@ -50,7 +51,7 @@ import { TransitionType } from "./TransitionType";
import { Vocabulary } from "../Vocabulary";
import { VocabularyImpl } from "../VocabularyImpl";
-import * as assert from "assert";
+import assert from "assert";
const MAX_SHORT_VALUE = 0xFFFF;
const MIN_INTEGER_VALUE = -((1 << 31) >>> 0);
@@ -557,10 +558,10 @@ export class ParserATNSimulator extends ATNSimulator {
t = input.LA(1);
}
}
-// if ( acceptState==null ) {
-// if ( debug ) System.out.println("!!! no viable alt in dfa");
-// return -1;
-// }
+ // if ( acceptState==null ) {
+ // if ( debug ) System.out.println("!!! no viable alt in dfa");
+ // return -1;
+ // }
if (!state.useContext && s.configs.conflictInfo != null) {
if (dfa.atnStartState instanceof DecisionState) {
@@ -620,21 +621,21 @@ export class ParserATNSimulator extends ATNSimulator {
let alts: BitSet = this.evalSemanticContext(predicates, outerContext, this.reportAmbiguities && this.predictionMode === PredictionMode.LL_EXACT_AMBIG_DETECTION);
switch (alts.cardinality()) {
- case 0:
- throw this.noViableAlt(input, outerContext, s.configs, startIndex);
+ case 0:
+ throw this.noViableAlt(input, outerContext, s.configs, startIndex);
- case 1:
- return alts.nextSetBit(0);
+ case 1:
+ return alts.nextSetBit(0);
- default:
- // report ambiguity after predicate evaluation to make sure the correct
- // set of ambig alts is reported.
- if (startIndex !== stopIndex) {
- input.seek(stopIndex);
- }
+ default:
+ // report ambiguity after predicate evaluation to make sure the correct
+ // set of ambig alts is reported.
+ if (startIndex !== stopIndex) {
+ input.seek(stopIndex);
+ }
- this.reportAmbiguity(dfa, s, startIndex, stopIndex, s.configs.isExactConflict, alts, s.configs);
- return alts.nextSetBit(0);
+ this.reportAmbiguity(dfa, s, startIndex, stopIndex, s.configs.isExactConflict, alts, s.configs);
+ return alts.nextSetBit(0);
}
}
@@ -754,14 +755,14 @@ export class ParserATNSimulator extends ATNSimulator {
let D: DFAState = nextState.s0;
// predicted alt => accept state
- assert(D.isAcceptState || D.prediction === ATN.INVALID_ALT_NUMBER);
+ assert(D.isAcceptState || D.prediction === INVALID_ALT_NUMBER);
// conflicted => accept state
assert(D.isAcceptState || D.configs.conflictInfo == null);
if (this.isAcceptState(D, useContext)) {
let conflictingAlts: BitSet | undefined = D.configs.conflictingAlts;
- let predictedAlt: number = conflictingAlts == null ? D.prediction : ATN.INVALID_ALT_NUMBER;
- if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
+ let predictedAlt: number = conflictingAlts == null ? D.prediction : INVALID_ALT_NUMBER;
+ if (predictedAlt !== INVALID_ALT_NUMBER) {
if (this.optimize_ll1
&& input.index === startIndex
&& !dfa.isPrecedenceDfa
@@ -780,8 +781,8 @@ export class ParserATNSimulator extends ATNSimulator {
}
predictedAlt = D.prediction;
-// int k = input.index - startIndex + 1; // how much input we used
-// System.out.println("used k="+k);
+ // int k = input.index - startIndex + 1; // how much input we used
+ // System.out.println("used k="+k);
let attemptFullContext: boolean = conflictingAlts != null && this.userWantsCtxSensitive;
if (attemptFullContext) {
// Only exact conflicts are known to be ambiguous when local
@@ -802,14 +803,14 @@ export class ParserATNSimulator extends ATNSimulator {
// use complete evaluation here if we'll want to retry with full context if still ambiguous
conflictingAlts = this.evalSemanticContext(predPredictions, outerContext, attemptFullContext || this.reportAmbiguities);
switch (conflictingAlts.cardinality()) {
- case 0:
- throw this.noViableAlt(input, outerContext, D.configs, startIndex);
+ case 0:
+ throw this.noViableAlt(input, outerContext, D.configs, startIndex);
- case 1:
- return conflictingAlts.nextSetBit(0);
+ case 1:
+ return conflictingAlts.nextSetBit(0);
- default:
- break;
+ default:
+ break;
}
if (conflictIndex !== startIndex) {
@@ -920,57 +921,57 @@ export class ParserATNSimulator extends ATNSimulator {
}
switch (alts.cardinality()) {
- case 0:
- break;
-
- case 1:
- return alts.nextSetBit(0);
+ case 0:
+ break;
- default:
- if (!previous.s0.configs.hasSemanticContext) {
- // configs doesn't contain any predicates, so the predicate
- // filtering code below would be pointless
+ case 1:
return alts.nextSetBit(0);
- }
- /*
- * Try to find a configuration set that not only dipped into the outer
- * context, but also isn't eliminated by a predicate.
- */
- let filteredConfigs: ATNConfigSet = new ATNConfigSet();
- for (let config of previous.s0.configs) {
- if (config.reachesIntoOuterContext || config.state instanceof RuleStopState) {
- filteredConfigs.add(config);
+ default:
+ if (!previous.s0.configs.hasSemanticContext) {
+ // configs doesn't contain any predicates, so the predicate
+ // filtering code below would be pointless
+ return alts.nextSetBit(0);
}
- }
- /* The following code blocks are adapted from predicateDFAState with
- * the following key changes.
- *
- * 1. The code operates on an ATNConfigSet rather than a DFAState.
- * 2. Predicates are collected for all alternatives represented in
- * filteredConfigs, rather than restricting the evaluation to
- * conflicting and/or unique configurations.
- */
- let altToPred: SemanticContext[] | undefined = this.getPredsForAmbigAlts(alts, filteredConfigs, maxAlt);
- if (altToPred != null) {
- let predicates: DFAState.PredPrediction[] | undefined = this.getPredicatePredictions(alts, altToPred);
- if (predicates != null) {
- let stopIndex: number = input.index;
- try {
- input.seek(startIndex);
- let filteredAlts: BitSet = this.evalSemanticContext(predicates, previous.outerContext, false);
- if (!filteredAlts.isEmpty) {
- return filteredAlts.nextSetBit(0);
- }
+ /*
+ * Try to find a configuration set that not only dipped into the outer
+ * context, but also isn't eliminated by a predicate.
+ */
+ let filteredConfigs: ATNConfigSet = new ATNConfigSet();
+ for (let config of previous.s0.configs) {
+ if (config.reachesIntoOuterContext || config.state instanceof RuleStopState) {
+ filteredConfigs.add(config);
}
- finally {
- input.seek(stopIndex);
+ }
+
+ /* The following code blocks are adapted from predicateDFAState with
+ * the following key changes.
+ *
+ * 1. The code operates on an ATNConfigSet rather than a DFAState.
+ * 2. Predicates are collected for all alternatives represented in
+ * filteredConfigs, rather than restricting the evaluation to
+ * conflicting and/or unique configurations.
+ */
+ let altToPred: SemanticContext[] | undefined = this.getPredsForAmbigAlts(alts, filteredConfigs, maxAlt);
+ if (altToPred != null) {
+ let predicates: DFAState.PredPrediction[] | undefined = this.getPredicatePredictions(alts, altToPred);
+ if (predicates != null) {
+ let stopIndex: number = input.index;
+ try {
+ input.seek(startIndex);
+ let filteredAlts: BitSet = this.evalSemanticContext(predicates, previous.outerContext, false);
+ if (!filteredAlts.isEmpty) {
+ return filteredAlts.nextSetBit(0);
+ }
+ }
+ finally {
+ input.seek(stopIndex);
+ }
}
}
- }
- return alts.nextSetBit(0);
+ return alts.nextSetBit(0);
}
}
@@ -1115,7 +1116,7 @@ export class ParserATNSimulator extends ATNSimulator {
* condition is not true when one or more configurations have been
* withheld in skippedStopStates, or when the current symbol is EOF.
*/
- if (this.optimize_unique_closure && skippedStopStates == null && t !== Token.EOF && reachIntermediate.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
+ if (this.optimize_unique_closure && skippedStopStates == null && t !== Token.EOF && reachIntermediate.uniqueAlt !== INVALID_ALT_NUMBER) {
reachIntermediate.isOutermostConfigSet = reach.isOutermostConfigSet;
reach = reachIntermediate;
break;
@@ -1598,7 +1599,7 @@ export class ParserATNSimulator extends ATNSimulator {
return undefined;
}
-// System.out.println(Arrays.toString(altToPred)+"->"+pairs);
+ // System.out.println(Arrays.toString(altToPred)+"->"+pairs);
return pairs;
}
@@ -1879,36 +1880,36 @@ export class ParserATNSimulator extends ATNSimulator {
protected getEpsilonTarget(@NotNull config: ATNConfig, @NotNull t: Transition, collectPredicates: boolean, inContext: boolean, contextCache: PredictionContextCache, treatEofAsEpsilon: boolean): ATNConfig | undefined {
switch (t.serializationType) {
- case TransitionType.RULE:
- return this.ruleTransition(config, t as RuleTransition, contextCache);
+ case TransitionType.RULE:
+ return this.ruleTransition(config, t as RuleTransition, contextCache);
- case TransitionType.PRECEDENCE:
- return this.precedenceTransition(config, t as PrecedencePredicateTransition, collectPredicates, inContext);
+ case TransitionType.PRECEDENCE:
+ return this.precedenceTransition(config, t as PrecedencePredicateTransition, collectPredicates, inContext);
- case TransitionType.PREDICATE:
- return this.predTransition(config, t as PredicateTransition, collectPredicates, inContext);
+ case TransitionType.PREDICATE:
+ return this.predTransition(config, t as PredicateTransition, collectPredicates, inContext);
- case TransitionType.ACTION:
- return this.actionTransition(config, t as ActionTransition);
+ case TransitionType.ACTION:
+ return this.actionTransition(config, t as ActionTransition);
- case TransitionType.EPSILON:
- return config.transform(t.target, false);
+ case TransitionType.EPSILON:
+ return config.transform(t.target, false);
- case TransitionType.ATOM:
- case TransitionType.RANGE:
- case TransitionType.SET:
- // EOF transitions act like epsilon transitions after the first EOF
- // transition is traversed
- if (treatEofAsEpsilon) {
- if (t.matches(Token.EOF, 0, 1)) {
- return config.transform(t.target, false);
+ case TransitionType.ATOM:
+ case TransitionType.RANGE:
+ case TransitionType.SET:
+ // EOF transitions act like epsilon transitions after the first EOF
+ // transition is traversed
+ if (treatEofAsEpsilon) {
+ if (t.matches(Token.EOF, 0, 1)) {
+ return config.transform(t.target, false);
+ }
}
- }
- return undefined;
+ return undefined;
- default:
- return undefined;
+ default:
+ return undefined;
}
}
@@ -2022,7 +2023,7 @@ export class ParserATNSimulator extends ATNSimulator {
}
private isConflicted(@NotNull configset: ATNConfigSet, contextCache: PredictionContextCache): ConflictInfo | undefined {
- if (configset.uniqueAlt !== ATN.INVALID_ALT_NUMBER || configset.size <= 1) {
+ if (configset.uniqueAlt !== INVALID_ALT_NUMBER || configset.size <= 1) {
return undefined;
}
@@ -2179,7 +2180,7 @@ export class ParserATNSimulator extends ATNSimulator {
protected getConflictingAltsFromConfigSet(configs: ATNConfigSet): BitSet | undefined {
let conflictingAlts: BitSet | undefined = configs.conflictingAlts;
- if (conflictingAlts == null && configs.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
+ if (conflictingAlts == null && configs.uniqueAlt !== INVALID_ALT_NUMBER) {
conflictingAlts = new BitSet();
conflictingAlts.set(configs.uniqueAlt);
}
@@ -2242,13 +2243,13 @@ export class ParserATNSimulator extends ATNSimulator {
}
protected getUniqueAlt(@NotNull configs: Iterable): number {
- let alt: number = ATN.INVALID_ALT_NUMBER;
+ let alt: number = INVALID_ALT_NUMBER;
for (let c of configs) {
- if (alt === ATN.INVALID_ALT_NUMBER) {
+ if (alt === INVALID_ALT_NUMBER) {
alt = c.alt; // found first alt
}
else if (c.alt !== alt) {
- return ATN.INVALID_ALT_NUMBER;
+ return INVALID_ALT_NUMBER;
}
}
return alt;
@@ -2362,7 +2363,7 @@ export class ParserATNSimulator extends ATNSimulator {
// getDecisionState won't return undefined when we request a known valid decision
let decisionState: DecisionState = this.atn.getDecisionState(dfa.decision) as DecisionState;
let predictedAlt: number = this.getUniqueAlt(configs);
- if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
+ if (predictedAlt !== INVALID_ALT_NUMBER) {
newState.acceptStateInfo = new AcceptStateInfo(predictedAlt);
} else if (configs.conflictingAlts != null) {
let conflictingAlts = configs.conflictingAlts;
diff --git a/src/atn/PredictionContext.ts b/src/atn/PredictionContext.ts
index deed68c0..46e67f8c 100644
--- a/src/atn/PredictionContext.ts
+++ b/src/atn/PredictionContext.ts
@@ -15,12 +15,13 @@ import { EqualityComparator } from "../misc/EqualityComparator";
import { MurmurHash } from "../misc/MurmurHash";
import { NotNull, Override } from "../Decorators";
import { Equatable, JavaSet } from "../misc/Stubs";
-import { PredictionContextCache } from "./PredictionContextCache";
+import { JavaMap } from "../misc/Stubs";
+import { ObjectEqualityComparator } from "../misc/ObjectEqualityComparator";
import { Recognizer } from "../Recognizer";
import { RuleContext } from "../RuleContext";
import { RuleTransition } from "./RuleTransition";
-import * as assert from "assert";
+import assert from "assert";
const INITIAL_HASH: number = 1;
@@ -447,7 +448,7 @@ class ArrayPredictionContext extends PredictionContext {
@NotNull
public returnStates: number[];
- constructor( @NotNull parents: PredictionContext[], returnStates: number[], hashCode?: number) {
+ constructor(@NotNull parents: PredictionContext[], returnStates: number[], hashCode?: number) {
super(hashCode || PredictionContext.calculateHashCode(parents, returnStates));
assert(parents.length === returnStates.length);
assert(returnStates.length > 1 || returnStates[0] !== PredictionContext.EMPTY_FULL_STATE_KEY, "Should be using PredictionContext.EMPTY instead.");
@@ -754,3 +755,144 @@ export namespace PredictionContext {
}
}
}
+
+
+/** Used to cache {@link PredictionContext} objects. Its used for the shared
+ * context cash associated with contexts in DFA states. This cache
+ * can be used for both lexers and parsers.
+ *
+ * @author Sam Harwell
+ */
+export class PredictionContextCache {
+ public static UNCACHED: PredictionContextCache = new PredictionContextCache(false);
+
+ private contexts: JavaMap =
+ new Array2DHashMap(ObjectEqualityComparator.INSTANCE);
+ private childContexts: JavaMap =
+ new Array2DHashMap(ObjectEqualityComparator.INSTANCE);
+ private joinContexts: JavaMap =
+ new Array2DHashMap(ObjectEqualityComparator.INSTANCE);
+
+ private enableCache: boolean;
+
+ constructor(enableCache: boolean = true) {
+ this.enableCache = enableCache;
+ }
+
+ public getAsCached(context: PredictionContext): PredictionContext {
+ if (!this.enableCache) {
+ return context;
+ }
+
+ let result = this.contexts.get(context);
+ if (!result) {
+ result = context;
+ this.contexts.put(context, context);
+ }
+
+ return result;
+ }
+
+ public getChild(context: PredictionContext, invokingState: number): PredictionContext {
+ if (!this.enableCache) {
+ return context.getChild(invokingState);
+ }
+
+ let operands: PredictionContextCache.PredictionContextAndInt = new PredictionContextCache.PredictionContextAndInt(context, invokingState);
+ let result = this.childContexts.get(operands);
+ if (!result) {
+ result = context.getChild(invokingState);
+ result = this.getAsCached(result);
+ this.childContexts.put(operands, result);
+ }
+
+ return result;
+ }
+
+ public join(x: PredictionContext, y: PredictionContext): PredictionContext {
+ if (!this.enableCache) {
+ return PredictionContext.join(x, y, this);
+ }
+
+ let operands: PredictionContextCache.IdentityCommutativePredictionContextOperands = new PredictionContextCache.IdentityCommutativePredictionContextOperands(x, y);
+ let result = this.joinContexts.get(operands);
+ if (result) {
+ return result;
+ }
+
+ result = PredictionContext.join(x, y, this);
+ result = this.getAsCached(result);
+ this.joinContexts.put(operands, result);
+ return result;
+ }
+}
+
+export namespace PredictionContextCache {
+ export class PredictionContextAndInt {
+ private obj: PredictionContext;
+ private value: number;
+
+ constructor(obj: PredictionContext, value: number) {
+ this.obj = obj;
+ this.value = value;
+ }
+
+ @Override
+ public equals(obj: any): boolean {
+ if (!(obj instanceof PredictionContextAndInt)) {
+ return false;
+ } else if (obj === this) {
+ return true;
+ }
+
+ let other: PredictionContextAndInt = obj;
+ return this.value === other.value
+ && (this.obj === other.obj || (this.obj != null && this.obj.equals(other.obj)));
+ }
+
+ @Override
+ public hashCode(): number {
+ let hashCode: number = 5;
+ hashCode = 7 * hashCode + (this.obj != null ? this.obj.hashCode() : 0);
+ hashCode = 7 * hashCode + this.value;
+ return hashCode;
+ }
+ }
+
+ export class IdentityCommutativePredictionContextOperands {
+ private _x: PredictionContext;
+ private _y: PredictionContext;
+
+ constructor(x: PredictionContext, y: PredictionContext) {
+ assert(x != null);
+ assert(y != null);
+ this._x = x;
+ this._y = y;
+ }
+
+ get x(): PredictionContext {
+ return this._x;
+ }
+
+ get y(): PredictionContext {
+ return this._y;
+ }
+
+ @Override
+ public equals(o: any): boolean {
+ if (!(o instanceof IdentityCommutativePredictionContextOperands)) {
+ return false;
+ } else if (this === o) {
+ return true;
+ }
+
+ let other: IdentityCommutativePredictionContextOperands = o;
+ return (this._x === other._x && this._y === other._y) || (this._x === other._y && this._y === other._x);
+ }
+
+ @Override
+ public hashCode(): number {
+ return this._x.hashCode() ^ this._y.hashCode();
+ }
+ }
+}
diff --git a/src/atn/PredictionContextCache.ts b/src/atn/PredictionContextCache.ts
deleted file mode 100644
index 87760cd7..00000000
--- a/src/atn/PredictionContextCache.ts
+++ /dev/null
@@ -1,153 +0,0 @@
-/*!
- * Copyright 2016 The ANTLR Project. All rights reserved.
- * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
- */
-
-// ConvertTo-TS run at 2016-10-04T11:26:35.6390614-07:00
-
-import { Array2DHashMap } from "../misc/Array2DHashMap";
-import { Override } from "../Decorators";
-import { JavaMap } from "../misc/Stubs";
-import { ObjectEqualityComparator } from "../misc/ObjectEqualityComparator";
-import { PredictionContext } from "./PredictionContext";
-import * as assert from "assert";
-
-/** Used to cache {@link PredictionContext} objects. Its used for the shared
- * context cash associated with contexts in DFA states. This cache
- * can be used for both lexers and parsers.
- *
- * @author Sam Harwell
- */
-export class PredictionContextCache {
- public static UNCACHED: PredictionContextCache = new PredictionContextCache(false);
-
- private contexts: JavaMap =
- new Array2DHashMap(ObjectEqualityComparator.INSTANCE);
- private childContexts: JavaMap =
- new Array2DHashMap(ObjectEqualityComparator.INSTANCE);
- private joinContexts: JavaMap =
- new Array2DHashMap(ObjectEqualityComparator.INSTANCE);
-
- private enableCache: boolean;
-
- constructor(enableCache: boolean = true) {
- this.enableCache = enableCache;
- }
-
- public getAsCached(context: PredictionContext): PredictionContext {
- if (!this.enableCache) {
- return context;
- }
-
- let result = this.contexts.get(context);
- if (!result) {
- result = context;
- this.contexts.put(context, context);
- }
-
- return result;
- }
-
- public getChild(context: PredictionContext, invokingState: number): PredictionContext {
- if (!this.enableCache) {
- return context.getChild(invokingState);
- }
-
- let operands: PredictionContextCache.PredictionContextAndInt = new PredictionContextCache.PredictionContextAndInt(context, invokingState);
- let result = this.childContexts.get(operands);
- if (!result) {
- result = context.getChild(invokingState);
- result = this.getAsCached(result);
- this.childContexts.put(operands, result);
- }
-
- return result;
- }
-
- public join(x: PredictionContext, y: PredictionContext): PredictionContext {
- if (!this.enableCache) {
- return PredictionContext.join(x, y, this);
- }
-
- let operands: PredictionContextCache.IdentityCommutativePredictionContextOperands = new PredictionContextCache.IdentityCommutativePredictionContextOperands(x, y);
- let result = this.joinContexts.get(operands);
- if (result) {
- return result;
- }
-
- result = PredictionContext.join(x, y, this);
- result = this.getAsCached(result);
- this.joinContexts.put(operands, result);
- return result;
- }
-}
-
-export namespace PredictionContextCache {
- export class PredictionContextAndInt {
- private obj: PredictionContext;
- private value: number;
-
- constructor(obj: PredictionContext, value: number) {
- this.obj = obj;
- this.value = value;
- }
-
- @Override
- public equals(obj: any): boolean {
- if (!(obj instanceof PredictionContextAndInt)) {
- return false;
- } else if (obj === this) {
- return true;
- }
-
- let other: PredictionContextAndInt = obj;
- return this.value === other.value
- && (this.obj === other.obj || (this.obj != null && this.obj.equals(other.obj)));
- }
-
- @Override
- public hashCode(): number {
- let hashCode: number = 5;
- hashCode = 7 * hashCode + (this.obj != null ? this.obj.hashCode() : 0);
- hashCode = 7 * hashCode + this.value;
- return hashCode;
- }
- }
-
- export class IdentityCommutativePredictionContextOperands {
- private _x: PredictionContext;
- private _y: PredictionContext;
-
- constructor(x: PredictionContext, y: PredictionContext) {
- assert(x != null);
- assert(y != null);
- this._x = x;
- this._y = y;
- }
-
- get x(): PredictionContext {
- return this._x;
- }
-
- get y(): PredictionContext {
- return this._y;
- }
-
- @Override
- public equals(o: any): boolean {
- if (!(o instanceof IdentityCommutativePredictionContextOperands)) {
- return false;
- } else if (this === o) {
- return true;
- }
-
- let other: IdentityCommutativePredictionContextOperands = o;
- return (this._x === other._x && this._y === other._y) || (this._x === other._y && this._y === other._x);
- }
-
- @Override
- public hashCode(): number {
- return this._x.hashCode() ^ this._y.hashCode();
- }
- }
-}
diff --git a/src/atn/ProfilingATNSimulator.ts b/src/atn/ProfilingATNSimulator.ts
index 6a453aba..23118f70 100644
--- a/src/atn/ProfilingATNSimulator.ts
+++ b/src/atn/ProfilingATNSimulator.ts
@@ -5,8 +5,10 @@
// ConvertTo-TS run at 2016-10-04T11:26:36.4188352-07:00
+import { Parser } from "../Parser";
+import { ParserATNSimulator } from "./ParserATNSimulator";
import { AmbiguityInfo } from "./AmbiguityInfo";
-import { ATN } from "./ATN";
+import { INVALID_ALT_NUMBER } from "./Constant";
import { ATNConfigSet } from "./ATNConfigSet";
import { ATNSimulator } from "./ATNSimulator";
import { BitSet } from "../misc/BitSet";
@@ -17,11 +19,9 @@ import { DFAState } from "../dfa/DFAState";
import { ErrorInfo } from "./ErrorInfo";
import { NotNull, Override } from "../Decorators";
import { LookaheadEventInfo } from "./LookaheadEventInfo";
-import { Parser } from "../Parser";
-import { ParserATNSimulator } from "./ParserATNSimulator";
import { ParserRuleContext } from "../ParserRuleContext";
import { PredicateEvalInfo } from "./PredicateEvalInfo";
-import { PredictionContextCache } from "./PredictionContextCache";
+import { PredictionContextCache } from "./PredictionContext";
import { SemanticContext } from "./SemanticContext";
import { SimulatorState } from "./SimulatorState";
import { TokenStream } from "../TokenStream";
@@ -85,7 +85,7 @@ export class ProfilingATNSimulator extends ParserATNSimulator {
this._llStopIndex = -1;
this.currentDecision = decision;
this.currentState = undefined;
- this.conflictingAltResolvedBySLL = ATN.INVALID_ALT_NUMBER;
+ this.conflictingAltResolvedBySLL = INVALID_ALT_NUMBER;
let start: number[] = process.hrtime();
let alt: number = super.adaptivePredict(input, decision, outerContext);
let stop: number[] = process.hrtime();
@@ -270,7 +270,7 @@ export class ProfilingATNSimulator extends ParserATNSimulator {
else {
prediction = configs.getRepresentedAlternatives().nextSetBit(0);
}
- if (this.conflictingAltResolvedBySLL !== ATN.INVALID_ALT_NUMBER && prediction !== this.conflictingAltResolvedBySLL) {
+ if (this.conflictingAltResolvedBySLL !== INVALID_ALT_NUMBER && prediction !== this.conflictingAltResolvedBySLL) {
// Even though this is an ambiguity we are reporting, we can
// still detect some context sensitivities. Both SLL and LL
// are showing a conflict, hence an ambiguity, but if they resolve
diff --git a/src/atn/index.ts b/src/atn/index.ts
index f66764c3..cfa6912c 100644
--- a/src/atn/index.ts
+++ b/src/atn/index.ts
@@ -3,6 +3,7 @@
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
+export * from "./Constant";
export * from "./AbstractPredicateTransition";
export * from "./ActionTransition";
export * from "./AmbiguityInfo";
@@ -56,7 +57,6 @@ export * from "./PrecedencePredicateTransition";
export * from "./PredicateEvalInfo";
export * from "./PredicateTransition";
export * from "./PredictionContext";
-export * from "./PredictionContextCache";
export * from "./PredictionMode";
export * from "./ProfilingATNSimulator";
export * from "./RangeTransition";
diff --git a/src/dfa/DFAState.ts b/src/dfa/DFAState.ts
index 066f6459..59351220 100644
--- a/src/dfa/DFAState.ts
+++ b/src/dfa/DFAState.ts
@@ -7,6 +7,7 @@
import { AcceptStateInfo } from "./AcceptStateInfo";
import { ATN } from "../atn/ATN";
+import { INVALID_ALT_NUMBER } from "../atn/Constant";
import { ATNConfigSet } from "../atn/ATNConfigSet";
import { BitSet } from "../misc/BitSet";
import { LexerActionExecutor } from "../atn/LexerActionExecutor";
@@ -15,7 +16,7 @@ import { NotNull, Override } from "../Decorators";
import { PredictionContext } from "../atn/PredictionContext";
import { SemanticContext } from "../atn/SemanticContext";
-import * as assert from "assert";
+import assert from "assert";
/** A DFA state represents a set of possible ATN configurations.
* As Aho, Sethi, Ullman p. 117 says "The DFA uses its state
@@ -119,7 +120,7 @@ export class DFAState {
get prediction(): number {
if (!this._acceptStateInfo) {
- return ATN.INVALID_ALT_NUMBER;
+ return INVALID_ALT_NUMBER;
}
return this._acceptStateInfo.prediction;
@@ -217,7 +218,7 @@ export class DFAState {
let other: DFAState = o;
let sameSet: boolean = this.configs.equals(other.configs);
-// System.out.println("DFAState.equals: "+configs+(sameSet?"==":"!=")+other.configs);
+ // System.out.println("DFAState.equals: "+configs+(sameSet?"==":"!=")+other.configs);
return sameSet;
}
diff --git a/src/index.ts b/src/index.ts
index 316e8483..e9a2b1c1 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -3,9 +3,11 @@
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
+export * from "./ParserInterpreter";
+export * from "./Parser";
+
export * from "./ANTLRErrorListener";
export * from "./ANTLRErrorStrategy";
-// export * from "./ANTLRFileStream";
export * from "./ANTLRInputStream";
export * from "./BailErrorStrategy";
export * from "./BufferedTokenStream";
@@ -17,6 +19,7 @@ export * from "./CommonToken";
export * from "./CommonTokenFactory";
export * from "./CommonTokenStream";
export * from "./ConsoleErrorListener";
+export * from "./Decorators";
export * from "./DefaultErrorStrategy";
export * from "./Dependents";
export * from "./DiagnosticErrorListener";
@@ -29,9 +32,7 @@ export * from "./LexerInterpreter";
export * from "./LexerNoViableAltException";
export * from "./ListTokenSource";
export * from "./NoViableAltException";
-export * from "./Parser";
export * from "./ParserErrorListener";
-export * from "./ParserInterpreter";
export * from "./ParserRuleContext";
export * from "./ProxyErrorListener";
export * from "./ProxyParserErrorListener";
@@ -46,8 +47,11 @@ export * from "./TokenFactory";
export * from "./TokenSource";
export * from "./TokenStream";
export * from "./TokenStreamRewriter";
-// export * from "./UnbufferedCharStream";
-// export * from "./UnbufferedTokenStream";
export * from "./Vocabulary";
export * from "./VocabularyImpl";
export * from "./WritableToken";
+
+export * from "./atn";
+export * from "./dfa";
+export * from "./misc";
+export * from "./tree";
diff --git a/src/misc/Array2DHashSet.ts b/src/misc/Array2DHashSet.ts
index f8adbd3e..7aec9a7d 100644
--- a/src/misc/Array2DHashSet.ts
+++ b/src/misc/Array2DHashSet.ts
@@ -5,7 +5,7 @@
// ConvertTo-TS run at 2016-10-03T02:09:41.7434086-07:00
-import * as assert from "assert";
+import assert from "assert";
import { DefaultEqualityComparator } from "./DefaultEqualityComparator";
import { EqualityComparator } from "./EqualityComparator";
import { NotNull, Nullable, Override, SuppressWarnings } from "../Decorators";
@@ -160,7 +160,7 @@ export class Array2DHashSet implements JavaSe
let newTable: Array = this.createBuckets(newCapacity);
this.buckets = newTable;
this.threshold = Math.floor(newCapacity * LOAD_FACTOR);
-// System.out.println("new size="+newCapacity+", thres="+threshold);
+ // System.out.println("new size="+newCapacity+", thres="+threshold);
// rehash all existing entries
let oldSize: number = this.size;
for (let bucket of old) {
diff --git a/src/misc/BitSet.ts b/src/misc/BitSet.ts
index 25da3170..f83c8227 100644
--- a/src/misc/BitSet.ts
+++ b/src/misc/BitSet.ts
@@ -3,7 +3,7 @@
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
-import * as assert from "assert";
+import assert from "assert";
import * as util from "util";
import { MurmurHash } from "./MurmurHash";
diff --git a/src/misc/index.ts b/src/misc/index.ts
index 2ec5695b..0f2aa733 100644
--- a/src/misc/index.ts
+++ b/src/misc/index.ts
@@ -16,7 +16,7 @@ export * from "./EqualityComparator";
// export * from "./FlexibleHashMap";
export * from "./IntegerList";
export * from "./IntegerStack";
-export * from "./InterpreterDataReader";
+// export * from "./InterpreterDataReader";
export * from "./Interval";
export * from "./IntervalSet";
export * from "./IntSet";
diff --git a/src/tree/Trees.ts b/src/tree/Trees.ts
index 690d0368..e8f5da5c 100644
--- a/src/tree/Trees.ts
+++ b/src/tree/Trees.ts
@@ -6,7 +6,7 @@
// ConvertTo-TS run at 2016-10-04T11:26:48.3187865-07:00
import { Arrays } from "../misc/Arrays";
-import { ATN } from "../atn/ATN";
+import { INVALID_ALT_NUMBER } from "../atn/Constant";
import { CommonToken } from "../CommonToken";
import { ErrorNode } from "./ErrorNode";
import { Interval } from "../misc/Interval";
@@ -90,7 +90,7 @@ export class Trees {
let ruleIndex: number = ruleContext.ruleIndex;
let ruleName: string = ruleNames[ruleIndex];
let altNumber: number = ruleContext.altNumber;
- if (altNumber !== ATN.INVALID_ALT_NUMBER) {
+ if (altNumber !== INVALID_ALT_NUMBER) {
return ruleName + ":" + altNumber;
}
return ruleName;
diff --git a/src/tree/xpath/Constant.ts b/src/tree/xpath/Constant.ts
new file mode 100644
index 00000000..5784052a
--- /dev/null
+++ b/src/tree/xpath/Constant.ts
@@ -0,0 +1,3 @@
+export const XPATH_WILDCARD: string = "*"; // word not operator/separator
+export const XPATH_NOT: string = "!"; // word for invert operator
+
diff --git a/src/tree/xpath/XPath.ts b/src/tree/xpath/XPath.ts
index 4d99468e..b51fcb8c 100644
--- a/src/tree/xpath/XPath.ts
+++ b/src/tree/xpath/XPath.ts
@@ -60,9 +60,6 @@ import { XPathWildcardElement } from "./XPathWildcardElement";
* Whitespace is not allowed.
*/
export class XPath {
- public static readonly WILDCARD: string = "*"; // word not operator/separator
- public static readonly NOT: string = "!"; // word for invert operator
-
protected path: string;
protected elements: XPathElement[];
protected parser: Parser;
diff --git a/src/tree/xpath/XPathWildcardAnywhereElement.ts b/src/tree/xpath/XPathWildcardAnywhereElement.ts
index e2b668bd..ed54cb81 100644
--- a/src/tree/xpath/XPathWildcardAnywhereElement.ts
+++ b/src/tree/xpath/XPathWildcardAnywhereElement.ts
@@ -8,12 +8,12 @@ import { Override } from "../../Decorators";
import { ParseTree } from "../ParseTree";
import { TerminalNode } from "../TerminalNode";
import { Trees } from "../Trees";
-import { XPath } from "./XPath";
+import { XPATH_WILDCARD } from "./Constant";
import { XPathElement } from "./XPathElement";
export class XPathWildcardAnywhereElement extends XPathElement {
constructor() {
- super(XPath.WILDCARD);
+ super(XPATH_WILDCARD);
}
@Override
diff --git a/src/tree/xpath/XPathWildcardElement.ts b/src/tree/xpath/XPathWildcardElement.ts
index 866749fe..1e20fac9 100644
--- a/src/tree/xpath/XPathWildcardElement.ts
+++ b/src/tree/xpath/XPathWildcardElement.ts
@@ -8,12 +8,12 @@ import { Override } from "../../Decorators";
import { ParseTree } from "../ParseTree";
import { TerminalNode } from "../TerminalNode";
import { Trees } from "../Trees";
-import { XPath } from "./XPath";
+import { XPATH_WILDCARD } from "./Constant";
import { XPathElement } from "./XPathElement";
export class XPathWildcardElement extends XPathElement {
constructor() {
- super(XPath.WILDCARD);
+ super(XPATH_WILDCARD);
}
@Override
diff --git a/src/tree/xpath/index.ts b/src/tree/xpath/index.ts
index e74c0815..5ff301fc 100644
--- a/src/tree/xpath/index.ts
+++ b/src/tree/xpath/index.ts
@@ -13,3 +13,4 @@ export * from "./XPathTokenAnywhereElement";
export * from "./XPathTokenElement";
export * from "./XPathWildcardAnywhereElement";
export * from "./XPathWildcardElement";
+export * from "./Constant";
diff --git a/target/src/package.json b/target/src/package.json
index 5735a32f..17ec3668 100644
--- a/target/src/package.json
+++ b/target/src/package.json
@@ -2,7 +2,9 @@
"name": "antlr4ts",
"version": "0.5.0-dev",
"description": "ANTLR 4 runtime for JavaScript written in Typescript",
- "main": "index.js",
+ "main": "index.cjs.js",
+ "module": "index.es5.js",
+ "browser": "index.umd.js",
"scripts": {},
"repository": {
"type": "git",
diff --git a/test/TestArray2DHashSet.ts b/test/TestArray2DHashSet.ts
index 51c92b80..3d4fef97 100644
--- a/test/TestArray2DHashSet.ts
+++ b/test/TestArray2DHashSet.ts
@@ -7,7 +7,7 @@ import {Equatable} from "../src/misc/Stubs";
import {Array2DHashSet} from "../src/misc/Array2DHashSet";
import {MurmurHash} from "../src/misc/MurmurHash";
import { suite, test } from "mocha-typescript";
-import * as assert from "assert";
+import assert from "assert";
class EquatableTest implements Equatable {
diff --git a/test/TestBitSet.ts b/test/TestBitSet.ts
index ab71de57..f9e1b5e3 100644
--- a/test/TestBitSet.ts
+++ b/test/TestBitSet.ts
@@ -3,7 +3,7 @@
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
-import * as assert from "assert";
+import assert from "assert";
import { BitSet } from "../src/misc/BitSet";
describe("BitSet Tests", () => {
diff --git a/test/TestMurmurHash.ts b/test/TestMurmurHash.ts
index 5bcc4951..ef60174c 100644
--- a/test/TestMurmurHash.ts
+++ b/test/TestMurmurHash.ts
@@ -7,7 +7,7 @@ import { MurmurHash } from "../src/misc/MurmurHash";
import { suite, test } from "mocha-typescript";
-import * as assert from "assert";
+import assert from "assert";
@suite
export class TestMurmurHash {
diff --git a/test/TestTokenStream.ts b/test/TestTokenStream.ts
index 199373f5..d3a35f55 100644
--- a/test/TestTokenStream.ts
+++ b/test/TestTokenStream.ts
@@ -10,7 +10,7 @@ import { XPathLexer } from "../src/tree/xpath/XPathLexer";
import { suite, test } from "mocha-typescript";
-import * as assert from "assert";
+import assert from "assert";
/**
* This class contains tests for specific API functionality in `TokenStream` and derived types.
diff --git a/test/runtime/BaseTest.ts b/test/runtime/BaseTest.ts
index 4867b63b..19d18bb0 100644
--- a/test/runtime/BaseTest.ts
+++ b/test/runtime/BaseTest.ts
@@ -3,7 +3,7 @@
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
-import * as assert from "assert";
+import assert from "assert";
import * as stdMocks from "std-mocks";
import { Console } from "console";
diff --git a/test/runtime/tsconfig.json b/test/runtime/tsconfig.json
index f8c501f5..d82e4f88 100644
--- a/test/runtime/tsconfig.json
+++ b/test/runtime/tsconfig.json
@@ -12,6 +12,7 @@
"experimentalDecorators": true,
"declaration": false,
"preserveConstEnums": true,
+ "allowSyntheticDefaultImports": true,
"typeRoots": [
"./node_modules/@types"
],
diff --git a/test/tool/TestCharStreams.ts b/test/tool/TestCharStreams.ts
index 11543331..cba1ae11 100644
--- a/test/tool/TestCharStreams.ts
+++ b/test/tool/TestCharStreams.ts
@@ -3,7 +3,7 @@
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
-import * as assert from "assert";
+import assert from "assert";
import { test, suite } from "mocha-typescript";
import { CharStream } from "../../src/CharStream";
import { CharStreams } from "../../src/CharStreams";
diff --git a/test/tool/TestCodePointCharStream.ts b/test/tool/TestCodePointCharStream.ts
index 2da8f31e..3f9289eb 100644
--- a/test/tool/TestCodePointCharStream.ts
+++ b/test/tool/TestCodePointCharStream.ts
@@ -3,7 +3,7 @@
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
-import * as assert from "assert";
+import assert from "assert";
import { test, suite } from "mocha-typescript";
import { CharStreams } from "../../src/CharStreams";
import { CodePointCharStream } from "../../src/CodePointCharStream";
diff --git a/test/tool/TestGraphNodes.ts b/test/tool/TestGraphNodes.ts
index f018d2bc..02107fe0 100644
--- a/test/tool/TestGraphNodes.ts
+++ b/test/tool/TestGraphNodes.ts
@@ -5,12 +5,12 @@
// ConvertTo-TS run at 2016-10-04T11:27:11.1463816-07:00
-import * as assert from "assert";
+import assert from "assert";
import assertEquals = assert.strictEqual;
import { test as Test, suite } from "mocha-typescript";
import { PredictionContext } from "../../src/atn/PredictionContext";
-import { PredictionContextCache } from "../../src/atn/PredictionContextCache";
+import { PredictionContextCache } from "../../src/atn/PredictionContext";
/// Assuming that IdentityHashMap == Map;
diff --git a/test/tool/TestIntegerList.ts b/test/tool/TestIntegerList.ts
index 495f37f9..e3045908 100644
--- a/test/tool/TestIntegerList.ts
+++ b/test/tool/TestIntegerList.ts
@@ -6,7 +6,7 @@
import { IntegerList } from "../../src/misc/IntegerList";
import { suite, test } from "mocha-typescript";
-import * as assert from "assert";
+import assert from "assert";
@suite
export class TestIntegerList {
diff --git a/test/tool/TestIntervalSet.ts b/test/tool/TestIntervalSet.ts
index e717d400..232f5ecc 100644
--- a/test/tool/TestIntervalSet.ts
+++ b/test/tool/TestIntervalSet.ts
@@ -10,7 +10,7 @@ import { Lexer } from "../../src/Lexer";
import { Token } from "../../src/Token";
import { suite, test as Test } from "mocha-typescript";
-import * as assert from "assert";
+import assert from "assert";
function assertEquals(expected: T, actual: T): void {
assert.strictEqual(actual, expected);
diff --git a/test/tool/TestParseTreeMatcher.ts b/test/tool/TestParseTreeMatcher.ts
index 9507b33b..c9b05581 100644
--- a/test/tool/TestParseTreeMatcher.ts
+++ b/test/tool/TestParseTreeMatcher.ts
@@ -36,7 +36,7 @@ import { ParseTreeMatcherX7Parser } from "./gen/matcher/ParseTreeMatcherX7Parser
import { ParseTreeMatcherX8Lexer } from "./gen/matcher/ParseTreeMatcherX8Lexer";
import { ParseTreeMatcherX8Parser } from "./gen/matcher/ParseTreeMatcherX8Parser";
-import * as assert from "assert";
+import assert from "assert";
import { suite, test as Test, skip as Ignore } from "mocha-typescript";
@suite
diff --git a/test/tool/TestTokenStreamRewriter.ts b/test/tool/TestTokenStreamRewriter.ts
index 147630b0..3ce7d085 100644
--- a/test/tool/TestTokenStreamRewriter.ts
+++ b/test/tool/TestTokenStreamRewriter.ts
@@ -23,7 +23,7 @@ import { RewriterLexer1 } from "./gen/rewriter/RewriterLexer1";
import { RewriterLexer2 } from "./gen/rewriter/RewriterLexer2";
import { RewriterLexer3 } from "./gen/rewriter/RewriterLexer3";
-import * as assert from "assert";
+import assert from "assert";
import { suite, test as Test, skip as Ignore } from "mocha-typescript";
@suite
diff --git a/test/tool/TestUnicodeGrammar.tssoon b/test/tool/TestUnicodeGrammar.tssoon
index 0cf9fbde..995266c8 100644
--- a/test/tool/TestUnicodeGrammar.tssoon
+++ b/test/tool/TestUnicodeGrammar.tssoon
@@ -3,7 +3,7 @@
* Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
*/
-import * as assert from "assert";
+import assert from "assert";
import { suite, test } from "mocha-typescript";
import { CharStream } from "../../src/CharStream";
import { CharStreams } from "../../src/CharStreams";
diff --git a/test/tool/TestVocabulary.ts b/test/tool/TestVocabulary.ts
index bb9864dc..c9ec8abb 100644
--- a/test/tool/TestVocabulary.ts
+++ b/test/tool/TestVocabulary.ts
@@ -7,7 +7,7 @@ import { Token } from "../../src/Token";
import { Vocabulary } from "../../src/Vocabulary";
import { VocabularyImpl } from "../../src/VocabularyImpl";
-import * as assert from "assert";
+import assert from "assert";
import { suite, test as Test, skip as Ignore } from "mocha-typescript";
/**
diff --git a/test/tool/TestXPath.ts b/test/tool/TestXPath.ts
index 170ee720..101c690c 100644
--- a/test/tool/TestXPath.ts
+++ b/test/tool/TestXPath.ts
@@ -19,7 +19,7 @@ import { XPath } from "../../src/tree/xpath/XPath";
import { TestXPathLexer } from "./gen/xpath/TestXPathLexer";
import { TestXPathParser } from "./gen/xpath/TestXPathParser";
-import * as assert from "assert";
+import assert from "assert";
import { suite, test as Test, skip as Ignore } from "mocha-typescript";
const SAMPLE_PROGRAM: string =
diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/TypeScript/TypeScript.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/TypeScript/TypeScript.stg
index 74d7c606..403c337f 100644
--- a/tool/resources/org/antlr/v4/tool/templates/codegen/TypeScript/TypeScript.stg
+++ b/tool/resources/org/antlr/v4/tool/templates/codegen/TypeScript/TypeScript.stg
@@ -2,15 +2,15 @@
// Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
javaTypeInitMap ::= [
- "int":"0",
- "long":"0",
- "float":"0.0f",
- "double":"0.0",
- "boolean":"false",
- "byte":"0",
- "short":"0",
- "char":"0",
- default:"null" // anything other than a primitive type is an object
+ "int":"0",
+ "long":"0",
+ "float":"0.0f",
+ "double":"0.0",
+ "boolean":"false",
+ "byte":"0",
+ "short":"0",
+ "char":"0",
+ default:"null" // anything other than a primitive type is an object
]
// args must be ,
@@ -19,28 +19,28 @@ ParserFile(file, parser, namedActions, contextSuperClass) ::= <<
-
-import { ATN } from "/atn/ATN";
-import { ATNDeserializer } from "/atn/ATNDeserializer";
-import { FailedPredicateException } from "/FailedPredicateException";
-import { NotNull } from "/Decorators";
-import { NoViableAltException } from "/NoViableAltException";
-import { Override } from "/Decorators";
-import { Parser } from "/Parser";
-import { ParserRuleContext } from "/ParserRuleContext";
-import { ParserATNSimulator } from "/atn/ParserATNSimulator";
-import { ParseTreeListener } from "/tree/ParseTreeListener";
-import { ParseTreeVisitor } from "/tree/ParseTreeVisitor";
-import { RecognitionException } from "/RecognitionException";
-import { RuleContext } from "/RuleContext";
-//import { RuleVersion } from "/RuleVersion";
-import { TerminalNode } from "/tree/TerminalNode";
-import { Token } from "/Token";
-import { TokenStream } from "/TokenStream";
-import { Vocabulary } from "/Vocabulary";
-import { VocabularyImpl } from "/VocabularyImpl";
-
-import * as Utils from "/misc/Utils";
+// tslint:disable
+
+import { ATN } from "";
+import { INVALID_ALT_NUMBER } from "";
+import { ATNDeserializer } from "";
+import { FailedPredicateException } from "";
+import { NotNull } from "";
+import { NoViableAltException } from "";
+import { Override } from "";
+import { Parser } from "";
+import { ParserRuleContext } from "";
+import { ParserATNSimulator } from "";
+import { ParseTreeListener } from "";
+import { ParseTreeVisitor } from "";
+import { RecognitionException } from "";
+import { RuleContext } from "";
+import { TerminalNode } from "";
+import { Token } from "";
+import { TokenStream } from "";
+import { Vocabulary } from "";
+import { VocabularyImpl } from "";
+import * as Utils from "";
import { Listener } from "./Listener";
@@ -61,7 +61,7 @@ ListenerFile(file, header, namedActions) ::= <<
-import { ParseTreeListener } from "/tree/ParseTreeListener";
+import { ParseTreeListener } from "";
Context \} from "./";}; separator="\n">
@@ -72,7 +72,7 @@ import { ParseTreeListener } from "/tree/ParseTreeListener";
* ``.
*/
export interface Listener extends ParseTreeListener {
-
* Enter a parse tree produced by the ``
@@ -102,8 +102,8 @@ VisitorFile(file, header, namedActions) ::= <<
-
-import { ParseTreeVisitor } from "/tree/ParseTreeVisitor";
+// tslint:disable
+import { ParseTreeVisitor } from "";
Context \} from "./";}; separator="\n">
@@ -117,7 +117,7 @@ import { ParseTreeVisitor } from "/tree/ParseTreeVisitor";
* operations with no return type.
*/
export interface Visitor\ extends ParseTreeVisitor\ {
-
* Visit a parse tree produced by the ``
@@ -144,44 +144,44 @@ Parser(parser, funcs, atn, sempredFuncs, superClass, isLexer=false) ::= <<
Parser_(parser, funcs, atn, sempredFuncs, ctor, superClass) ::= <<
export abstract class extends {
-
- = ;}; separator="\n", wrap, anchor>
-
- = ;}; separator="\n", wrap, anchor>
- // tslint:disable:no-trailing-whitespace
- public static readonly ruleNames: string[] = [
- ",}; separator=" ", wrap, anchor>
- ];
+
+ = ;}; separator="\n", wrap, anchor>
+
+ = ;}; separator="\n", wrap, anchor>
+ // tslint:disable:no-trailing-whitespace
+ public static readonly ruleNames: string[] = [
+ ",}; separator=" ", wrap, anchor>
+ ];
-
- // tslint:enable:no-trailing-whitespace
+
+ // tslint:enable:no-trailing-whitespace
- // @Override
- public get grammarFileName(): string { return ""; }
+ // @Override
+ public get grammarFileName(): string { return ""; }
- // @Override
- public get ruleNames(): string[] { return .ruleNames; }
+ // @Override
+ public get ruleNames(): string[] { return .ruleNames; }
- // @Override
- public get serializedATN(): string { return ._serializedATN; }
+ // @Override
+ public get serializedATN(): string { return ._serializedATN; }
-
-
-
+
+
+
- public sempred(_localctx: RuleContext, ruleIndex: number, predIndex: number): boolean {
- switch (ruleIndex) {
- :
- return this._sempred(_localctx as , predIndex);}; separator="\n">
- }
- return true;
- }
-
+ return this._sempred(_localctx as , predIndex);}; separator="\n">
+ }
+ return true;
+ }
+
-
+
}
@@ -196,18 +196,19 @@ case :
>>
vocabulary(className, literalNames, symbolicNames) ::= <<
-private static readonly _LITERAL_NAMES: Array\ = [
- ,}; null="undefined,", separator=" ", wrap, anchor>
+private static readonly _LITERAL_NAMES: (string | undefined)[] = [
+ ,}; null="undefined,", separator=" ", wrap, anchor>
];
-private static readonly _SYMBOLIC_NAMES: Array\ = [
- ,}; null="undefined,", separator=" ", wrap, anchor>
+private static readonly _SYMBOLIC_NAMES: (string | undefined)[] = [
+ ,}; null="undefined,", separator=" ", wrap, anchor>
];
+// tslint:disable-next-line: max-line-length
public static readonly VOCABULARY: Vocabulary = new VocabularyImpl(._LITERAL_NAMES, ._SYMBOLIC_NAMES, []);
// @Override
// @NotNull
public get vocabulary(): Vocabulary {
- return .VOCABULARY;
+ return .VOCABULARY;
}
>>
@@ -215,24 +216,24 @@ dumpActions(recog, argFuncs, actionFuncs, sempredFuncs) ::= <<
// @Override
public action(_localctx: RuleContext, ruleIndex: number, actionIndex: number): void {
- switch (ruleIndex) {
- :
- this._action(()_localctx, actionIndex);
- break;}; separator="\n">
- }
+ this._action(()_localctx, actionIndex);
+ break;}; separator="\n">
+ }
}
// @Override
public sempred(_localctx: RuleContext, ruleIndex: number, predIndex: number): boolean {
- switch (ruleIndex) {
- :
- return this._sempred(_localctx as , predIndex);}; separator="\n">
- }
- return true;
+ return this._sempred(_localctx as , predIndex);}; separator="\n">
+ }
+ return true;
}
@@ -240,8 +241,8 @@ case :
parser_ctor(p) ::= <<
constructor(input: TokenStream) {
- super(input);
- this._interp = new ParserATNSimulator(._ATN, this);
+ super(input);
+ this._interp = new ParserATNSimulator(._ATN, this);
}
>>
@@ -250,12 +251,12 @@ constructor(input: TokenStream) {
*/
RuleActionFunction(r, actions) ::= <<
private _action(_localctx: , actionIndex: number): void {
- switch (actionIndex) {
- :
-
- break;}; separator="\n">
- }
+
+ break;}; separator="\n">
+ }
}
>>
@@ -264,48 +265,48 @@ case :
*/
RuleSempredFunction(r, actions) ::= <<
private _sempred(_localctx: , predIndex: number): boolean {
- switch (predIndex) {
- :
- return ;}; separator="\n">
- }
- return true;
+ return ;}; separator="\n">
+ }
+ return true;
}
>>
RuleFunction(currentRule,args,code,locals,ruleCtx,altLabelCtxs,namedActions,finallyAction,postamble,exceptions) ::= <<
// @RuleVersion()
}>public (): {
- let _localctx: = new (this._ctx, this.state