27#define ASSERT_STTYPE_NOT_REACHED(st) \
28 ws_error("Invalid syntax node type '%s'.", sttype_name(st))
30#define ASSERT_STNODE_OP_NOT_REACHED(op) \
31 ws_error("Invalid stnode op '%s'.", stnode_op_name(op))
52typedef void * (*STTypeNewFunc)(
void *);
53typedef void * (*STTypeDupFunc)(
const void *);
54typedef void (*STTypeFreeFunc)(
void *);
55typedef char* (*STTypeToStrFunc)(
const void *,
bool pretty);
61 STTypeNewFunc func_new;
62 STTypeFreeFunc func_free;
63 STTypeDupFunc func_dup;
64 STTypeToStrFunc func_tostr;
75#define STFLAG_UNPARSED (1 << 0)
89 STNODE_OP_UNINITIALIZED,
105 STNODE_OP_BITWISE_AND,
106 STNODE_OP_UNARY_MINUS,
121void sttype_register_field(
void);
122void sttype_register_function(
void);
123void sttype_register_number(
void);
124void sttype_register_pointer(
void);
125void sttype_register_set(
void);
126void sttype_register_slice(
void);
127void sttype_register_string(
void);
128void sttype_register_opers(
void);
141sttype_name(sttype_id_t type);
145stnode_op_name(stnode_op_t op);
149stnode_new(sttype_id_t type_id,
void *data,
char *token,
df_loc_t loc);
153stnode_new_empty(sttype_id_t type_id);
165stnode_init(
stnode_t *node, sttype_id_t type_id,
void *data,
char *token,
df_loc_t loc);
169stnode_replace(
stnode_t *node, sttype_id_t type_id,
void *data);
173stnode_mutate(
stnode_t *node, sttype_id_t type_id);
213stnode_get_flags(
stnode_t *node, uint16_t flags);
217stnode_set_flags(
stnode_t *node, uint16_t flags);
224stnode_tostr(
stnode_t *node,
bool pretty);
226#define stnode_todisplay(node) stnode_tostr(node, true)
228#define stnode_todebug(node) stnode_tostr(node, false)
231log_node_full(
enum ws_log_level level,
232 const char *file,
int line,
const char *func,
236log_test_full(
enum ws_log_level level,
237 const char *file,
int line,
const char *func,
241#define log_node(node) \
242 log_node_full(LOG_LEVEL_NOISY, __FILE__, __LINE__, __func__, node, #node)
243#define log_test(node) \
244 log_test_full(LOG_LEVEL_NOISY, __FILE__, __LINE__, __func__, node, #node)
245#define LOG_NODE(node) \
247 if (stnode_type_id(node) == STTYPE_TEST) \
253#define log_node(node) (void)0
254#define log_test(node) (void)0
255#define LOG_NODE(node) (void)0
259dump_syntax_tree_str(
stnode_t *root);
262log_syntax_tree(
enum ws_log_level,
stnode_t *root,
const char *msg,
char **cache_ptr);
265#define ws_assert_magic(obj, mnum) \
268 if ((obj)->magic != (mnum)) { \
269 ws_log_full(LOG_DOMAIN_DFILTER, LOG_LEVEL_ERROR, \
270 __FILE__, __LINE__, __func__, \
271 "Magic num is 0x%08" PRIx32", " \
272 "but should be 0x%08" PRIx32, \
273 (obj)->magic, (mnum)); \
277#define ws_assert_magic(obj, mnum) (void)0
Definition dfilter-loc.h:16
Definition syntax-tree.h:78
Definition syntax-tree.h:59