From c60e3387efbd23cf4d0cbe87216fad1ff78ab298 Mon Sep 17 00:00:00 2001 From: Fabian Reinartz Date: Tue, 2 Jun 2015 18:33:49 +0200 Subject: [PATCH] promql: fix lexing of \r as whitespaces --- promql/lex.go | 2 +- promql/lex_test.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/promql/lex.go b/promql/lex.go index 935c2d8a2..189d58ac2 100644 --- a/promql/lex.go +++ b/promql/lex.go @@ -724,7 +724,7 @@ Loop: } func isSpace(r rune) bool { - return r == ' ' || r == '\t' || r == '\n' + return r == ' ' || r == '\t' || r == '\n' || r == '\r' } // isEndOfLine reports whether r is an end-of-line character. diff --git a/promql/lex_test.go b/promql/lex_test.go index c12f75327..7ef474033 100644 --- a/promql/lex_test.go +++ b/promql/lex_test.go @@ -42,6 +42,9 @@ var tests = []struct { {itemDuration, 1, `5m`}, {itemRightBracket, 3, `]`}, }, + }, { + input: "\r\n\r", + expected: []item{}, }, // Test numbers. {