diff options
author | Jo-Philipp Wich <jo@mein.io> | 2024-09-24 00:06:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 00:06:57 +0200 |
commit | 9cf53dda36bc25b513ec1b1cdfc851a10b37473f (patch) | |
tree | bbddd088685164124bfbc100a97098fa280375fc /include | |
parent | fa22732f3463a443d5b42d933e245680fc8ed20f (diff) | |
parent | 2b2e732b6081afb473a2cc698fd4397260b0960c (diff) |
Merge pull request #226 from jow-/lexer-improvements
Enhance lexer functionality and improve token reporting
Diffstat (limited to 'include')
-rw-r--r-- | include/ucode/lexer.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/ucode/lexer.h b/include/ucode/lexer.h index 1728aa3..fd375b8 100644 --- a/include/ucode/lexer.h +++ b/include/ucode/lexer.h @@ -121,12 +121,14 @@ typedef enum { TK_EXPORT, TK_EOF, + TK_COMMENT, TK_ERROR } uc_tokentype_t; typedef enum { UC_LEX_IDENTIFY_BLOCK, UC_LEX_BLOCK_EXPRESSION_EMIT_TAG, + UC_LEX_BLOCK_STATEMENT_EMIT_TAG, UC_LEX_BLOCK_COMMENT, UC_LEX_IDENTIFY_TOKEN, UC_LEX_PLACEHOLDER_START, @@ -138,6 +140,7 @@ typedef struct { uc_tokentype_t type; uc_value_t *uv; size_t pos; + size_t end; } uc_token_t; typedef struct { @@ -174,10 +177,10 @@ typedef struct { } uc_lexer_t; -__hidden void uc_lexer_init(uc_lexer_t *lex, uc_parse_config_t *config, uc_source_t *source); -__hidden void uc_lexer_free(uc_lexer_t *lex); +void uc_lexer_init(uc_lexer_t *lex, uc_parse_config_t *config, uc_source_t *source); +void uc_lexer_free(uc_lexer_t *lex); -__hidden uc_token_t *uc_lexer_next_token(uc_lexer_t *lex); +uc_token_t *uc_lexer_next_token(uc_lexer_t *lex); __hidden bool uc_lexer_is_keyword(uc_value_t *label); |