diff options
Diffstat (limited to 'token')
| -rw-r--r-- | token/token.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/token/token.go b/token/token.go index 92bc1ee..4cd3a3d 100644 --- a/token/token.go +++ b/token/token.go @@ -26,6 +26,19 @@ const ( LET = "LET" ) +var keywords = map[string]TokenType{ + "fn": FUNCTION, + "let": LET, +} + +func LookupIdentifier(ident string) TokenType { + if tok, ok := keywords[ident]; ok { + return tok + } + + return IDENT +} + type TokenType string type Token struct { |
