-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Milestone
Description
Better docs for (fixed in 1.3.2), fix Pattern moduleshowPattern to round-trip.
It is claimed that showPattern round-trips, but does not:
>>> getAllTextMatches ("a \" \\" =~ "[a]") :: [String]
["a"]
>>> let parse = either (error . show) fst . parseRegex
>>> let pp' = showPattern . parse
>>> getAllTextMatches ("a \" \\" =~ pp' "[a]") :: [String]
["a","\""]
It uses Show PatternSet which adds " coming from empty components of PatternSet:
regex-tdfa/lib/Text/Regex/TDFA/Pattern.hs
Lines 102 to 109 in c5b8f54
| showsPrec i (PatternSet s scc sce sec) = | |
| let (special,normal) = maybe ("","") ((partition (`elem` "]-")) . Set.toAscList) s | |
| charSpec = (if ']' `elem` special then (']':) else id) (byRange normal) | |
| scc' = maybe "" ((concatMap show) . Set.toList) scc | |
| sce' = maybe "" ((concatMap show) . Set.toList) sce | |
| sec' = maybe "" ((concatMap show) . Set.toList) sec | |
| in shows charSpec | |
| . showsPrec i scc' . showsPrec i sce' . showsPrec i sec' |
Metadata
Metadata
Assignees
Labels
No labels