-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move antlr visitor derived classes into private namespace and dedupli…
…cate ErrorListener
- Loading branch information
1 parent
b5f55d3
commit d96505e
Showing
5 changed files
with
40 additions
and
23 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
components/core/src/clp_s/search/antlr_common/ErrorListener.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef CLP_S_SEARCH_ANTLRCOMMON_ERRORLISTENER_HPP | ||
#define CLP_S_SEARCH_ANTLRCOMMON_ERRORLISTENER_HPP | ||
#include <antlr4-runtime.h> | ||
|
||
namespace clp_s::search::antlr_common { | ||
class ErrorListener : public antlr4::BaseErrorListener { | ||
public: | ||
void syntaxError( | ||
antlr4::Recognizer* recognizer, | ||
antlr4::Token* offending_symbol, | ||
size_t line, | ||
size_t char_position_in_line, | ||
std::string const& msg, | ||
std::exception_ptr e | ||
) override { | ||
m_error = true; | ||
m_error_message = msg; | ||
} | ||
|
||
bool error() const { return m_error; } | ||
|
||
std::string const& message() const { return m_error_message; } | ||
|
||
private: | ||
bool m_error{false}; | ||
std::string m_error_message; | ||
}; | ||
} // namespace clp_s::search::antlr_common | ||
|
||
#endif // CLP_S_SEARCH_ANTLRCOMMON_ERRORLISTENER_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