Skip to content

Commit

Permalink
fix: remove \n as valid letter
Browse files Browse the repository at this point in the history
  • Loading branch information
gravataLonga committed Jun 30, 2022
1 parent 4c90afc commit 58bcf0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lexer/lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func newToken(tokenType token.TokenType, ch []byte) token.Token {
//}

func isLetter(ch byte) bool {
return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' || ch == '\n'
return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_'
}

func isDigit(ch byte) bool {
Expand Down
2 changes: 1 addition & 1 deletion lexer/lexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

func TestNextToken(t *testing.T) {
input := `
var true false if else
var true false if else
break for () [] {} . ; :
!= == <= >= < > && || =
+ - * /
Expand Down

0 comments on commit 58bcf0f

Please sign in to comment.