lang: Detect windows style CR and return a better error

If you get a sneaky \r in your code, the error just looks like
whitespace, so this way we can warn you explicitly.
This commit is contained in:
James Shubin
2019-07-21 03:10:21 -04:00
parent 64288b4914
commit 252cb5f2f3
2 changed files with 6 additions and 1 deletions

View File

@@ -46,6 +46,7 @@ const (
// These constants represent the different possible lexer/parser errors.
const (
ErrLexerUnrecognized = interfaces.Error("unrecognized")
ErrLexerUnrecognizedCR = interfaces.Error("unrecognized carriage return")
ErrLexerStringBadEscaping = interfaces.Error("string: bad escaping")
ErrLexerIntegerOverflow = interfaces.Error("integer: overflow")
ErrLexerFloatOverflow = interfaces.Error("float: overflow")