]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/parser.cpp
Type checking in value conversions
[libs/datafile.git] / source / parser.cpp
index ef2daa3e0ab8bd5dbb75ce8696a64c789c8417ab..c9ad188868a0bed69087879472b2741b67e07f46 100644 (file)
@@ -1,6 +1,6 @@
 /*
 This file is part of libmspparser
-Copyright © 2006 Mikko Rasa, Mikkosoft Productions
+Copyright © 2006  Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 #include <cctype>
@@ -96,6 +96,12 @@ Statement Parser::parse_(const Token *t)
                        result.args.push_back(Value(Value::STRING, token.str));
                else if(token.type==Token::IDENTIFIER)
                {
+                       if(token.str=="true")
+                               result.args.push_back(Value(Value::BOOLEAN, "1"));
+                       else if(token.str=="false")
+                               result.args.push_back(Value(Value::BOOLEAN, "0"));
+                       else
+                               result.args.push_back(Value(Value::ENUM, token.str));
                        //result.args.push_back(resolve_identifiertoken.str);
                }
                else if(token.str=="")