Merge pull request #50177 from bruvzg/fix_variant_tags
Fix Variant tags parsing.
This commit is contained in:
commit
26b86c1074
1 changed files with 24 additions and 8 deletions
|
@ -1204,16 +1204,32 @@ Error VariantParser::_parse_tag(Token &token, Stream *p_stream, int &line, Strin
|
|||
r_tag.name = "";
|
||||
r_tag.fields.clear();
|
||||
|
||||
while (true) {
|
||||
char32_t c = p_stream->get_char();
|
||||
if (p_stream->is_eof()) {
|
||||
r_err_str = "Unexpected EOF while parsing simple tag";
|
||||
return ERR_PARSE_ERROR;
|
||||
if (p_stream->is_utf8()) {
|
||||
CharString cs;
|
||||
while (true) {
|
||||
char c = p_stream->get_char();
|
||||
if (p_stream->is_eof()) {
|
||||
r_err_str = "Unexpected EOF while parsing simple tag";
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
if (c == ']') {
|
||||
break;
|
||||
}
|
||||
cs += c;
|
||||
}
|
||||
if (c == ']') {
|
||||
break;
|
||||
r_tag.name.parse_utf8(cs.get_data(), cs.length());
|
||||
} else {
|
||||
while (true) {
|
||||
char32_t c = p_stream->get_char();
|
||||
if (p_stream->is_eof()) {
|
||||
r_err_str = "Unexpected EOF while parsing simple tag";
|
||||
return ERR_PARSE_ERROR;
|
||||
}
|
||||
if (c == ']') {
|
||||
break;
|
||||
}
|
||||
r_tag.name += String::chr(c);
|
||||
}
|
||||
r_tag.name += String::chr(c);
|
||||
}
|
||||
|
||||
r_tag.name = r_tag.name.strip_edges();
|
||||
|
|
Loading…
Reference in a new issue