Skip to content
Snippets Groups Projects
Commit e4725c3b authored by Paweł Kędzia's avatar Paweł Kędzia
Browse files

Caught the antlr::TokenStreamRecognitionException exception

parent bf221853
Branches
No related merge requests found
......@@ -4,6 +4,7 @@
#include <antlr/NoViableAltException.hpp>
#include <antlr/MismatchedTokenException.hpp>
#include <antlr/TokenStreamRecognitionException.hpp>
namespace Wccl {
......@@ -190,6 +191,11 @@ boost::shared_ptr<ANTLRParserResultBase> Parser::parseAnyOperator(
<< "(as tset ) "
<< e.getFileLineColumnString()
<< " " << e.getMessage();
} catch(antlr::TokenStreamRecognitionException &e) {
errors << std::endl
<< "(as tset ) "
<< e.getLine() << ":" << e.getColumn()
<< " " << e.getMessage();
} catch (antlr::ANTLRException& e) {
errors << std::endl
<< "(as tset ) " << e.getMessage();
......@@ -213,6 +219,11 @@ boost::shared_ptr<ANTLRParserResultBase> Parser::parseAnyOperator(
<< "(as strset ) "
<< e.getFileLineColumnString()
<< " " << e.getMessage();
} catch(antlr::TokenStreamRecognitionException &e) {
errors << std::endl
<< "(as strset ) "
<< e.getLine() << ":" << e.getColumn()
<< " " << e.getMessage();
} catch (antlr::ANTLRException& e) {
errors << std::endl
<< "(as strset ) " << e.getMessage();
......@@ -236,6 +247,11 @@ boost::shared_ptr<ANTLRParserResultBase> Parser::parseAnyOperator(
<< "(as bool ) "
<< e.getFileLineColumnString()
<< " " << e.getMessage();
} catch(antlr::TokenStreamRecognitionException &e) {
errors << std::endl
<< "(as bool ) "
<< e.getLine() << ":" << e.getColumn()
<< " " << e.getMessage();
} catch (antlr::ANTLRException& e) {
errors << std::endl
<< "(as bool ) " << e.getMessage();
......@@ -254,6 +270,11 @@ boost::shared_ptr<ANTLRParserResultBase> Parser::parseAnyOperator(
<< "(as position) "
<< e.getFileLineColumnString()
<< " " << e.getMessage() << std::endl;
} catch(antlr::TokenStreamRecognitionException &e) {
errors << std::endl
<< "(as position) "
<< e.getLine() << ":" << e.getColumn()
<< " " << e.getMessage();
} catch(antlr::NoViableAltException &e) {
errors << std::endl
<< "(as position) "
......
......@@ -2,8 +2,10 @@
#include <libwccl/values/bool.h>
#include <libwccl/parser/Parser.h>
#include <libwccl/parser/ANTLRParserResult.h>
#include <antlr/NoViableAltException.hpp>
#include <antlr/MismatchedTokenException.hpp>
#include <antlr/TokenStreamRecognitionException.hpp>
// ----------------------------------------------------------------------------
......@@ -68,11 +70,15 @@ int main()
} catch(antlr::NoViableAltException &e) {
std::cerr << e.getFileLineColumnString()
<< " " << e.getMessage() << std::endl;
} catch(antlr::TokenStreamRecognitionException &e) {
std::cerr << e.getLine() << ":" << e.getColumn()
<< " " << e.getMessage() << std::endl;
} catch (Wccl::InvalidVariableName &e) {
std::cerr << "Wccl::InvalidVariableName" << std::endl;
} catch (Wccl::VariableTypeMismatch &e) {
std::cerr << "Wccl::VariableTypeMismatch" << std::endl;
} catch (...) {
}
catch (...) {
std::cerr << "[N] Syntax error!" << std::endl;
}
}
......
......@@ -4,6 +4,7 @@
#include <libwccl/parser/ANTLRParserResult.h>
#include <antlr/NoViableAltException.hpp>
#include <antlr/MismatchedTokenException.hpp>
#include <antlr/TokenStreamRecognitionException.hpp>
// ----------------------------------------------------------------------------
......@@ -67,6 +68,9 @@ int main()
} catch(antlr::NoViableAltException &e) {
std::cerr << e.getFileLineColumnString()
<< " " << e.getMessage() << std::endl;
} catch(antlr::TokenStreamRecognitionException &e) {
std::cerr << e.getLine() << ":" << e.getColumn()
<< " " << e.getMessage() << std::endl;
} catch (Wccl::InvalidVariableName &e) {
std::cerr << "Wccl::InvalidVariableName" << std::endl;
} catch (Wccl::VariableTypeMismatch &e) {
......
......@@ -4,6 +4,7 @@
#include <libwccl/parser/ANTLRParserResult.h>
#include <antlr/NoViableAltException.hpp>
#include <antlr/MismatchedTokenException.hpp>
#include <antlr/TokenStreamRecognitionException.hpp>
#include <libcorpus2/tagsetmanager.h>
......@@ -69,6 +70,9 @@ int main()
} catch(antlr::NoViableAltException &e) {
std::cerr << e.getFileLineColumnString()
<< " " << e.getMessage() << std::endl;
} catch(antlr::TokenStreamRecognitionException &e) {
std::cerr << e.getLine() << ":" << e.getColumn()
<< " " << e.getMessage() << std::endl;
} catch (Wccl::InvalidVariableName &e) {
std::cerr << "Wccl::InvalidVariableName" << std::endl;
} catch (Wccl::VariableTypeMismatch &e) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment