|
@@ -911,8 +911,8 @@ Tokenizer_really_parse_entity(Tokenizer* self) |
|
|
{ |
|
|
{ |
|
|
PyObject *token, *kwargs, *textobj; |
|
|
PyObject *token, *kwargs, *textobj; |
|
|
Py_UNICODE this; |
|
|
Py_UNICODE this; |
|
|
int numeric, hexadecimal, i, j, test; |
|
|
|
|
|
char *valid, *text, *def; |
|
|
|
|
|
|
|
|
int numeric, hexadecimal, i, j, zeroes, test; |
|
|
|
|
|
char *valid, *text, *buffer, *def; |
|
|
|
|
|
|
|
|
#define FAIL_ROUTE_AND_EXIT() { \ |
|
|
#define FAIL_ROUTE_AND_EXIT() { \ |
|
|
Tokenizer_fail_route(self); \ |
|
|
Tokenizer_fail_route(self); \ |
|
@@ -984,6 +984,7 @@ Tokenizer_really_parse_entity(Tokenizer* self) |
|
|
return -1; |
|
|
return -1; |
|
|
} |
|
|
} |
|
|
i = 0; |
|
|
i = 0; |
|
|
|
|
|
zeroes = 0; |
|
|
while (1) { |
|
|
while (1) { |
|
|
this = Tokenizer_READ(self, 0); |
|
|
this = Tokenizer_READ(self, 0); |
|
|
if (this == *";") { |
|
|
if (this == *";") { |
|
@@ -992,6 +993,7 @@ Tokenizer_really_parse_entity(Tokenizer* self) |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
if (i == 0 && this == *"0") { |
|
|
if (i == 0 && this == *"0") { |
|
|
|
|
|
zeroes++; |
|
|
self->head++; |
|
|
self->head++; |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
@@ -1029,6 +1031,19 @@ Tokenizer_really_parse_entity(Tokenizer* self) |
|
|
i++; |
|
|
i++; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
if (zeroes) { |
|
|
|
|
|
buffer = calloc(strlen(text) + zeroes + 1, sizeof(char)); |
|
|
|
|
|
if (!buffer) { |
|
|
|
|
|
free(text); |
|
|
|
|
|
PyErr_NoMemory(); |
|
|
|
|
|
return -1; |
|
|
|
|
|
} |
|
|
|
|
|
for (i = 0; i < zeroes; i++) |
|
|
|
|
|
strcat(buffer, "0"); |
|
|
|
|
|
strcat(buffer, text); |
|
|
|
|
|
free(text); |
|
|
|
|
|
text = buffer; |
|
|
|
|
|
} |
|
|
textobj = PyUnicode_FromString(text); |
|
|
textobj = PyUnicode_FromString(text); |
|
|
if (!textobj) { |
|
|
if (!textobj) { |
|
|
free(text); |
|
|
free(text); |
|
|