diff --git a/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj b/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj index 1eb43a563..50ab20c8b 100644 --- a/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj +++ b/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj @@ -549,7 +549,6 @@ - @@ -621,4 +620,4 @@ - \ No newline at end of file + diff --git a/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj.filters b/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj.filters index 4ad93b5cc..d3b301654 100644 --- a/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj.filters +++ b/runtime/Cpp/runtime/antlr4cpp-vs2013.vcxproj.filters @@ -114,9 +114,6 @@ Header Files - - Header Files - Header Files @@ -942,4 +939,4 @@ Source Files\tree - \ No newline at end of file + diff --git a/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj b/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj index 85fa3da44..e549a78b6 100644 --- a/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj +++ b/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj @@ -562,7 +562,6 @@ - @@ -634,4 +633,4 @@ - \ No newline at end of file + diff --git a/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj.filters b/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj.filters index 3d77916e6..21eaaf722 100644 --- a/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj.filters +++ b/runtime/Cpp/runtime/antlr4cpp-vs2015.vcxproj.filters @@ -114,9 +114,6 @@ Header Files - - Header Files - Header Files @@ -942,4 +939,4 @@ Source Files\tree - \ No newline at end of file + diff --git a/runtime/Cpp/runtime/src/ANTLRErrorListener.h b/runtime/Cpp/runtime/src/ANTLRErrorListener.h index 7729b2537..888e4fa45 100755 --- a/runtime/Cpp/runtime/src/ANTLRErrorListener.h +++ b/runtime/Cpp/runtime/src/ANTLRErrorListener.h @@ -50,7 +50,7 @@ namespace antlr4 { /// the reporting of an error. It is null in the case where /// the parser was able to recover in line without exiting the /// surrounding rule. - virtual void syntaxError(IRecognizer *recognizer, Token *offendingSymbol, size_t line, + virtual void syntaxError(Recognizer *recognizer, Token *offendingSymbol, size_t line, size_t charPositionInLine, const std::string &msg, std::exception_ptr e) = 0; /** diff --git a/runtime/Cpp/runtime/src/BaseErrorListener.cpp b/runtime/Cpp/runtime/src/BaseErrorListener.cpp index 47ef00cbf..89b9510e1 100755 --- a/runtime/Cpp/runtime/src/BaseErrorListener.cpp +++ b/runtime/Cpp/runtime/src/BaseErrorListener.cpp @@ -8,7 +8,7 @@ using namespace antlr4; -void BaseErrorListener::syntaxError(IRecognizer * /*recognizer*/, Token * /*offendingSymbol*/, size_t /*line*/, +void BaseErrorListener::syntaxError(Recognizer * /*recognizer*/, Token * /*offendingSymbol*/, size_t /*line*/, size_t /*charPositionInLine*/, const std::string &/*msg*/, std::exception_ptr /*e*/) { } diff --git a/runtime/Cpp/runtime/src/BaseErrorListener.h b/runtime/Cpp/runtime/src/BaseErrorListener.h index 75aefc60a..069e8bd8f 100755 --- a/runtime/Cpp/runtime/src/BaseErrorListener.h +++ b/runtime/Cpp/runtime/src/BaseErrorListener.h @@ -20,7 +20,7 @@ namespace antlr4 { */ class ANTLR4CPP_PUBLIC BaseErrorListener : public ANTLRErrorListener { - virtual void syntaxError(IRecognizer *recognizer, Token * offendingSymbol, size_t line, size_t charPositionInLine, + virtual void syntaxError(Recognizer *recognizer, Token * offendingSymbol, size_t line, size_t charPositionInLine, const std::string &msg, std::exception_ptr e) override; virtual void reportAmbiguity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex, bool exact, diff --git a/runtime/Cpp/runtime/src/ConsoleErrorListener.cpp b/runtime/Cpp/runtime/src/ConsoleErrorListener.cpp index 3f06925f8..7ab242db2 100755 --- a/runtime/Cpp/runtime/src/ConsoleErrorListener.cpp +++ b/runtime/Cpp/runtime/src/ConsoleErrorListener.cpp @@ -9,7 +9,7 @@ using namespace antlr4; ConsoleErrorListener ConsoleErrorListener::INSTANCE; -void ConsoleErrorListener::syntaxError(IRecognizer * /*recognizer*/, Token * /*offendingSymbol*/, +void ConsoleErrorListener::syntaxError(Recognizer * /*recognizer*/, Token * /*offendingSymbol*/, size_t line, size_t charPositionInLine, const std::string &msg, std::exception_ptr /*e*/) { std::cerr << "line " << line << ":" << charPositionInLine << " " << msg << std::endl; } diff --git a/runtime/Cpp/runtime/src/ConsoleErrorListener.h b/runtime/Cpp/runtime/src/ConsoleErrorListener.h index a0869b6ad..4df9d6919 100755 --- a/runtime/Cpp/runtime/src/ConsoleErrorListener.h +++ b/runtime/Cpp/runtime/src/ConsoleErrorListener.h @@ -28,7 +28,7 @@ namespace antlr4 { * line line:charPositionInLine msg * */ - virtual void syntaxError(IRecognizer *recognizer, Token * offendingSymbol, size_t line, size_t charPositionInLine, + virtual void syntaxError(Recognizer *recognizer, Token * offendingSymbol, size_t line, size_t charPositionInLine, const std::string &msg, std::exception_ptr e) override; }; diff --git a/runtime/Cpp/runtime/src/IRecognizer.h b/runtime/Cpp/runtime/src/IRecognizer.h deleted file mode 100644 index 4c247c740..000000000 --- a/runtime/Cpp/runtime/src/IRecognizer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* Copyright (c) 2012-2016 The ANTLR Project. All rights reserved. - * Use of this file is governed by the BSD 3-clause license that - * can be found in the LICENSE.txt file in the project root. - */ - -#pragma once - -namespace antlr4 { - - class ANTLR4CPP_PUBLIC IRecognizer { - public: - virtual ~IRecognizer() {}; - - virtual size_t getState() const = 0; - - // Get the ATN used by the recognizer for prediction. - virtual const atn::ATN& getATN() const = 0; - - }; - -} // namespace antlr4 diff --git a/runtime/Cpp/runtime/src/ProxyErrorListener.cpp b/runtime/Cpp/runtime/src/ProxyErrorListener.cpp index 45ad43c22..b1f43d100 100755 --- a/runtime/Cpp/runtime/src/ProxyErrorListener.cpp +++ b/runtime/Cpp/runtime/src/ProxyErrorListener.cpp @@ -23,7 +23,7 @@ void ProxyErrorListener::removeErrorListeners() { _delegates.clear(); } -void ProxyErrorListener::syntaxError(IRecognizer *recognizer, Token *offendingSymbol, size_t line, +void ProxyErrorListener::syntaxError(Recognizer *recognizer, Token *offendingSymbol, size_t line, size_t charPositionInLine, const std::string &msg, std::exception_ptr e) { for (auto listener : _delegates) { diff --git a/runtime/Cpp/runtime/src/ProxyErrorListener.h b/runtime/Cpp/runtime/src/ProxyErrorListener.h index f2d8d47ea..2b0b43562 100755 --- a/runtime/Cpp/runtime/src/ProxyErrorListener.h +++ b/runtime/Cpp/runtime/src/ProxyErrorListener.h @@ -22,7 +22,7 @@ namespace antlr4 { void removeErrorListener(ANTLRErrorListener *listener); void removeErrorListeners(); - void syntaxError(IRecognizer *recognizer, Token *offendingSymbol, size_t line, size_t charPositionInLine, + void syntaxError(Recognizer *recognizer, Token *offendingSymbol, size_t line, size_t charPositionInLine, const std::string &msg, std::exception_ptr e) override; virtual void reportAmbiguity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex, bool exact, diff --git a/runtime/Cpp/runtime/src/RecognitionException.cpp b/runtime/Cpp/runtime/src/RecognitionException.cpp index 608497fed..b51308feb 100755 --- a/runtime/Cpp/runtime/src/RecognitionException.cpp +++ b/runtime/Cpp/runtime/src/RecognitionException.cpp @@ -13,12 +13,12 @@ using namespace antlr4; -RecognitionException::RecognitionException(IRecognizer *recognizer, IntStream *input, ParserRuleContext *ctx, +RecognitionException::RecognitionException(Recognizer *recognizer, IntStream *input, ParserRuleContext *ctx, Token *offendingToken) : RecognitionException("", recognizer, input, ctx, offendingToken) { } -RecognitionException::RecognitionException(const std::string &message, IRecognizer *recognizer, IntStream *input, +RecognitionException::RecognitionException(const std::string &message, Recognizer *recognizer, IntStream *input, ParserRuleContext *ctx, Token *offendingToken) : RuntimeException(message), _recognizer(recognizer), _input(input), _ctx(ctx), _offendingToken(offendingToken) { InitializeInstanceFields(); @@ -54,7 +54,7 @@ Token* RecognitionException::getOffendingToken() const { return _offendingToken; } -IRecognizer* RecognitionException::getRecognizer() const { +Recognizer* RecognitionException::getRecognizer() const { return _recognizer; } diff --git a/runtime/Cpp/runtime/src/RecognitionException.h b/runtime/Cpp/runtime/src/RecognitionException.h index b444cbcbf..0e4dc88a1 100755 --- a/runtime/Cpp/runtime/src/RecognitionException.h +++ b/runtime/Cpp/runtime/src/RecognitionException.h @@ -17,7 +17,7 @@ namespace antlr4 { class ANTLR4CPP_PUBLIC RecognitionException : public RuntimeException { private: /// The Recognizer where this exception originated. - IRecognizer *_recognizer; + Recognizer *_recognizer; IntStream *_input; ParserRuleContext *_ctx; @@ -29,9 +29,9 @@ namespace antlr4 { size_t _offendingState; public: - RecognitionException(IRecognizer *recognizer, IntStream *input, ParserRuleContext *ctx, + RecognitionException(Recognizer *recognizer, IntStream *input, ParserRuleContext *ctx, Token *offendingToken = nullptr); - RecognitionException(const std::string &message, IRecognizer *recognizer, IntStream *input, + RecognitionException(const std::string &message, Recognizer *recognizer, IntStream *input, ParserRuleContext *ctx, Token *offendingToken = nullptr); ~RecognitionException() {} @@ -87,7 +87,7 @@ namespace antlr4 { /// /// The recognizer where this exception occurred, or {@code null} if /// the recognizer is not available. - virtual IRecognizer* getRecognizer() const; + virtual Recognizer* getRecognizer() const; private: void InitializeInstanceFields(); diff --git a/runtime/Cpp/runtime/src/Recognizer.h b/runtime/Cpp/runtime/src/Recognizer.h index 846e132d8..0a22e9116 100755 --- a/runtime/Cpp/runtime/src/Recognizer.h +++ b/runtime/Cpp/runtime/src/Recognizer.h @@ -6,11 +6,10 @@ #pragma once #include "ProxyErrorListener.h" -#include "IRecognizer.h" namespace antlr4 { - class ANTLR4CPP_PUBLIC Recognizer : public IRecognizer { + class ANTLR4CPP_PUBLIC Recognizer { public: static const size_t EOF = (size_t)-1; @@ -117,7 +116,10 @@ namespace antlr4 { virtual void action(RuleContext *localctx, size_t ruleIndex, size_t actionIndex); - virtual size_t getState() const override; + virtual size_t getState() const ; + + // Get the ATN used by the recognizer for prediction. + virtual const atn::ATN& getATN() const = 0; /// /// Indicate that the recognizer has changed internal state that is diff --git a/runtime/Cpp/runtime/src/antlr4-runtime.h b/runtime/Cpp/runtime/src/antlr4-runtime.h index 9f854728b..8009c4ff1 100644 --- a/runtime/Cpp/runtime/src/antlr4-runtime.h +++ b/runtime/Cpp/runtime/src/antlr4-runtime.h @@ -25,7 +25,6 @@ #include "DiagnosticErrorListener.h" #include "Exceptions.h" #include "FailedPredicateException.h" -#include "IRecognizer.h" #include "InputMismatchException.h" #include "IntStream.h" #include "InterpreterRuleContext.h" diff --git a/runtime/Cpp/runtime/src/support/Declarations.h b/runtime/Cpp/runtime/src/support/Declarations.h index 2172735d5..32a88de36 100644 --- a/runtime/Cpp/runtime/src/support/Declarations.h +++ b/runtime/Cpp/runtime/src/support/Declarations.h @@ -34,7 +34,6 @@ namespace antlr4 { class InputMismatchException; class IntStream; class InterpreterRuleContext; - class IRecognizer; class Lexer; class LexerInterpreter; class LexerNoViableAltException; diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.cpp b/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.cpp index aa678e833..089eec1d2 100755 --- a/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.cpp +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.cpp @@ -8,6 +8,6 @@ using namespace antlr4; using namespace antlr4::tree::xpath; -void XPathLexerErrorListener::syntaxError(IRecognizer * /*recognizer*/, Token * /*offendingSymbol*/, +void XPathLexerErrorListener::syntaxError(Recognizer * /*recognizer*/, Token * /*offendingSymbol*/, size_t /*line*/, size_t /*charPositionInLine*/, const std::string &/*msg*/, std::exception_ptr /*e*/) { } diff --git a/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.h b/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.h index f6c51cb93..dba7a5167 100755 --- a/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.h +++ b/runtime/Cpp/runtime/src/tree/xpath/XPathLexerErrorListener.h @@ -13,7 +13,7 @@ namespace xpath { class ANTLR4CPP_PUBLIC XPathLexerErrorListener : public BaseErrorListener { public: - virtual void syntaxError(IRecognizer *recognizer, Token *offendingSymbol, size_t line, + virtual void syntaxError(Recognizer *recognizer, Token *offendingSymbol, size_t line, size_t charPositionInLine, const std::string &msg, std::exception_ptr e) override; };