Merge pull request #1701 from Thomasb81/Fix_syntaxError_proto

[Cpp] Fix syntaxError prototype issue
This commit is contained in:
Terence Parr 2017-03-03 13:30:00 -08:00 committed by GitHub
commit 4a5e65c5e7
19 changed files with 25 additions and 54 deletions

View File

@ -549,7 +549,6 @@
<ClInclude Include="src\InputMismatchException.h" />
<ClInclude Include="src\InterpreterRuleContext.h" />
<ClInclude Include="src\IntStream.h" />
<ClInclude Include="src\IRecognizer.h" />
<ClInclude Include="src\Lexer.h" />
<ClInclude Include="src\LexerInterpreter.h" />
<ClInclude Include="src\LexerNoViableAltException.h" />

View File

@ -114,9 +114,6 @@
<ClInclude Include="src\IntStream.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\IRecognizer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\Lexer.h">
<Filter>Header Files</Filter>
</ClInclude>

View File

@ -562,7 +562,6 @@
<ClInclude Include="src\InputMismatchException.h" />
<ClInclude Include="src\InterpreterRuleContext.h" />
<ClInclude Include="src\IntStream.h" />
<ClInclude Include="src\IRecognizer.h" />
<ClInclude Include="src\Lexer.h" />
<ClInclude Include="src\LexerInterpreter.h" />
<ClInclude Include="src\LexerNoViableAltException.h" />

View File

@ -114,9 +114,6 @@
<ClInclude Include="src\IntStream.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\IRecognizer.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\Lexer.h">
<Filter>Header Files</Filter>
</ClInclude>

View File

@ -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. </param>
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;
/**

View File

@ -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*/) {
}

View File

@ -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,

View File

@ -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;
}

View File

@ -28,7 +28,7 @@ namespace antlr4 {
* line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
* </pre>
*/
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;
};

View File

@ -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

View File

@ -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) {

View File

@ -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,

View File

@ -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;
}

View File

@ -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 {
/// </summary>
/// <returns> The recognizer where this exception occurred, or {@code null} if
/// the recognizer is not available. </returns>
virtual IRecognizer* getRecognizer() const;
virtual Recognizer* getRecognizer() const;
private:
void InitializeInstanceFields();

View File

@ -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;
/// <summary>
/// Indicate that the recognizer has changed internal state that is

View File

@ -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"

View File

@ -34,7 +34,6 @@ namespace antlr4 {
class InputMismatchException;
class IntStream;
class InterpreterRuleContext;
class IRecognizer;
class Lexer;
class LexerInterpreter;
class LexerNoViableAltException;

View File

@ -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*/) {
}

View File

@ -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;
};