]> git.tdb.fi Git - libs/datafile.git/blobdiff - source/parser.cpp
Output characters and not ASCII codes in parse_error
[libs/datafile.git] / source / parser.cpp
index ef2daa3e0ab8bd5dbb75ce8696a64c789c8417ab..7b9af11d60ca292a860ae346cebcb813220e5469 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=="")
@@ -335,7 +341,7 @@ string Parser::get_location()
 void Parser::parse_error(int c, int state)
 {
        ostringstream ss;
-       ss<<get_location()<<": Parse error at '"<<c<<"' (state "<<state<<')';
+       ss<<get_location()<<": Parse error at '"<<(char)c<<"' (state "<<state<<')';
        throw DataError(ss.str());
 }