UNPKG

2.13 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};
12var __param = (this && this.__param) || function (paramIndex, decorator) {
13 return function (target, key) { decorator(target, key, paramIndex); }
14};
15Object.defineProperty(exports, "__esModule", { value: true });
16exports.ProxyErrorListener = void 0;
17const Decorators_1 = require("./Decorators");
18/**
19 * This implementation of {@link ANTLRErrorListener} dispatches all calls to a
20 * collection of delegate listeners. This reduces the effort required to support multiple
21 * listeners.
22 *
23 * @author Sam Harwell
24 */
25class ProxyErrorListener {
26 constructor(delegates) {
27 this.delegates = delegates;
28 if (!delegates) {
29 throw new Error("Invalid delegates");
30 }
31 }
32 getDelegates() {
33 return this.delegates;
34 }
35 syntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, e) {
36 this.delegates.forEach((listener) => {
37 if (listener.syntaxError) {
38 listener.syntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, e);
39 }
40 });
41 }
42}
43__decorate([
44 Decorators_1.Override,
45 __param(0, Decorators_1.NotNull),
46 __param(4, Decorators_1.NotNull)
47], ProxyErrorListener.prototype, "syntaxError", null);
48exports.ProxyErrorListener = ProxyErrorListener;
49//# sourceMappingURL=ProxyErrorListener.js.map
\No newline at end of file