Skip to content

Commit e5db8e2

Browse files
committed
ReadRedex: document BracketElement alternatives
1 parent a19dcb3 commit e5db8e2

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/Text/Regex/TDFA/ReadRegex.hs

+9-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
-- Lazy\/Possessive\/Backrefs are not recognized. Anchors \^ and \$ are
33
-- recognized.
44
--
5-
-- The PGroup returned always have (Maybe GroupIndex) set to (Just _)
6-
-- and never to Nothing.
5+
-- A 'PGroup' returned always has @(Maybe 'GroupIndex')@ set to @(Just _)@
6+
-- and never to @Nothing@.
77

88
module Text.Regex.TDFA.ReadRegex (parseRegex) where
99

@@ -17,8 +17,13 @@ import Text.ParserCombinators.Parsec((<|>), (<?>),
1717
import Control.Monad(liftM, when, guard)
1818
import qualified Data.Set as Set(fromList)
1919

20-
-- | BracketElement is internal to this module
21-
data BracketElement = BEChar Char | BEChars String | BEColl String | BEEquiv String | BEClass String
20+
-- | An element inside @[...]@, denoting a character class.
21+
data BracketElement
22+
= BEChar Char -- ^ A single character.
23+
| BEChars String -- ^ A sequence of characters expanded from a range (e.g. @a-z@).
24+
| BEColl String -- ^ @foo@ in @[.foo.]@.
25+
| BEEquiv String -- ^ @bar@ in @[=bar=]@.
26+
| BEClass String -- ^ A POSIX character class (candidate), e.g. @alpha@ parsed from @[:alpha:]@.
2227

2328
-- | Return either an error message or a tuple of the Pattern and the
2429
-- largest group index and the largest DoPa index (both have smallest

0 commit comments

Comments
 (0)