commit 5b743e7aeec89865a7c1723048b9bddb79b9f07b
parent 5585c042a1ee9324d5839fd0d41f828d7358947a
Author: bsandro <email@bsandro.tech>
Date: Sat, 11 Jun 2022 10:29:36 +0300
go fmt
Diffstat:
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/lexer/lexer.go b/lexer/lexer.go
@@ -3,10 +3,10 @@ package lexer
import "interp/token"
type Lexer struct {
- input string
- position int
+ input string
+ position int
readPosition int
- ch byte
+ ch byte
}
func New(input string) *Lexer {
diff --git a/lexer/lexer_test.go b/lexer/lexer_test.go
@@ -1,8 +1,8 @@
package lexer
import (
- "testing"
"interp/token"
+ "testing"
)
func TestNextToken(t *testing.T) {
@@ -24,8 +24,8 @@ if (5 < 10) {
10 != 8;
`
- tests := []struct{
- expectedType token.TokenType
+ tests := []struct {
+ expectedType token.TokenType
expectedLiteral string
}{
{token.LET, "let"},
diff --git a/token/token.go b/token/token.go
@@ -38,18 +38,18 @@ const (
)
var keywords = map[string]TokenType{
- "fn": FUNCTION,
- "let": LET,
- "true": TRUE,
- "false": FALSE,
- "if": IF,
- "else": ELSE,
+ "fn": FUNCTION,
+ "let": LET,
+ "true": TRUE,
+ "false": FALSE,
+ "if": IF,
+ "else": ELSE,
"return": RETURN,
}
func LookupIdentifier(ident string) TokenType {
if tok, ok := keywords[ident]; ok {
- return tok;
+ return tok
}
return IDENT
}