]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/textparser.cpp
Rewrite the type system
[libs/datafile.git] / source / textparser.cpp
index d8e422ee7ff4d4d710a764a62383955f377305f5..8bcde35802108ba2f16c32584e6ace17b1e33ee9 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
 
 This file is part of libmspdatafile
-Copyright © 2007-2008  Mikko Rasa, Mikkosoft Productions
+Copyright © 2007-2008, 2010  Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 
@@ -77,20 +77,19 @@ Statement TextParser::parse_statement(const Token *t)
                else if(token.str==";")
                        break;
                else if(token.type==Token::INTEGER)
-                       result.args.push_back(Value(INTEGER, token.str));
+                       result.append(lexical_cast<IntType::Store>(token.str));
                else if(token.type==Token::FLOAT)
-                       result.args.push_back(Value(FLOAT, token.str));
+                       result.append(lexical_cast<FloatType::Store>(token.str));
                else if(token.type==Token::STRING)
-                       result.args.push_back(Value(STRING, token.str));
+                       result.append(token.str);
                else if(token.type==Token::IDENTIFIER)
                {
                        if(token.str=="true")
-                               result.args.push_back(Value(BOOLEAN, "1"));
+                               result.append(true);
                        else if(token.str=="false")
-                               result.args.push_back(Value(BOOLEAN, "0"));
+                               result.append(false);
                        else
-                               result.args.push_back(Value(ENUM, token.str));
-                       //result.args.push_back(resolve_identifiertoken.str);
+                               result.append(Symbol(token.str));
                }
                else if(token.str=="")
                        throw_at(ParseError("Unexcepted end of input"), get_location());