From: Mikko Rasa Date: Mon, 5 Aug 2013 09:32:43 +0000 (+0300) Subject: Move newline eating out of BinaryParser X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=a82776d980239e48d2b509d33b56e77a1ea44dda;p=libs%2Fdatafile.git Move newline eating out of BinaryParser It's really a feature of the mode change logic, not the binary mode itself. --- diff --git a/source/binaryparser.cpp b/source/binaryparser.cpp index 25edd63..098a5fd 100644 --- a/source/binaryparser.cpp +++ b/source/binaryparser.cpp @@ -24,7 +24,6 @@ public: BinaryParser::BinaryParser(Input &i, const string &s): ParserMode(i, s), - first(true), float_precision(32) { dict[-1] = StatementKey("__kwd", "iss"); @@ -34,10 +33,6 @@ BinaryParser::BinaryParser(Input &i, const string &s): Statement BinaryParser::parse() { - while(first && in.peek()=='\n') - in.get(); - first = false; - int id = parse_int(); if(!in) return Statement(); diff --git a/source/binaryparser.h b/source/binaryparser.h index 6a46639..255209a 100644 --- a/source/binaryparser.h +++ b/source/binaryparser.h @@ -19,7 +19,6 @@ private: Dictionary dict; StringMap strings; - bool first; unsigned float_precision; public: diff --git a/source/parser.cpp b/source/parser.cpp index 6166e56..d298eca 100644 --- a/source/parser.cpp +++ b/source/parser.cpp @@ -61,6 +61,9 @@ void Parser::process_control_statement(const Statement &st) { delete mode; mode = new BinaryParser(in, src); + + while(in.peek()=='\n') + in.get(); } else if(st.keyword=="__text") {