diff options
| author | LLLL Colonq <llll@colonq> | 2025-09-20 23:25:29 -0400 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2025-09-20 23:25:29 -0400 |
| commit | 85a67a25ac9757e694166b3c9e9e2c8cdeefc6da (patch) | |
| tree | a381993c6f0d85aec3c3ead4ed7fa66583338ccb /src/lexer.h | |
Initial commit
Diffstat (limited to 'src/lexer.h')
| -rw-r--r-- | src/lexer.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/lexer.h b/src/lexer.h new file mode 100644 index 0000000..dabe534 --- /dev/null +++ b/src/lexer.h @@ -0,0 +1,28 @@ +#ifndef LEXER_H +#define LEXER_H + +#include "types.h" + +typedef enum { + PIT_LEX_TOKEN_ERROR=-1, + PIT_LEX_TOKEN_EOF=0, + PIT_LEX_TOKEN_LPAREN, + PIT_LEX_TOKEN_RPAREN, + PIT_LEX_TOKEN_DOT, + PIT_LEX_TOKEN_QUOTE, + PIT_LEX_TOKEN_INTEGER_LITERAL, + PIT_LEX_TOKEN_STRING_LITERAL, + PIT_LEX_TOKEN_SYMBOL, + PIT_LEX_TOKEN__SENTINEL, +} pit_lex_token; + +typedef struct { + char *input; + i64 start, end, len; +} pit_lexer; + +pit_lexer *pit_lex_file(char *path); +pit_lex_token pit_lex_next(pit_lexer *st); +const char *pit_lex_token_name(pit_lex_token t); + +#endif |
