diff options
Diffstat (limited to 'src/lexer.c')
-rw-r--r-- | src/lexer.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/lexer.c b/src/lexer.c index 14165ae..0327ad5 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -198,3 +198,30 @@ lexer_current_char(lexer_t *lexer) return lexer->src[lexer->cur]; } +char * +token_kind_to_str(token_kind_t kind) +{ + switch (kind) { + case TOKEN_NAME: + return "TOKEN_NAME"; + case TOKEN_OPAREN: + return "("; + case TOKEN_CPAREN: + return ")"; + case TOKEN_COLON: + return ":"; + case TOKEN_SEMICOLON: + return ";"; + case TOKEN_OCURLY: + return "{"; + case TOKEN_CCURLY: + return "}"; + case TOKEN_NUMBER: + return "TOKEN_NUMBER"; + case TOKEN_EOF: + return "TOKEN_EOF"; + default: + return "UNKNOW_TOKEN"; + } +} + |