Wee fuzz test and associated bug fixes
This commit is contained in:
@@ -135,14 +135,12 @@ inline Status n_value(Parser3 *self) {
|
||||
switch (*self->buf) {
|
||||
case '{':
|
||||
self->pop();
|
||||
self->callbacks->on_begin_object(self->data);
|
||||
if (auto s = self->push({N_OBJECT})) {
|
||||
return s;
|
||||
}
|
||||
break;
|
||||
case '[':
|
||||
self->pop();
|
||||
self->callbacks->on_begin_array(self->data);
|
||||
if (auto s = self->push({N_ARRAY})) {
|
||||
return s;
|
||||
}
|
||||
@@ -165,7 +163,6 @@ inline Status n_value(Parser3 *self) {
|
||||
case '9':
|
||||
case '-':
|
||||
self->pop();
|
||||
self->callbacks->on_begin_number(self->data);
|
||||
if (auto s = self->push({N_NUMBER})) {
|
||||
return s;
|
||||
}
|
||||
@@ -204,6 +201,7 @@ inline Status n_object(Parser3 *self) {
|
||||
if (*self->buf != '{') {
|
||||
return S_REJECT;
|
||||
}
|
||||
self->callbacks->on_begin_object(self->data);
|
||||
++self->buf;
|
||||
self->pop();
|
||||
if (auto s = self->push({N_WHITESPACE, N_OBJECT2})) {
|
||||
@@ -264,6 +262,7 @@ inline Status n_array(Parser3 *self) {
|
||||
if (*self->buf != '[') {
|
||||
return S_REJECT;
|
||||
}
|
||||
self->callbacks->on_begin_array(self->data);
|
||||
++self->buf;
|
||||
self->pop();
|
||||
if (auto s = self->push({N_WHITESPACE, N_ARRAY2})) {
|
||||
@@ -494,6 +493,7 @@ inline Status n_integer(Parser3 *self) {
|
||||
if (self->len() == 0) {
|
||||
return S_REJECT;
|
||||
}
|
||||
self->callbacks->on_begin_number(self->data);
|
||||
switch (*self->buf) {
|
||||
case '0':
|
||||
self->callbacks->on_number_data(self->data, self->buf, 1);
|
||||
@@ -685,6 +685,9 @@ inline Status n_whitespace(Parser3 *self) {
|
||||
}
|
||||
|
||||
inline Status n_true(Parser3 *self) {
|
||||
if (self->len() == 0) {
|
||||
return S_REJECT;
|
||||
}
|
||||
if (*self->buf == 'e') {
|
||||
++self->buf;
|
||||
self->pop();
|
||||
@@ -695,6 +698,9 @@ inline Status n_true(Parser3 *self) {
|
||||
}
|
||||
|
||||
inline Status n_false(Parser3 *self) {
|
||||
if (self->len() == 0) {
|
||||
return S_REJECT;
|
||||
}
|
||||
if (*self->buf == 'e') {
|
||||
++self->buf;
|
||||
self->pop();
|
||||
@@ -705,6 +711,9 @@ inline Status n_false(Parser3 *self) {
|
||||
}
|
||||
|
||||
inline Status n_null(Parser3 *self) {
|
||||
if (self->len() == 0) {
|
||||
return S_REJECT;
|
||||
}
|
||||
if (*self->buf == 'l') {
|
||||
++self->buf;
|
||||
self->pop();
|
||||
@@ -715,6 +724,9 @@ inline Status n_null(Parser3 *self) {
|
||||
}
|
||||
|
||||
template <char kChar> inline Status singleChar(Parser3 *self) {
|
||||
if (self->len() == 0) {
|
||||
return S_REJECT;
|
||||
}
|
||||
if (*self->buf == kChar) {
|
||||
++self->buf;
|
||||
self->pop();
|
||||
|
||||
Reference in New Issue
Block a user