|
@@ -278,7 +278,7 @@ Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, Stri
|
|
char32_t ch = p_stream->get_char();
|
|
char32_t ch = p_stream->get_char();
|
|
|
|
|
|
if (ch == 0) {
|
|
if (ch == 0) {
|
|
- r_err_str = "Unterminated String";
|
|
|
|
|
|
+ r_err_str = "Unterminated string";
|
|
r_token.type = TK_ERROR;
|
|
r_token.type = TK_ERROR;
|
|
return ERR_PARSE_ERROR;
|
|
return ERR_PARSE_ERROR;
|
|
} else if (ch == '"') {
|
|
} else if (ch == '"') {
|
|
@@ -287,7 +287,7 @@ Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, Stri
|
|
//escaped characters...
|
|
//escaped characters...
|
|
char32_t next = p_stream->get_char();
|
|
char32_t next = p_stream->get_char();
|
|
if (next == 0) {
|
|
if (next == 0) {
|
|
- r_err_str = "Unterminated String";
|
|
|
|
|
|
+ r_err_str = "Unterminated string";
|
|
r_token.type = TK_ERROR;
|
|
r_token.type = TK_ERROR;
|
|
return ERR_PARSE_ERROR;
|
|
return ERR_PARSE_ERROR;
|
|
}
|
|
}
|
|
@@ -317,7 +317,7 @@ Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, Stri
|
|
char32_t c = p_stream->get_char();
|
|
char32_t c = p_stream->get_char();
|
|
|
|
|
|
if (c == 0) {
|
|
if (c == 0) {
|
|
- r_err_str = "Unterminated String";
|
|
|
|
|
|
+ r_err_str = "Unterminated string";
|
|
r_token.type = TK_ERROR;
|
|
r_token.type = TK_ERROR;
|
|
return ERR_PARSE_ERROR;
|
|
return ERR_PARSE_ERROR;
|
|
}
|
|
}
|
|
@@ -504,7 +504,7 @@ Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, Stri
|
|
r_token.value = id.as_string();
|
|
r_token.value = id.as_string();
|
|
return OK;
|
|
return OK;
|
|
} else {
|
|
} else {
|
|
- r_err_str = "Unexpected character.";
|
|
|
|
|
|
+ r_err_str = "Unexpected character";
|
|
r_token.type = TK_ERROR;
|
|
r_token.type = TK_ERROR;
|
|
return ERR_PARSE_ERROR;
|
|
return ERR_PARSE_ERROR;
|
|
}
|
|
}
|
|
@@ -512,6 +512,7 @@ Error VariantParser::get_token(Stream *p_stream, Token &r_token, int &line, Stri
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ r_err_str = "Unknown error getting token";
|
|
r_token.type = TK_ERROR;
|
|
r_token.type = TK_ERROR;
|
|
return ERR_PARSE_ERROR;
|
|
return ERR_PARSE_ERROR;
|
|
}
|
|
}
|
|
@@ -1007,7 +1008,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
|
|
Object *obj = ClassDB::instantiate(type);
|
|
Object *obj = ClassDB::instantiate(type);
|
|
|
|
|
|
if (!obj) {
|
|
if (!obj) {
|
|
- r_err_str = "Can't instantiate Object() of type: " + type;
|
|
|
|
|
|
+ r_err_str = vformat("Can't instantiate Object() of type '%s'", type);
|
|
return ERR_PARSE_ERROR;
|
|
return ERR_PARSE_ERROR;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1025,7 +1026,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
|
|
|
|
|
|
while (true) {
|
|
while (true) {
|
|
if (p_stream->is_eof()) {
|
|
if (p_stream->is_eof()) {
|
|
- r_err_str = "Unexpected End of File while parsing Object()";
|
|
|
|
|
|
+ r_err_str = "Unexpected EOF while parsing Object()";
|
|
return ERR_FILE_CORRUPT;
|
|
return ERR_FILE_CORRUPT;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1123,7 +1124,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
|
|
String path = token.value;
|
|
String path = token.value;
|
|
Ref<Resource> res = ResourceLoader::load(path);
|
|
Ref<Resource> res = ResourceLoader::load(path);
|
|
if (res.is_null()) {
|
|
if (res.is_null()) {
|
|
- r_err_str = "Can't load resource at path: '" + path + "'.";
|
|
|
|
|
|
+ r_err_str = "Can't load resource at path: " + path;
|
|
return ERR_PARSE_ERROR;
|
|
return ERR_PARSE_ERROR;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1135,7 +1136,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
|
|
|
|
|
|
value = res;
|
|
value = res;
|
|
} else {
|
|
} else {
|
|
- r_err_str = "Expected string as argument for Resource().";
|
|
|
|
|
|
+ r_err_str = "Expected string as argument for Resource()";
|
|
return ERR_PARSE_ERROR;
|
|
return ERR_PARSE_ERROR;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1571,7 +1572,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
|
|
|
|
|
|
value = arr;
|
|
value = arr;
|
|
} else {
|
|
} else {
|
|
- r_err_str = "Unexpected identifier: '" + id + "'.";
|
|
|
|
|
|
+ r_err_str = vformat("Unexpected identifier '%s'", id);
|
|
return ERR_PARSE_ERROR;
|
|
return ERR_PARSE_ERROR;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1590,7 +1591,7 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
|
|
value = token.value;
|
|
value = token.value;
|
|
return OK;
|
|
return OK;
|
|
} else {
|
|
} else {
|
|
- r_err_str = "Expected value, got " + String(tk_name[token.type]) + ".";
|
|
|
|
|
|
+ r_err_str = vformat("Expected value, got '%s'", String(tk_name[token.type]));
|
|
return ERR_PARSE_ERROR;
|
|
return ERR_PARSE_ERROR;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1601,7 +1602,7 @@ Error VariantParser::_parse_array(Array &array, Stream *p_stream, int &line, Str
|
|
|
|
|
|
while (true) {
|
|
while (true) {
|
|
if (p_stream->is_eof()) {
|
|
if (p_stream->is_eof()) {
|
|
- r_err_str = "Unexpected End of File while parsing array";
|
|
|
|
|
|
+ r_err_str = "Unexpected EOF while parsing array";
|
|
return ERR_FILE_CORRUPT;
|
|
return ERR_FILE_CORRUPT;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1643,7 +1644,7 @@ Error VariantParser::_parse_dictionary(Dictionary &object, Stream *p_stream, int
|
|
|
|
|
|
while (true) {
|
|
while (true) {
|
|
if (p_stream->is_eof()) {
|
|
if (p_stream->is_eof()) {
|
|
- r_err_str = "Unexpected End of File while parsing dictionary";
|
|
|
|
|
|
+ r_err_str = "Unexpected EOF while parsing dictionary";
|
|
return ERR_FILE_CORRUPT;
|
|
return ERR_FILE_CORRUPT;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1775,7 +1776,7 @@ Error VariantParser::_parse_tag(Token &token, Stream *p_stream, int &line, Strin
|
|
|
|
|
|
while (true) {
|
|
while (true) {
|
|
if (p_stream->is_eof()) {
|
|
if (p_stream->is_eof()) {
|
|
- r_err_str = "Unexpected End of File while parsing tag: " + r_tag.name;
|
|
|
|
|
|
+ r_err_str = vformat("Unexpected EOF while parsing tag '%s'", r_tag.name);
|
|
return ERR_FILE_CORRUPT;
|
|
return ERR_FILE_CORRUPT;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1795,7 +1796,7 @@ Error VariantParser::_parse_tag(Token &token, Stream *p_stream, int &line, Strin
|
|
}
|
|
}
|
|
|
|
|
|
if (token.type != TK_IDENTIFIER) {
|
|
if (token.type != TK_IDENTIFIER) {
|
|
- r_err_str = "Expected Identifier";
|
|
|
|
|
|
+ r_err_str = "Expected identifier";
|
|
return ERR_PARSE_ERROR;
|
|
return ERR_PARSE_ERROR;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1808,6 +1809,7 @@ Error VariantParser::_parse_tag(Token &token, Stream *p_stream, int &line, Strin
|
|
|
|
|
|
get_token(p_stream, token, line, r_err_str);
|
|
get_token(p_stream, token, line, r_err_str);
|
|
if (token.type != TK_EQUAL) {
|
|
if (token.type != TK_EQUAL) {
|
|
|
|
+ r_err_str = "Expected '=' after identifier";
|
|
return ERR_PARSE_ERROR;
|
|
return ERR_PARSE_ERROR;
|
|
}
|
|
}
|
|
|
|
|