-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
78 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "translator/antlr_error_listener.h" | ||
#include <sstream> | ||
|
||
void AntlrErrorListener::syntaxError(antlr4::Recognizer* recognizer, | ||
antlr4::Token* offendingSymbol, | ||
size_t line, | ||
size_t charPositionInLine, | ||
const std::string& msg, | ||
std::exception_ptr e) { | ||
std::stringstream s; | ||
s << "Line(" << line << ":" << charPositionInLine << ") Error(" << msg << ")"; | ||
throw std::invalid_argument(s.str()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#ifndef TRANSLATOR_ANTLR_ERROR_LISTENER_HPP | ||
#define TRANSLATOR_ANTLR_ERROR_LISTENER_HPP | ||
|
||
#include <antlr4-runtime.h> | ||
|
||
class AntlrErrorListener : public antlr4::BaseErrorListener { | ||
void syntaxError(antlr4::Recognizer* recognizer, | ||
antlr4::Token* offendingSymbol, | ||
size_t line, | ||
size_t charPositionInLine, | ||
const std::string& msg, | ||
std::exception_ptr e) final; | ||
}; | ||
|
||
#endif // TRANSLATOR_ANTLR_ERROR_LISTENER_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters