diff options
Diffstat (limited to 'src/lexer.h')
| -rw-r--r-- | src/lexer.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/lexer.h b/src/lexer.h new file mode 100644 index 0000000..563dc60 --- /dev/null +++ b/src/lexer.h | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | #ifndef INCLUDED_LEXER_H | ||
| 2 | #define INCLUDED_LEXER_H | ||
| 3 | |||
| 4 | #include <stddef.h> | ||
| 5 | #include "utils.h" | ||
| 6 | #include "lexeme.h" | ||
| 7 | |||
| 8 | struct string_view_table { | ||
| 9 | struct string_view *items; | ||
| 10 | uint32_t count; | ||
| 11 | uint32_t capacity; | ||
| 12 | }; | ||
| 13 | |||
| 14 | struct lexer { | ||
| 15 | struct string_view sv; | ||
| 16 | const char *cursor; | ||
| 17 | const char *beginning_of_line; | ||
| 18 | size_t line; | ||
| 19 | struct string_view_table constant_string_table; | ||
| 20 | struct string_view_table identifier_table; | ||
| 21 | }; | ||
| 22 | |||
| 23 | extern struct lexer lexer_create (const char *string, size_t len); | ||
| 24 | extern struct lexeme lexer_next_lexeme (struct lexer *); | ||
| 25 | |||
| 26 | #endif | ||
