Parse negative integers

This commit is contained in:
Bruce Hill 2024-12-15 16:53:07 -05:00
parent 5c15238e2f
commit 0caf96cfe7

View File

@ -380,8 +380,9 @@ static int64_t match_id(TextIter_t *state, int64_t index)
static int64_t match_int(TextIter_t *state, int64_t index)
{
int64_t negative = EAT1(state, index, grapheme == '-') ? 1 : 0;
int64_t len = EAT_MANY(state, index, uc_is_property((ucs4_t)grapheme, UC_PROPERTY_DECIMAL_DIGIT));
return len > 0 ? len : -1;
return len > 0 ? negative + len : -1;
}
static int64_t match_alphanumeric(TextIter_t *state, int64_t index)