diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/ucode/lexer.h | 8 | ||||
-rw-r--r-- | include/ucode/util.h | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/include/ucode/lexer.h b/include/ucode/lexer.h index 134f5ef..835bc2b 100644 --- a/include/ucode/lexer.h +++ b/include/ucode/lexer.h @@ -115,6 +115,8 @@ typedef enum { TK_ASOR, TK_ASNULLISH, TK_NULLISH, + TK_PLACEH, + TK_TEMPLATE, TK_EOF, TK_ERROR @@ -129,6 +131,7 @@ typedef enum { UC_LEX_BLOCK_COMMENT, UC_LEX_IDENTIFY_TOKEN, UC_LEX_PARSE_TOKEN, + UC_LEX_PLACEHOLDER, UC_LEX_EOF } uc_lex_state_t; @@ -144,6 +147,7 @@ typedef struct { uc_source_t *source; uint8_t eof:1; uint8_t is_escape:1; + uint8_t is_placeholder:1; uint8_t no_regexp:1; uint8_t no_keyword:1; size_t buflen; @@ -168,6 +172,10 @@ typedef struct { STATEMENTS = '%', COMMENT = '#' } block; + struct { + size_t count; + size_t *entries; + } templates; } uc_lexer_t; diff --git a/include/ucode/util.h b/include/ucode/util.h index 3203499..093951e 100644 --- a/include/ucode/util.h +++ b/include/ucode/util.h @@ -68,6 +68,11 @@ #define uc_vector_last(vec) \ (&((vec)->entries[(vec)->count - 1])) +#define uc_vector_push(vec, val) do { \ + uc_vector_grow(vec); \ + (vec)->entries[(vec)->count++] = (val); \ +} while(0) + /* "failsafe" utility functions */ |