From f73ea0821fb378ba260630ba3c7ae02f7d9f8377 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 25 Mar 2018 10:20:37 +0200 Subject: cleanup --- lexer/lexer.go | 2 +- lexer/lexer_test.go | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'lexer') diff --git a/lexer/lexer.go b/lexer/lexer.go index 0807d6d..12d4419 100644 --- a/lexer/lexer.go +++ b/lexer/lexer.go @@ -79,7 +79,7 @@ func (l *Lexer) NextToken() token.Token { tok.Type = token.LookupIdent(tok.Literal) return tok } else if isDigit(l.ch) { - tok.Type = token.INT + tok.Type = token.INTEGER tok.Literal = l.readNumber() return tok } else { diff --git a/lexer/lexer_test.go b/lexer/lexer_test.go index 3e8a0e8..e692fea 100644 --- a/lexer/lexer_test.go +++ b/lexer/lexer_test.go @@ -40,12 +40,12 @@ macro(x, y) { x + y; }; {token.LET, "let"}, {token.IDENT, "five"}, {token.ASSIGN, "="}, - {token.INT, "5"}, + {token.INTEGER, "5"}, {token.SEMICOLON, ";"}, {token.LET, "let"}, {token.IDENT, "ten"}, {token.ASSIGN, "="}, - {token.INT, "10"}, + {token.INTEGER, "10"}, {token.SEMICOLON, ";"}, {token.LET, "let"}, {token.IDENT, "add"}, @@ -77,19 +77,19 @@ macro(x, y) { x + y; }; {token.MINUS, "-"}, {token.SLASH, "/"}, {token.ASTERISK, "*"}, - {token.INT, "5"}, + {token.INTEGER, "5"}, {token.SEMICOLON, ";"}, - {token.INT, "5"}, + {token.INTEGER, "5"}, {token.LESS, "<"}, - {token.INT, "10"}, + {token.INTEGER, "10"}, {token.MORE, ">"}, - {token.INT, "5"}, + {token.INTEGER, "5"}, {token.SEMICOLON, ";"}, {token.IF, "if"}, {token.LPAREN, "("}, - {token.INT, "5"}, + {token.INTEGER, "5"}, {token.LESS, "<"}, - {token.INT, "10"}, + {token.INTEGER, "10"}, {token.RPAREN, ")"}, {token.LBRACE, "{"}, {token.RETURN, "return"}, @@ -102,20 +102,20 @@ macro(x, y) { x + y; }; {token.FALSE, "false"}, {token.SEMICOLON, ";"}, {token.RBRACE, "}"}, - {token.INT, "10"}, + {token.INTEGER, "10"}, {token.EQ, "=="}, - {token.INT, "10"}, + {token.INTEGER, "10"}, {token.SEMICOLON, ";"}, - {token.INT, "10"}, + {token.INTEGER, "10"}, {token.NOT_EQ, "!="}, - {token.INT, "9"}, + {token.INTEGER, "9"}, {token.SEMICOLON, ";"}, {token.STRING, "foobar"}, {token.STRING, "foo bar"}, {token.LBRACKET, "["}, - {token.INT, "1"}, + {token.INTEGER, "1"}, {token.COMMA, ","}, - {token.INT, "2"}, + {token.INTEGER, "2"}, {token.RBRACKET, "]"}, {token.SEMICOLON, ";"}, {token.LBRACE, "{"}, -- cgit v1.2.3