3 This file is part of libmspdatafile
4 Copyright © 2006 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
7 #include <msp/strings/formatter.h>
8 #include "binaryparser.h"
10 #include "statement.h"
11 #include "textparser.h"
18 Parser::Parser(IO::Base &i, const string &s):
23 mode(new TextParser(in, src))
31 Statement Parser::parse()
34 throw Exception("Parser is not good");
40 Statement st=mode->parse();
41 if(st.keyword=="__bin")
44 mode=new BinaryParser(in, src);
46 else if(st.keyword=="__text")
49 mode=new TextParser(in, src);
51 else if(st.keyword=="__src")
53 string s=st.args[0].get<string>();
57 src=format("%s[%s]", main_src, s);
63 catch(const Exception &e)
70 } // namespace DataFile