[deserialize] One more fix

This commit is contained in:
Behdad Esfahbod 2023-01-25 14:09:22 -07:00
parent e973050986
commit 57ff696430
2 changed files with 81 additions and 59 deletions

View File

@ -34,18 +34,18 @@
#line 33 "hb-buffer-deserialize-text-unicode.hh" #line 33 "hb-buffer-deserialize-text-unicode.hh"
static const unsigned char _deserialize_text_unicode_trans_keys[] = { static const unsigned char _deserialize_text_unicode_trans_keys[] = {
0u, 0u, 9u, 117u, 43u, 102u, 48u, 102u, 9u, 124u, 9u, 124u, 48u, 57u, 9u, 124u, 0u, 0u, 9u, 117u, 43u, 102u, 48u, 102u, 48u, 57u, 9u, 124u, 9u, 124u, 9u, 124u,
9u, 124u, 0u, 0u, 9u, 117u, 0 9u, 124u, 0
}; };
static const char _deserialize_text_unicode_key_spans[] = { static const char _deserialize_text_unicode_key_spans[] = {
0, 109, 60, 55, 116, 116, 10, 116, 0, 109, 60, 55, 10, 116, 116, 116,
116, 0, 109 116
}; };
static const short _deserialize_text_unicode_index_offsets[] = { static const short _deserialize_text_unicode_index_offsets[] = {
0, 0, 110, 171, 227, 344, 461, 472, 0, 0, 110, 171, 227, 238, 355, 472,
589, 706, 707 589
}; };
static const char _deserialize_text_unicode_indicies[] = { static const char _deserialize_text_unicode_indicies[] = {
@ -77,28 +77,26 @@ static const char _deserialize_text_unicode_indicies[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 4, 4, 4, 1, 1, 1, 1, 1, 4, 4, 4,
4, 4, 4, 1, 5, 5, 5, 5, 4, 4, 4, 1, 5, 6, 6, 6,
5, 1, 1, 1, 1, 1, 1, 1, 6, 6, 6, 6, 6, 6, 1, 7,
7, 7, 7, 7, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 5, 1, 1, 1, 1, 1, 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, 1, 1, 18, 18, 18, 1, 1, 1, 1, 1, 1, 1, 1,
18, 18, 18, 18, 18, 18, 18, 1, 1, 1, 1, 1, 13, 1, 12, 12,
1, 1, 1, 16, 1, 1, 1, 1, 12, 12, 12, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 12, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 14, 14, 14,
14, 14, 14, 14, 14, 14, 14, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@ -137,37 +136,27 @@ static const char _deserialize_text_unicode_indicies[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 17, 1, 1, 0, 0, 0, 0,
0, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 0, 1, 1, 1, 1, 1, 13, 1, 0
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
2, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,
2, 1, 0
}; };
static const char _deserialize_text_unicode_trans_targs[] = { static const char _deserialize_text_unicode_trans_targs[] = {
1, 0, 2, 3, 4, 5, 4, 6, 1, 0, 2, 3, 5, 7, 8, 6,
9, 10, 5, 9, 10, 7, 8, 5, 5, 4, 1, 6, 6, 1, 8
9, 10, 8
}; };
static const char _deserialize_text_unicode_trans_actions[] = { static const char _deserialize_text_unicode_trans_actions[] = {
0, 0, 1, 0, 2, 3, 0, 4, 0, 0, 1, 0, 2, 2, 2, 3,
3, 3, 0, 0, 0, 2, 2, 5, 0, 4, 3, 0, 5, 5, 0
5, 5, 0 };
static const char _deserialize_text_unicode_eof_actions[] = {
0, 0, 0, 0, 0, 3, 0, 5,
5
}; };
static const int deserialize_text_unicode_start = 1; static const int deserialize_text_unicode_start = 1;
static const int deserialize_text_unicode_first_final = 9; static const int deserialize_text_unicode_first_final = 5;
static const int deserialize_text_unicode_error = 0; static const int deserialize_text_unicode_error = 0;
static const int deserialize_text_unicode_en_main = 1; static const int deserialize_text_unicode_en_main = 1;
@ -190,7 +179,7 @@ _hb_buffer_deserialize_text_unicode (hb_buffer_t *buffer,
if (p < pe && *p == (buffer->len ? '|' : '<')) if (p < pe && *p == (buffer->len ? '|' : '<'))
*end_ptr = ++p; *end_ptr = ++p;
const char *end = strchr ((char *) p, ']'); const char *end = strchr ((char *) p, '>');
if (end) if (end)
pe = eof = end; pe = eof = end;
else else
@ -208,12 +197,12 @@ _hb_buffer_deserialize_text_unicode (hb_buffer_t *buffer,
hb_glyph_info_t info = {0}; hb_glyph_info_t info = {0};
const hb_glyph_position_t pos = {0}; const hb_glyph_position_t pos = {0};
#line 205 "hb-buffer-deserialize-text-unicode.hh" #line 194 "hb-buffer-deserialize-text-unicode.hh"
{ {
cs = deserialize_text_unicode_start; cs = deserialize_text_unicode_start;
} }
#line 208 "hb-buffer-deserialize-text-unicode.hh" #line 197 "hb-buffer-deserialize-text-unicode.hh"
{ {
int _slen; int _slen;
int _trans; int _trans;
@ -280,7 +269,7 @@ _resume:
*end_ptr = p; *end_ptr = p;
} }
break; break;
#line 267 "hb-buffer-deserialize-text-unicode.hh" #line 256 "hb-buffer-deserialize-text-unicode.hh"
} }
_again: _again:
@ -289,6 +278,39 @@ _again:
if ( ++p != pe ) if ( ++p != pe )
goto _resume; goto _resume;
_test_eof: {} _test_eof: {}
if ( p == eof )
{
switch ( _deserialize_text_unicode_eof_actions[cs] ) {
case 3:
#line 55 "hb-buffer-deserialize-text-unicode.rl"
{if (!parse_hex (tok, p, &info.codepoint )) return false; }
#line 42 "hb-buffer-deserialize-text-unicode.rl"
{
buffer->add_info (info);
if (unlikely (!buffer->successful))
return false;
if (buffer->have_positions)
buffer->pos[buffer->len - 1] = pos;
*end_ptr = p;
}
break;
case 5:
#line 57 "hb-buffer-deserialize-text-unicode.rl"
{ if (!parse_uint (tok, p, &info.cluster )) return false; }
#line 42 "hb-buffer-deserialize-text-unicode.rl"
{
buffer->add_info (info);
if (unlikely (!buffer->successful))
return false;
if (buffer->have_positions)
buffer->pos[buffer->len - 1] = pos;
*end_ptr = p;
}
break;
#line 289 "hb-buffer-deserialize-text-unicode.hh"
}
}
_out: {} _out: {}
} }

View File

@ -72,7 +72,7 @@ unicode_item =
%add_item %add_item
; ;
unicodes = unicode_item (space* '|' space* unicode_item)* space* ('|'|'>'); unicodes = unicode_item (space* '|' space* unicode_item)* space*;
main := space* unicodes; main := space* unicodes;
@ -92,7 +92,7 @@ _hb_buffer_deserialize_text_unicode (hb_buffer_t *buffer,
if (p < pe && *p == (buffer->len ? '|' : '<')) if (p < pe && *p == (buffer->len ? '|' : '<'))
*end_ptr = ++p; *end_ptr = ++p;
const char *end = strchr ((char *) p, ']'); const char *end = strchr ((char *) p, '>');
if (end) if (end)
pe = eof = end; pe = eof = end;
else else