mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-20 02:37:12 +03:00
words' on an empty string should return empty list
This commit is contained in:
parent
8aba692926
commit
33153851e9
@ -87,9 +87,10 @@ escapeQuotes :: String -> String
|
||||
escapeQuotes = regexReplace "([\"'])" "\\1"
|
||||
|
||||
-- | Quote-aware version of words - don't split on spaces which are inside quotes.
|
||||
-- NB correctly handles "a'b" but not "''a''".
|
||||
-- NB correctly handles "a'b" but not "''a''". Can raise an error if parsing fails.
|
||||
words' :: String -> [String]
|
||||
words' = map stripquotes . fromparse . parsewith p
|
||||
words' "" = []
|
||||
words' s = map stripquotes $ fromparse $ parsewith p s
|
||||
where
|
||||
p = do ss <- (quotedPattern <|> pattern) `sepBy` many1 spacenonewline
|
||||
-- eof
|
||||
|
Loading…
Reference in New Issue
Block a user