]> git.tdb.fi Git - libs/datafile.git/commitdiff
Move newline eating out of BinaryParser
authorMikko Rasa <tdb@tdb.fi>
Mon, 5 Aug 2013 09:32:43 +0000 (12:32 +0300)
committerMikko Rasa <tdb@tdb.fi>
Mon, 5 Aug 2013 11:57:46 +0000 (14:57 +0300)
It's really a feature of the mode change logic, not the binary mode
itself.

source/binaryparser.cpp
source/binaryparser.h
source/parser.cpp

index 25edd63a15060d96bb5bcc95775cc3241dc9ce36..098a5fd4f96c936cad7aae6bfba31b0627c357ef 100644 (file)
@@ -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();
index 6a46639cbbca7667873f5c5a68d30f8151e62dfa..255209a971bed7fdd5e7149e7a9dd20a8fb30cd4 100644 (file)
@@ -19,7 +19,6 @@ private:
 
        Dictionary dict;
        StringMap strings;
-       bool first;
        unsigned float_precision;
 
 public:
index 6166e561a984a0d99878f313199003fac095039b..d298eca44765ca134ae8b65f191c31296830ca92 100644 (file)
@@ -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")
        {