Merge pull request #1701 from Thomasb81/Fix_syntaxError_proto
[Cpp] Fix syntaxError prototype issue
This commit is contained in:
commit
4a5e65c5e7
|
@ -549,7 +549,6 @@
|
||||||
<ClInclude Include="src\InputMismatchException.h" />
|
<ClInclude Include="src\InputMismatchException.h" />
|
||||||
<ClInclude Include="src\InterpreterRuleContext.h" />
|
<ClInclude Include="src\InterpreterRuleContext.h" />
|
||||||
<ClInclude Include="src\IntStream.h" />
|
<ClInclude Include="src\IntStream.h" />
|
||||||
<ClInclude Include="src\IRecognizer.h" />
|
|
||||||
<ClInclude Include="src\Lexer.h" />
|
<ClInclude Include="src\Lexer.h" />
|
||||||
<ClInclude Include="src\LexerInterpreter.h" />
|
<ClInclude Include="src\LexerInterpreter.h" />
|
||||||
<ClInclude Include="src\LexerNoViableAltException.h" />
|
<ClInclude Include="src\LexerNoViableAltException.h" />
|
||||||
|
@ -621,4 +620,4 @@
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -114,9 +114,6 @@
|
||||||
<ClInclude Include="src\IntStream.h">
|
<ClInclude Include="src\IntStream.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="src\IRecognizer.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="src\Lexer.h">
|
<ClInclude Include="src\Lexer.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -942,4 +939,4 @@
|
||||||
<Filter>Source Files\tree</Filter>
|
<Filter>Source Files\tree</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -562,7 +562,6 @@
|
||||||
<ClInclude Include="src\InputMismatchException.h" />
|
<ClInclude Include="src\InputMismatchException.h" />
|
||||||
<ClInclude Include="src\InterpreterRuleContext.h" />
|
<ClInclude Include="src\InterpreterRuleContext.h" />
|
||||||
<ClInclude Include="src\IntStream.h" />
|
<ClInclude Include="src\IntStream.h" />
|
||||||
<ClInclude Include="src\IRecognizer.h" />
|
|
||||||
<ClInclude Include="src\Lexer.h" />
|
<ClInclude Include="src\Lexer.h" />
|
||||||
<ClInclude Include="src\LexerInterpreter.h" />
|
<ClInclude Include="src\LexerInterpreter.h" />
|
||||||
<ClInclude Include="src\LexerNoViableAltException.h" />
|
<ClInclude Include="src\LexerNoViableAltException.h" />
|
||||||
|
@ -634,4 +633,4 @@
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -114,9 +114,6 @@
|
||||||
<ClInclude Include="src\IntStream.h">
|
<ClInclude Include="src\IntStream.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="src\IRecognizer.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="src\Lexer.h">
|
<ClInclude Include="src\Lexer.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -942,4 +939,4 @@
|
||||||
<Filter>Source Files\tree</Filter>
|
<Filter>Source Files\tree</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace antlr4 {
|
||||||
/// the reporting of an error. It is null in the case where
|
/// the reporting of an error. It is null in the case where
|
||||||
/// the parser was able to recover in line without exiting the
|
/// the parser was able to recover in line without exiting the
|
||||||
/// surrounding rule. </param>
|
/// 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;
|
size_t charPositionInLine, const std::string &msg, std::exception_ptr e) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
using namespace antlr4;
|
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*/) {
|
size_t /*charPositionInLine*/, const std::string &/*msg*/, std::exception_ptr /*e*/) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace antlr4 {
|
||||||
*/
|
*/
|
||||||
class ANTLR4CPP_PUBLIC BaseErrorListener : public ANTLRErrorListener {
|
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;
|
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,
|
virtual void reportAmbiguity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex, bool exact,
|
||||||
|
|
|
@ -9,7 +9,7 @@ using namespace antlr4;
|
||||||
|
|
||||||
ConsoleErrorListener ConsoleErrorListener::INSTANCE;
|
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*/) {
|
size_t line, size_t charPositionInLine, const std::string &msg, std::exception_ptr /*e*/) {
|
||||||
std::cerr << "line " << line << ":" << charPositionInLine << " " << msg << std::endl;
|
std::cerr << "line " << line << ":" << charPositionInLine << " " << msg << std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace antlr4 {
|
||||||
* line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
|
* line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
|
||||||
* </pre>
|
* </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;
|
const std::string &msg, std::exception_ptr e) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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
|
|
|
@ -23,7 +23,7 @@ void ProxyErrorListener::removeErrorListeners() {
|
||||||
_delegates.clear();
|
_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) {
|
size_t charPositionInLine, const std::string &msg, std::exception_ptr e) {
|
||||||
|
|
||||||
for (auto listener : _delegates) {
|
for (auto listener : _delegates) {
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace antlr4 {
|
||||||
void removeErrorListener(ANTLRErrorListener *listener);
|
void removeErrorListener(ANTLRErrorListener *listener);
|
||||||
void removeErrorListeners();
|
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;
|
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,
|
virtual void reportAmbiguity(Parser *recognizer, const dfa::DFA &dfa, size_t startIndex, size_t stopIndex, bool exact,
|
||||||
|
|
|
@ -13,12 +13,12 @@
|
||||||
|
|
||||||
using namespace antlr4;
|
using namespace antlr4;
|
||||||
|
|
||||||
RecognitionException::RecognitionException(IRecognizer *recognizer, IntStream *input, ParserRuleContext *ctx,
|
RecognitionException::RecognitionException(Recognizer *recognizer, IntStream *input, ParserRuleContext *ctx,
|
||||||
Token *offendingToken)
|
Token *offendingToken)
|
||||||
: RecognitionException("", recognizer, input, ctx, 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)
|
ParserRuleContext *ctx, Token *offendingToken)
|
||||||
: RuntimeException(message), _recognizer(recognizer), _input(input), _ctx(ctx), _offendingToken(offendingToken) {
|
: RuntimeException(message), _recognizer(recognizer), _input(input), _ctx(ctx), _offendingToken(offendingToken) {
|
||||||
InitializeInstanceFields();
|
InitializeInstanceFields();
|
||||||
|
@ -54,7 +54,7 @@ Token* RecognitionException::getOffendingToken() const {
|
||||||
return _offendingToken;
|
return _offendingToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
IRecognizer* RecognitionException::getRecognizer() const {
|
Recognizer* RecognitionException::getRecognizer() const {
|
||||||
return _recognizer;
|
return _recognizer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace antlr4 {
|
||||||
class ANTLR4CPP_PUBLIC RecognitionException : public RuntimeException {
|
class ANTLR4CPP_PUBLIC RecognitionException : public RuntimeException {
|
||||||
private:
|
private:
|
||||||
/// The Recognizer where this exception originated.
|
/// The Recognizer where this exception originated.
|
||||||
IRecognizer *_recognizer;
|
Recognizer *_recognizer;
|
||||||
IntStream *_input;
|
IntStream *_input;
|
||||||
ParserRuleContext *_ctx;
|
ParserRuleContext *_ctx;
|
||||||
|
|
||||||
|
@ -29,9 +29,9 @@ namespace antlr4 {
|
||||||
size_t _offendingState;
|
size_t _offendingState;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RecognitionException(IRecognizer *recognizer, IntStream *input, ParserRuleContext *ctx,
|
RecognitionException(Recognizer *recognizer, IntStream *input, ParserRuleContext *ctx,
|
||||||
Token *offendingToken = nullptr);
|
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);
|
ParserRuleContext *ctx, Token *offendingToken = nullptr);
|
||||||
~RecognitionException() {}
|
~RecognitionException() {}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ namespace antlr4 {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns> The recognizer where this exception occurred, or {@code null} if
|
/// <returns> The recognizer where this exception occurred, or {@code null} if
|
||||||
/// the recognizer is not available. </returns>
|
/// the recognizer is not available. </returns>
|
||||||
virtual IRecognizer* getRecognizer() const;
|
virtual Recognizer* getRecognizer() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void InitializeInstanceFields();
|
void InitializeInstanceFields();
|
||||||
|
|
|
@ -6,11 +6,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ProxyErrorListener.h"
|
#include "ProxyErrorListener.h"
|
||||||
#include "IRecognizer.h"
|
|
||||||
|
|
||||||
namespace antlr4 {
|
namespace antlr4 {
|
||||||
|
|
||||||
class ANTLR4CPP_PUBLIC Recognizer : public IRecognizer {
|
class ANTLR4CPP_PUBLIC Recognizer {
|
||||||
public:
|
public:
|
||||||
static const size_t EOF = (size_t)-1;
|
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 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>
|
/// <summary>
|
||||||
/// Indicate that the recognizer has changed internal state that is
|
/// Indicate that the recognizer has changed internal state that is
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include "DiagnosticErrorListener.h"
|
#include "DiagnosticErrorListener.h"
|
||||||
#include "Exceptions.h"
|
#include "Exceptions.h"
|
||||||
#include "FailedPredicateException.h"
|
#include "FailedPredicateException.h"
|
||||||
#include "IRecognizer.h"
|
|
||||||
#include "InputMismatchException.h"
|
#include "InputMismatchException.h"
|
||||||
#include "IntStream.h"
|
#include "IntStream.h"
|
||||||
#include "InterpreterRuleContext.h"
|
#include "InterpreterRuleContext.h"
|
||||||
|
|
|
@ -34,7 +34,6 @@ namespace antlr4 {
|
||||||
class InputMismatchException;
|
class InputMismatchException;
|
||||||
class IntStream;
|
class IntStream;
|
||||||
class InterpreterRuleContext;
|
class InterpreterRuleContext;
|
||||||
class IRecognizer;
|
|
||||||
class Lexer;
|
class Lexer;
|
||||||
class LexerInterpreter;
|
class LexerInterpreter;
|
||||||
class LexerNoViableAltException;
|
class LexerNoViableAltException;
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
using namespace antlr4;
|
using namespace antlr4;
|
||||||
using namespace antlr4::tree::xpath;
|
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*/) {
|
size_t /*line*/, size_t /*charPositionInLine*/, const std::string &/*msg*/, std::exception_ptr /*e*/) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace xpath {
|
||||||
|
|
||||||
class ANTLR4CPP_PUBLIC XPathLexerErrorListener : public BaseErrorListener {
|
class ANTLR4CPP_PUBLIC XPathLexerErrorListener : public BaseErrorListener {
|
||||||
public:
|
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;
|
size_t charPositionInLine, const std::string &msg, std::exception_ptr e) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue