X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftextparser.cpp;h=0076c1b4bab954f8a893abf9f2e6a4ff7da5039a;hb=3b70a4d95e414f63fd39b4325d0f639c155a70f5;hp=d8e422ee7ff4d4d710a764a62383955f377305f5;hpb=cbd0ddd6ee033e46646bfb85d19232c816ea1eda;p=libs%2Fdatafile.git diff --git a/source/textparser.cpp b/source/textparser.cpp index d8e422e..0076c1b 100644 --- a/source/textparser.cpp +++ b/source/textparser.cpp @@ -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(token.str)); else if(token.type==Token::FLOAT) - result.args.push_back(Value(FLOAT, token.str)); + result.append(lexical_cast(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()); @@ -122,7 +121,7 @@ Token TextParser::parse_token() comment = 3; else if(comment==3) // Skip the second character of block comment end comment = 0; - else if(!isspace(c) && !comment) + else if(c!=-1 && !isspace(c) && !comment) comment = -1; }