Merge branch 'comment-backslash' of https://github.com/m-ildefons/shellcheck into m-ildefons-comment-backslash

This commit is contained in:
Vidar Holen 2021-03-20 13:34:40 -07:00
commit a277efdbb1
1 changed files with 6 additions and 1 deletions

View File

@ -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))"