Skip to content

Commit 68e6f02

Browse files
committed
Expand list of recognized unicode spaces (and rewrite for performance)
1 parent c7611df commit 68e6f02

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

src/ShellCheck/Parser.hs

+3-9
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,9 @@ carriageReturn = do
141141
parseProblemAt pos ErrorC 1017 "Literal carriage return. Run script through tr -d '\\r' ."
142142
return '\r'
143143

144-
almostSpace =
145-
choice [
146-
check '\xA0' "unicode non-breaking space",
147-
check '\x200B' "unicode zerowidth space"
148-
]
149-
where
150-
check c name = do
151-
parseNote ErrorC 1018 $ "This is a " ++ name ++ ". Delete and retype it."
152-
char c
144+
almostSpace = do
145+
parseNote ErrorC 1018 $ "This is a unicode space. Delete and retype it."
146+
oneOf "\xA0\x2002\x2003\x2004\x2005\x2006\x2007\x2008\x2009\x200B\x202F"
153147
return ' '
154148

155149
--------- Message/position annotation on top of user state

0 commit comments

Comments
 (0)