diff --git a/src/ShellCheck/Parser.hs b/src/ShellCheck/Parser.hs index 03865af..a999b23 100644 --- a/src/ShellCheck/Parser.hs +++ b/src/ShellCheck/Parser.hs @@ -1039,9 +1039,14 @@ readComment = do unexpecting "shellcheck annotation" readAnnotationPrefix readAnyComment +prop_readAnyComment = isOk readAnyComment "# Comment" +prop_readAnyComment1 = not $ isOk readAnyComment "# Comment \\\n" readAnyComment = do char '#' - many $ noneOf "\r\n" + comment <- many $ noneOf "\\\r\n" + bs <- many $ oneOf "\\" + unless (null bs) (fail "Backslash in or directly after comment") + return comment prop_readNormalWord = isOk readNormalWord "'foo'\"bar\"{1..3}baz$(lol)" prop_readNormalWord2 = isOk readNormalWord "foo**(foo)!!!(@@(bar))"