Remove PRESERVE_NONE
This commit is contained in:
30
src/test.cpp
30
src/test.cpp
@@ -416,12 +416,6 @@ private:
|
|||||||
#define MUSTTAIL
|
#define MUSTTAIL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if __has_attribute(preserve_none)
|
|
||||||
#define PRESERVE_NONE __attribute__((preserve_none))
|
|
||||||
#else
|
|
||||||
#define PRESERVE_NONE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct Parser2 {
|
struct Parser2 {
|
||||||
Parser2(char *buf, int len, const Callbacks *callbacks, void *data)
|
Parser2(char *buf, int len, const Callbacks *callbacks, void *data)
|
||||||
: buf(buf), len(len), callbacks(callbacks), data(data) {}
|
: buf(buf), len(len), callbacks(callbacks), data(data) {}
|
||||||
@@ -498,7 +492,7 @@ private:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef PRESERVE_NONE bool (*continuation)(Parser2 *);
|
typedef bool (*continuation)(Parser2 *);
|
||||||
|
|
||||||
[[maybe_unused]] void debugPrint(Symbol token) {
|
[[maybe_unused]] void debugPrint(Symbol token) {
|
||||||
printf("token: %s\n", symbolNames[token]);
|
printf("token: %s\n", symbolNames[token]);
|
||||||
@@ -508,12 +502,12 @@ private:
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
PRESERVE_NONE static bool tokenMatch(Parser2 *self) {
|
static bool tokenMatch(Parser2 *self) {
|
||||||
self->pop();
|
self->pop();
|
||||||
MUSTTAIL return keepGoing(self);
|
MUSTTAIL return keepGoing(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
PRESERVE_NONE static bool keepGoing(Parser2 *self) {
|
static bool keepGoing(Parser2 *self) {
|
||||||
if (self->empty()) {
|
if (self->empty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -522,11 +516,11 @@ private:
|
|||||||
MUSTTAIL return table[*(self->stackPtr - 1)][token](self);
|
MUSTTAIL return table[*(self->stackPtr - 1)][token](self);
|
||||||
}
|
}
|
||||||
|
|
||||||
PRESERVE_NONE static bool reject(Parser2 *self) {
|
static bool reject(Parser2 *self) {
|
||||||
self->pop();
|
self->pop();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PRESERVE_NONE static bool object(Parser2 *self) {
|
static bool object(Parser2 *self) {
|
||||||
self->pop();
|
self->pop();
|
||||||
self->callbacks->on_begin_object(self->data);
|
self->callbacks->on_begin_object(self->data);
|
||||||
if (!self->push({T_STRING, T_COLON, N_VALUE, N_OBJECT_MAYBE_CONTINUE})) {
|
if (!self->push({T_STRING, T_COLON, N_VALUE, N_OBJECT_MAYBE_CONTINUE})) {
|
||||||
@@ -534,7 +528,7 @@ private:
|
|||||||
}
|
}
|
||||||
MUSTTAIL return keepGoing(self);
|
MUSTTAIL return keepGoing(self);
|
||||||
}
|
}
|
||||||
PRESERVE_NONE static bool atom(Parser2 *self) {
|
static bool atom(Parser2 *self) {
|
||||||
self->pop();
|
self->pop();
|
||||||
if (*self->bufBefore == 't') {
|
if (*self->bufBefore == 't') {
|
||||||
self->callbacks->on_true_literal(self->data);
|
self->callbacks->on_true_literal(self->data);
|
||||||
@@ -550,11 +544,11 @@ private:
|
|||||||
}
|
}
|
||||||
MUSTTAIL return keepGoing(self);
|
MUSTTAIL return keepGoing(self);
|
||||||
}
|
}
|
||||||
PRESERVE_NONE static bool string(Parser2 *self) {
|
static bool string(Parser2 *self) {
|
||||||
self->pop();
|
self->pop();
|
||||||
MUSTTAIL return keepGoing(self);
|
MUSTTAIL return keepGoing(self);
|
||||||
}
|
}
|
||||||
PRESERVE_NONE static bool array(Parser2 *self) {
|
static bool array(Parser2 *self) {
|
||||||
self->pop();
|
self->pop();
|
||||||
self->callbacks->on_begin_array(self->data);
|
self->callbacks->on_begin_array(self->data);
|
||||||
if (!self->push({N_VALUE, N_ARRAY_MAYBE_CONTINUE})) {
|
if (!self->push({N_VALUE, N_ARRAY_MAYBE_CONTINUE})) {
|
||||||
@@ -562,26 +556,26 @@ private:
|
|||||||
}
|
}
|
||||||
MUSTTAIL return keepGoing(self);
|
MUSTTAIL return keepGoing(self);
|
||||||
}
|
}
|
||||||
PRESERVE_NONE static bool continueArray(Parser2 *self) {
|
static bool continueArray(Parser2 *self) {
|
||||||
self->pop();
|
self->pop();
|
||||||
if (!self->push({N_VALUE, N_ARRAY_MAYBE_CONTINUE})) {
|
if (!self->push({N_VALUE, N_ARRAY_MAYBE_CONTINUE})) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MUSTTAIL return keepGoing(self);
|
MUSTTAIL return keepGoing(self);
|
||||||
}
|
}
|
||||||
PRESERVE_NONE static bool continueObject(Parser2 *self) {
|
static bool continueObject(Parser2 *self) {
|
||||||
self->pop();
|
self->pop();
|
||||||
if (!self->push({T_STRING, T_COLON, N_VALUE, N_OBJECT_MAYBE_CONTINUE})) {
|
if (!self->push({T_STRING, T_COLON, N_VALUE, N_OBJECT_MAYBE_CONTINUE})) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MUSTTAIL return keepGoing(self);
|
MUSTTAIL return keepGoing(self);
|
||||||
}
|
}
|
||||||
PRESERVE_NONE static bool finishArray(Parser2 *self) {
|
static bool finishArray(Parser2 *self) {
|
||||||
self->pop();
|
self->pop();
|
||||||
self->callbacks->on_end_array(self->data);
|
self->callbacks->on_end_array(self->data);
|
||||||
MUSTTAIL return keepGoing(self);
|
MUSTTAIL return keepGoing(self);
|
||||||
}
|
}
|
||||||
PRESERVE_NONE static bool finishObject(Parser2 *self) {
|
static bool finishObject(Parser2 *self) {
|
||||||
self->pop();
|
self->pop();
|
||||||
self->callbacks->on_end_object(self->data);
|
self->callbacks->on_end_object(self->data);
|
||||||
MUSTTAIL return keepGoing(self);
|
MUSTTAIL return keepGoing(self);
|
||||||
|
|||||||
Reference in New Issue
Block a user