diff --git a/lexer.go b/lexer.go index 7767e47..6a36619 100644 --- a/lexer.go +++ b/lexer.go @@ -113,7 +113,7 @@ func (s *Scanner) scanIdent() (tok Token, lit string) { } func isWhitespace(ch rune) bool { - return ch == ' ' || ch == '\t' || ch == '\n' + return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r' } func isLetter(ch rune) bool { diff --git a/lexer_test.go b/lexer_test.go index a01b4f2..6170fb8 100644 --- a/lexer_test.go +++ b/lexer_test.go @@ -20,6 +20,7 @@ func TestScanner_Scan(t *testing.T) { {s: ` `, tok: vdf.WS, lit: " "}, {s: "\t", tok: vdf.WS, lit: "\t"}, {s: "\n", tok: vdf.WS, lit: "\n"}, + {s: "\r", tok: vdf.WS, lit: "\r"}, // Misc characters {s: `{`, tok: vdf.CurlyBraceOpen, lit: "{"},