Skip past N_INTEGER

This commit is contained in:
2025-05-22 12:15:50 -04:00
parent 3afa3b6e9a
commit af07cdc8be

View File

@@ -29,7 +29,6 @@ enum Symbol : uint8_t {
N_STRING,
N_STRING2,
N_STRING_FOLLOWING_ESCAPE,
N_INTEGER,
N_INTEGER2,
N_DIGITS,
N_DIGITS2,
@@ -185,6 +184,14 @@ inline WeaselJsonStatus n_value(Parser3 *self) {
}
break;
case '0':
self->pop();
if (auto s = self->push({N_FRACTION, N_EXPONENT, T_END_NUMBER})) {
return s;
}
self->callbacks->on_begin_number(self->data);
self->dataBegin = self->buf;
++self->buf;
MUSTTAIL return Parser3::keepGoing(self);
case '1':
case '2':
case '3':
@@ -194,13 +201,25 @@ inline WeaselJsonStatus n_value(Parser3 *self) {
case '7':
case '8':
case '9':
case '-':
self->pop();
self->callbacks->on_begin_number(self->data);
self->dataBegin = self->buf;
++self->buf;
if (auto s =
self->push({N_INTEGER, N_FRACTION, N_EXPONENT, T_END_NUMBER})) {
self->push({N_DIGITS2, N_FRACTION, N_EXPONENT, T_END_NUMBER})) {
return s;
}
break;
MUSTTAIL return Parser3::keepGoing(self);
case '-':
self->pop();
self->callbacks->on_begin_number(self->data);
self->dataBegin = self->buf;
++self->buf;
if (auto s =
self->push({N_INTEGER2, N_FRACTION, N_EXPONENT, T_END_NUMBER})) {
return s;
}
MUSTTAIL return Parser3::keepGoing(self);
case 't':
++self->buf;
self->pop();
@@ -879,7 +898,6 @@ constexpr inline struct ContinuationTable {
continuations[N_STRING] = n_string;
continuations[N_STRING2] = n_string2;
continuations[N_STRING_FOLLOWING_ESCAPE] = n_string_following_escape;
continuations[N_INTEGER] = n_integer;
continuations[N_INTEGER2] = n_integer2;
continuations[N_DIGITS] = n_digits;
continuations[N_DIGITS2] = n_digits2;
@@ -917,7 +935,6 @@ constexpr inline struct ContinuationTable {
symbolNames[N_STRING] = "n_string";
symbolNames[N_STRING2] = "n_string2";
symbolNames[N_STRING_FOLLOWING_ESCAPE] = "n_string_following_escape";
symbolNames[N_INTEGER] = "n_integer";
symbolNames[N_INTEGER2] = "n_integer2";
symbolNames[N_DIGITS] = "n_digits";
symbolNames[N_DIGITS2] = "n_digits2";
@@ -964,7 +981,6 @@ inline WeaselJsonStatus Parser3::keepGoing(Parser3 *self) {
if (self->len() == 0) {
if (!self->complete) {
switch (self->top()) {
case N_INTEGER:
case N_INTEGER2:
case N_DIGITS:
case N_DIGITS2: