1 /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2 * Use of this file is governed by the BSD 3-clause license that
3 * can be found in the LICENSE.txt file in the project root.
6 #include "ProxyErrorListener.h"
8 using namespace antlr4;
10 void ProxyErrorListener::addErrorListener(ANTLRErrorListener *listener) {
11 if (listener == nullptr) {
12 throw "listener cannot be null.";
15 _delegates.insert(listener);
18 void ProxyErrorListener::removeErrorListener(ANTLRErrorListener *listener) {
19 _delegates.erase(listener);
22 void ProxyErrorListener::removeErrorListeners() {
26 void ProxyErrorListener::syntaxError(Recognizer *recognizer, Token *offendingSymbol, size_t line,
27 size_t charPositionInLine, const std::string &msg, std::exception_ptr e) {
29 for (auto *listener : _delegates) {
30 listener->syntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, e);
34 void ProxyErrorListener::reportAmbiguity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex,
35 bool exact, const antlrcpp::BitSet &ambigAlts, atn::ATNConfigSet *configs) {
36 for (auto *listener : _delegates) {
37 listener->reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
41 void ProxyErrorListener::reportAttemptingFullContext(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex,
42 size_t stopIndex, const antlrcpp::BitSet &conflictingAlts, atn::ATNConfigSet *configs) {
43 for (auto *listener : _delegates) {
44 listener->reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs);
48 void ProxyErrorListener::reportContextSensitivity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex,
49 size_t prediction, atn::ATNConfigSet *configs) {
50 for (auto *listener : _delegates) {
51 listener->reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs);