diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-09-24 13:26:38 +0200 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-09-24 13:27:38 +0200 |
commit | 486ff859ced13c2454e7d12788069e5db30b618d (patch) | |
tree | 8f15bd33665a8678854ba530c36bf1b507425afc /ast.h | |
parent | fc7ef102aa147680e2c82b6f2be338ad51ce0842 (diff) |
syntax: add regular expression support
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'ast.h')
-rw-r--r-- | ast.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -40,6 +40,7 @@ enum ut_error_type { UT_ERROR_OVERLONG_STRING, UT_ERROR_INVALID_ESCAPE, UT_ERROR_NESTED_BLOCKS, + UT_ERROR_INVALID_REGEXP, UT_ERROR_EXCEPTION }; @@ -58,6 +59,9 @@ struct ut_op { uint16_t is_postfix:1; uint16_t is_for_in:1; uint16_t is_list:1; + uint16_t is_reg_icase:1; + uint16_t is_reg_newline:1; + uint16_t is_reg_global:1; uint32_t off; struct json_object *val; union { @@ -84,6 +88,7 @@ struct ut_state { uint8_t lstrip_blocks:1; uint8_t strict_declarations:1; uint8_t skip_shebang:1; + uint8_t expect_div:1; size_t off; enum ut_block_type blocktype; struct { @@ -91,6 +96,7 @@ struct ut_state { union { struct json_object *exception; uint64_t tokens[2]; + char *regexp_error; } info; } error; struct { @@ -130,6 +136,7 @@ struct json_object *ut_new_func(struct ut_op *decl); struct json_object *ut_new_object(struct json_object *proto); struct json_object *ut_new_double(double v); struct json_object *ut_new_null(void); +struct json_object *ut_new_regexp(const char *source, bool icase, bool newline, bool global, char **err); bool ut_register_extended_type(const char *name, struct json_object *proto, void (*freefn)(void *)); struct json_object *ut_set_extended_type(struct json_object *v, const char *name, void *data); |