From 28bb743576af66e3f0da256bcecf67e58a9d3ebd Mon Sep 17 00:00:00 2001 From: ilor <kailoran@gmail.com> Date: Thu, 25 Nov 2010 16:34:31 +0100 Subject: [PATCH] fix Parser::parseAnyOperator silently ignoring errors --- libwccl/parser/Parser.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/libwccl/parser/Parser.cpp b/libwccl/parser/Parser.cpp index 6f69c9b..1cc17fa 100644 --- a/libwccl/parser/Parser.cpp +++ b/libwccl/parser/Parser.cpp @@ -135,11 +135,11 @@ boost::shared_ptr<ANTLRParserResultBase> Parser::parseAnyOperator( boost::shared_ptr<ANTLRParserResultBase> Parser::parseAnyOperator( std::istream& istr) const { - ANTLRLexer lexer(istr); - ANTLRParser parser(lexer); - boost::shared_ptr<ANTLRParserResultBase> result; if (!result) { + istr.seekg(0, std::ios::beg); + ANTLRLexer lexer(istr); + ANTLRParser parser(lexer); try { result = parser.parse_sym_set_operator(this->tagset); } catch (antlr::ANTLRException) { @@ -147,6 +147,9 @@ boost::shared_ptr<ANTLRParserResultBase> Parser::parseAnyOperator( } } if (!result) { + istr.seekg(0, std::ios::beg); + ANTLRLexer lexer(istr); + ANTLRParser parser(lexer); try { result = parser.parse_string_operator(this->tagset); } catch (antlr::ANTLRException) { @@ -154,6 +157,9 @@ boost::shared_ptr<ANTLRParserResultBase> Parser::parseAnyOperator( } } if (!result) { + istr.seekg(0, std::ios::beg); + ANTLRLexer lexer(istr); + ANTLRParser parser(lexer); try { result = parser.parse_predicates(this->tagset); } catch (antlr::ANTLRException) { -- GitLab