diff options
author | franck cuny <franck@fcuny.net> | 2020-01-11 13:47:40 +0100 |
---|---|---|
committer | franck cuny <franck@fcuny.net> | 2020-01-11 13:55:22 +0100 |
commit | 88621a87ddc263b0560aa927118464d50c15c697 (patch) | |
tree | 8b88afcf31c9c0a278be1cb63161ac6963060182 /users/fcuny/exp/monkey | |
parent | lexer: initial lexer (diff) | |
download | world-88621a87ddc263b0560aa927118464d50c15c697.tar.gz |
token: support more operator tokens
Support additional tokens for operators (`-`, `*`, etc). This change only adds the tokens to the list of constants, and group all the tokens related to operators together.
Diffstat (limited to 'users/fcuny/exp/monkey')
-rw-r--r-- | users/fcuny/exp/monkey/pkg/token/token.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/users/fcuny/exp/monkey/pkg/token/token.go b/users/fcuny/exp/monkey/pkg/token/token.go index fda4449..bc9e563 100644 --- a/users/fcuny/exp/monkey/pkg/token/token.go +++ b/users/fcuny/exp/monkey/pkg/token/token.go @@ -16,9 +16,6 @@ const ( IDENT = "IDENT" INT = "INT" - ASSIGN = "=" - PLUS = "+" - COMMA = "," SEMICOLON = ";" @@ -29,6 +26,16 @@ const ( FUNCTION = "FUNCTION" LET = "LET" + + // The following tokens are for operators + ASSIGN = "=" + PLUS = "+" + MINUS = "-" + BANG = "!" + ASTERISK = "*" + SLASH = "/" + LT = "<" + GT = ">" ) // List of our keywords for the language |