Warn about zero-width spaces.
This commit is contained in:
parent
722b0606e8
commit
cbda90eeb5
|
@ -46,14 +46,14 @@ variableStart = upper <|> lower <|> oneOf "_"
|
||||||
variableChars = upper <|> lower <|> digit <|> oneOf "_"
|
variableChars = upper <|> lower <|> digit <|> oneOf "_"
|
||||||
functionChars = variableChars <|> oneOf ":+-.?"
|
functionChars = variableChars <|> oneOf ":+-.?"
|
||||||
specialVariable = oneOf "@*#?-$!"
|
specialVariable = oneOf "@*#?-$!"
|
||||||
tokenDelimiter = oneOf "&|;<> \t\n\r" <|> nbsp
|
tokenDelimiter = oneOf "&|;<> \t\n\r" <|> almostSpace
|
||||||
quotableChars = "|&;<>()\\ '\t\n\r\xA0" ++ doubleQuotableChars
|
quotableChars = "|&;<>()\\ '\t\n\r\xA0" ++ doubleQuotableChars
|
||||||
quotable = nbsp <|> unicodeDoubleQuote <|> oneOf quotableChars
|
quotable = almostSpace <|> unicodeDoubleQuote <|> oneOf quotableChars
|
||||||
bracedQuotable = oneOf "}\"$`'"
|
bracedQuotable = oneOf "}\"$`'"
|
||||||
doubleQuotableChars = "\"$`" ++ unicodeDoubleQuoteChars
|
doubleQuotableChars = "\"$`" ++ unicodeDoubleQuoteChars
|
||||||
doubleQuotable = unicodeDoubleQuote <|> oneOf doubleQuotableChars
|
doubleQuotable = unicodeDoubleQuote <|> oneOf doubleQuotableChars
|
||||||
whitespace = oneOf " \t\n" <|> carriageReturn <|> nbsp
|
whitespace = oneOf " \t\n" <|> carriageReturn <|> almostSpace
|
||||||
linewhitespace = oneOf " \t" <|> nbsp
|
linewhitespace = oneOf " \t" <|> almostSpace
|
||||||
|
|
||||||
suspectCharAfterQuotes = variableChars <|> char '%'
|
suspectCharAfterQuotes = variableChars <|> char '%'
|
||||||
|
|
||||||
|
@ -105,10 +105,16 @@ carriageReturn = do
|
||||||
parseNote ErrorC 1017 "Literal carriage return. Run script through tr -d '\\r' ."
|
parseNote ErrorC 1017 "Literal carriage return. Run script through tr -d '\\r' ."
|
||||||
char '\r'
|
char '\r'
|
||||||
|
|
||||||
nbsp = do
|
almostSpace =
|
||||||
parseNote ErrorC 1018 "This is a . Delete it and retype as space."
|
choice [
|
||||||
char '\xA0'
|
check '\xA0' "unicode non-breaking space",
|
||||||
return ' '
|
check '\x200B' "unicode zerowidth space"
|
||||||
|
]
|
||||||
|
where
|
||||||
|
check c name = do
|
||||||
|
parseNote ErrorC 1018 $ "This is a " ++ name ++ ". Delete and retype it."
|
||||||
|
char c
|
||||||
|
return ' '
|
||||||
|
|
||||||
--------- Message/position annotation on top of user state
|
--------- Message/position annotation on top of user state
|
||||||
data Note = Note Id Severity Code String deriving (Show, Eq)
|
data Note = Note Id Severity Code String deriving (Show, Eq)
|
||||||
|
|
Loading…
Reference in New Issue