From dadcfcedd9f163a4bb2debd18a777710492e4826 Mon Sep 17 00:00:00 2001
From: Adam Wardynski <award@.(win7-laptop)>
Date: Sun, 28 Nov 2010 04:12:19 +0100
Subject: [PATCH] Clear stream of errors for reparsing.

---
 libwccl/parser/Parser.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libwccl/parser/Parser.cpp b/libwccl/parser/Parser.cpp
index 1cc17fa..c314933 100644
--- a/libwccl/parser/Parser.cpp
+++ b/libwccl/parser/Parser.cpp
@@ -137,7 +137,7 @@ boost::shared_ptr<ANTLRParserResultBase> Parser::parseAnyOperator(
 {
 	boost::shared_ptr<ANTLRParserResultBase> result;
 	if (!result) {
-		istr.seekg(0, std::ios::beg);
+		istr.seekg(0);
 		ANTLRLexer lexer(istr);
 		ANTLRParser parser(lexer);
 		try {
@@ -147,7 +147,8 @@ boost::shared_ptr<ANTLRParserResultBase> Parser::parseAnyOperator(
 		}
 	}
 	if (!result) {
-		istr.seekg(0, std::ios::beg);
+		istr.clear();
+		istr.seekg(0);
 		ANTLRLexer lexer(istr);
 		ANTLRParser parser(lexer);
 		try {
@@ -157,7 +158,8 @@ boost::shared_ptr<ANTLRParserResultBase> Parser::parseAnyOperator(
 		}
 	}
 	if (!result) {
-		istr.seekg(0, std::ios::beg);
+		istr.clear();
+		istr.seekg(0);
 		ANTLRLexer lexer(istr);
 		ANTLRParser parser(lexer);
 		try {
-- 
GitLab