From 88621a87ddc263b0560aa927118464d50c15c697 Mon Sep 17 00:00:00 2001 From: franck cuny Date: Sat, 11 Jan 2020 13:47:40 +0100 Subject: 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. --- users/fcuny/exp/monkey/pkg/token/token.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'users/fcuny/exp/monkey/pkg') 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 -- cgit 1.4.1