cln: hlint: Rename pattern variables to avoid hlint parsing errors.

This commit is contained in:
Stephen Morgan 2021-08-16 16:38:27 +10:00 committed by Simon Michael
parent 03db46cc81
commit 063aaf35b5
3 changed files with 5 additions and 7 deletions

View File

@ -50,8 +50,6 @@
- ignore: {name: "Use second"}
- ignore: {name: "Use fromRight"}
- ignore: {name: "Use fromLeft"}
- ignore: {name: "Parse error: on input `$*'"}
- ignore: {name: "Parse error: on input `pattern'"}
- ignore: {name: "Redundant bang pattern"}
- ignore: {name: "Use zipWith"}
- ignore: {name: "Replace case with maybe"}

View File

@ -199,7 +199,7 @@ words'' :: [T.Text] -> T.Text -> [T.Text]
words'' prefixes = fromparse . parsewith maybeprefixedquotedphrases -- XXX
where
maybeprefixedquotedphrases :: SimpleTextParser [T.Text]
maybeprefixedquotedphrases = choice' [prefixedQuotedPattern, singleQuotedPattern, doubleQuotedPattern, pattern] `sepBy` skipNonNewlineSpaces1
maybeprefixedquotedphrases = choice' [prefixedQuotedPattern, singleQuotedPattern, doubleQuotedPattern, patterns] `sepBy` skipNonNewlineSpaces1
prefixedQuotedPattern :: SimpleTextParser T.Text
prefixedQuotedPattern = do
not' <- fromMaybe "" `fmap` (optional $ string "not:")
@ -214,8 +214,8 @@ words'' prefixes = fromparse . parsewith maybeprefixedquotedphrases -- XXX
singleQuotedPattern = between (char '\'') (char '\'') (many $ noneOf ("'" :: [Char])) >>= return . stripquotes . T.pack
doubleQuotedPattern :: SimpleTextParser T.Text
doubleQuotedPattern = between (char '"') (char '"') (many $ noneOf ("\"" :: [Char])) >>= return . stripquotes . T.pack
pattern :: SimpleTextParser T.Text
pattern = fmap T.pack $ many (noneOf (" \n\r" :: [Char]))
patterns :: SimpleTextParser T.Text
patterns = fmap T.pack $ many (noneOf (" \n\r" :: [Char]))
-- XXX
-- keep synced with patterns below, excluding "not"

View File

@ -134,10 +134,10 @@ words' :: String -> [String]
words' "" = []
words' s = map stripquotes $ fromparse $ parsewithString p s
where
p = do ss <- (singleQuotedPattern <|> doubleQuotedPattern <|> pattern) `sepBy` skipNonNewlineSpaces1
p = do ss <- (singleQuotedPattern <|> doubleQuotedPattern <|> patterns) `sepBy` skipNonNewlineSpaces1
-- eof
return ss
pattern = many (noneOf whitespacechars)
patterns = many (noneOf whitespacechars)
singleQuotedPattern = between (char '\'') (char '\'') (many $ noneOf "'")
doubleQuotedPattern = between (char '"') (char '"') (many $ noneOf "\"")