UNPKG

2.54 kBJavaScriptView Raw
1"use strict";
2/*!
3 * Copyright 2016 The ANTLR Project. All rights reserved.
4 * Licensed under the BSD-3-Clause license. See LICENSE file in the project root for license information.
5 */
6var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
7 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10 return c > 3 && r && Object.defineProperty(target, key, r), r;
11};
12Object.defineProperty(exports, "__esModule", { value: true });
13exports.NoViableAltException = void 0;
14const Parser_1 = require("./Parser");
15const RecognitionException_1 = require("./RecognitionException");
16const Decorators_1 = require("./Decorators");
17/** Indicates that the parser could not decide which of two or more paths
18 * to take based upon the remaining input. It tracks the starting token
19 * of the offending input and also knows where the parser was
20 * in the various paths when the error. Reported by reportNoViableAlternative()
21 */
22class NoViableAltException extends RecognitionException_1.RecognitionException {
23 constructor(recognizer, input, startToken, offendingToken, deadEndConfigs, ctx) {
24 if (recognizer instanceof Parser_1.Parser) {
25 if (input === undefined) {
26 input = recognizer.inputStream;
27 }
28 if (startToken === undefined) {
29 startToken = recognizer.currentToken;
30 }
31 if (offendingToken === undefined) {
32 offendingToken = recognizer.currentToken;
33 }
34 if (ctx === undefined) {
35 ctx = recognizer.context;
36 }
37 }
38 super(recognizer, input, ctx);
39 this._deadEndConfigs = deadEndConfigs;
40 this._startToken = startToken;
41 this.setOffendingToken(recognizer, offendingToken);
42 }
43 get startToken() {
44 return this._startToken;
45 }
46 get deadEndConfigs() {
47 return this._deadEndConfigs;
48 }
49}
50__decorate([
51 Decorators_1.NotNull
52], NoViableAltException.prototype, "_startToken", void 0);
53exports.NoViableAltException = NoViableAltException;
54//# sourceMappingURL=NoViableAltException.js.map
\No newline at end of file