[buffer-deserialize-text] Accept initial comma

This commit is contained in:
Behdad Esfahbod 2023-01-23 20:53:17 -07:00
parent 2c29b81e7f
commit 4268283e54
4 changed files with 10 additions and 10 deletions

View File

@ -548,21 +548,19 @@ _hb_buffer_deserialize_json (hb_buffer_t *buffer,
while (p < pe && ISSPACE (*p)) while (p < pe && ISSPACE (*p))
p++; p++;
if (p < pe && *p == (buffer->len ? ',' : '[')) if (p < pe && *p == (buffer->len ? ',' : '['))
{
*end_ptr = ++p; *end_ptr = ++p;
}
const char *tok = nullptr; const char *tok = nullptr;
int cs; int cs;
hb_glyph_info_t info = {0}; hb_glyph_info_t info = {0};
hb_glyph_position_t pos = {0}; hb_glyph_position_t pos = {0};
#line 554 "hb-buffer-deserialize-json.hh" #line 552 "hb-buffer-deserialize-json.hh"
{ {
cs = deserialize_json_start; cs = deserialize_json_start;
} }
#line 557 "hb-buffer-deserialize-json.hh" #line 555 "hb-buffer-deserialize-json.hh"
{ {
int _slen; int _slen;
int _trans; int _trans;
@ -774,7 +772,7 @@ _resume:
*end_ptr = p; *end_ptr = p;
} }
break; break;
#line 735 "hb-buffer-deserialize-json.hh" #line 733 "hb-buffer-deserialize-json.hh"
} }
_again: _again:
@ -786,7 +784,7 @@ _again:
_out: {} _out: {}
} }
#line 139 "hb-buffer-deserialize-json.rl" #line 137 "hb-buffer-deserialize-json.rl"
*end_ptr = p; *end_ptr = p;

View File

@ -125,9 +125,7 @@ _hb_buffer_deserialize_json (hb_buffer_t *buffer,
while (p < pe && ISSPACE (*p)) while (p < pe && ISSPACE (*p))
p++; p++;
if (p < pe && *p == (buffer->len ? ',' : '[')) if (p < pe && *p == (buffer->len ? ',' : '['))
{
*end_ptr = ++p; *end_ptr = ++p;
}
const char *tok = nullptr; const char *tok = nullptr;
int cs; int cs;

View File

@ -93,7 +93,7 @@ glyph_item =
glyphs = glyph_item (space* '|' space* glyph_item)* space* ('|'|']'); glyphs = glyph_item (space* '|' space* glyph_item)* space* ('|'|']');
main := space* '[' glyphs; main := space* glyphs;
}%% }%%
@ -111,6 +111,8 @@ _hb_buffer_deserialize_text_glyphs (hb_buffer_t *buffer,
while (p < pe && ISSPACE (*p)) while (p < pe && ISSPACE (*p))
p++; p++;
if (p < pe && *p == (buffer->len ? ',' : '['))
*end_ptr = ++p;
const char *tok = nullptr; const char *tok = nullptr;
int cs; int cs;

View File

@ -75,7 +75,7 @@ unicode_item =
unicodes = unicode_item (space* '|' space* unicode_item)* space* ('|'|'>'); unicodes = unicode_item (space* '|' space* unicode_item)* space* ('|'|'>');
main := space* '<' unicodes; main := space* unicodes;
}%% }%%
@ -90,6 +90,8 @@ _hb_buffer_deserialize_text_unicodes (hb_buffer_t *buffer,
while (p < pe && ISSPACE (*p)) while (p < pe && ISSPACE (*p))
p++; p++;
if (p < pe && *p == (buffer->len ? ',' : '<'))
*end_ptr = ++p;
const char *tok = nullptr; const char *tok = nullptr;
int cs; int cs;