promql: fix lexing of \r as whitespaces

This commit is contained in:
Fabian Reinartz 2015-06-02 18:33:49 +02:00
parent 867f2ac979
commit c60e3387ef
2 changed files with 4 additions and 1 deletions

View File

@ -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.

View File

@ -42,6 +42,9 @@ var tests = []struct {
{itemDuration, 1, `5m`},
{itemRightBracket, 3, `]`},
},
}, {
input: "\r\n\r",
expected: []item{},
},
// Test numbers.
{