aboutsummaryrefslogtreecommitdiff
path: root/lexer
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2018-03-25 10:20:37 +0200
committerDimitri Sokolyuk <demon@dim13.org>2018-03-25 10:20:37 +0200
commitf73ea0821fb378ba260630ba3c7ae02f7d9f8377 (patch)
treef050f34400014928a1db0ea16a33af290927154c /lexer
parent99d08ce35ede2b5c75266240f20c4554060ddce0 (diff)
cleanup
Diffstat (limited to 'lexer')
-rw-r--r--lexer/lexer.go2
-rw-r--r--lexer/lexer_test.go28
2 files changed, 15 insertions, 15 deletions
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, "{"},