fix issues related to StringArray parsing

This commit is contained in:
Juan Linietsky 2016-01-08 21:09:13 -03:00
parent 176afb2feb
commit 292e8bf0ab

View file

@ -1189,7 +1189,7 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in
get_token(p_stream,token,line,r_err_str); get_token(p_stream,token,line,r_err_str);
if (token.type==TK_COMMA) { if (token.type==TK_COMMA) {
//do none //do none
} else if (token.type!=TK_PARENTHESIS_CLOSE) { } else if (token.type==TK_PARENTHESIS_CLOSE) {
break; break;
} else { } else {
r_err_str="Expected ',' or ')'"; r_err_str="Expected ',' or ')'";
@ -1198,11 +1198,13 @@ Error VariantParser::parse_value(Token& token,Variant &value,Stream *p_stream,in
} }
} }
get_token(p_stream,token,line,r_err_str); get_token(p_stream,token,line,r_err_str);
if (token.type!=TK_STRING) { if (token.type!=TK_STRING) {
r_err_str="Expected string"; r_err_str="Expected string";
return ERR_PARSE_ERROR; return ERR_PARSE_ERROR;
} }
first=false;
cs.push_back(token.value); cs.push_back(token.value);
} }
@ -2118,7 +2120,7 @@ Error VariantWriter::write(const Variant& p_variant, StoreStringFunc p_store_str
if (i>0) if (i>0)
p_store_string_func(p_store_string_ud,", "); p_store_string_func(p_store_string_ud,", ");
String str=ptr[i]; String str=ptr[i];
p_store_string_func(p_store_string_ud,""+str.c_escape()+"\""); p_store_string_func(p_store_string_ud,"\""+str.c_escape()+"\"");
} }
p_store_string_func(p_store_string_ud," )"); p_store_string_func(p_store_string_ud," )");