From a82776d980239e48d2b509d33b56e77a1ea44dda Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 5 Aug 2013 12:32:43 +0300 Subject: [PATCH] Move newline eating out of BinaryParser It's really a feature of the mode change logic, not the binary mode itself. --- source/binaryparser.cpp | 5 ----- source/binaryparser.h | 1 - source/parser.cpp | 3 +++ 3 files changed, 3 insertions(+), 6 deletions(-) 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") { -- 2.43.0