Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
AUTHOR
- Dr. Alistair Ward
DESCRIPTION
- Describes the set of polymorphic data, which can be matched.
- Only permits a match against exactly one polymorphic datum, which distinguishes it from a zero-width assertion, like an anchor, word-boundary, or look-ahead assertion.
- Designed to be used by a polymorphic regex-engine, to implement the traditional meta-characters;
. [] [^]
. - Permits Perl-style shortcuts for commonly used
Meta
-data, to be canned & assigned a single-Char
mnemonic for subsequent reference; the implementation ofRead
looks for a back-slashedChar
, for which it expects there to be a corresponding cannedMeta
. Since this class is polymorphic, it has no knowledge of what shortcuts might be appropriate for the chosen type-parameter, so the expansion from the back-slashedChar
to correspondingMeta
-data, is performed through theexpand
interface of theShortcutExpander
class, which should be implemented elsewhere.
Synopsis
- class ShortcutExpander m => ShortcutExpander m where
- data Meta m
- = Any
- | Literal m
- | AnyOf (BracketExpression m)
- | NoneOf (BracketExpression m)
- | Predicate (ShowablePredicate m)
- shortcutToken :: Char
- anyToken :: Char
- tokens :: String
- isMatch :: Eq m => m -> Meta m -> Bool
Type-classes
class ShortcutExpander m => ShortcutExpander m where Source #
- The interface via which Perl-style shortcuts are expanded, in a manner appropriate to the chosen type-parameter.
- Since the expansion of Perl-style shortcuts, is more restricted inside than outside a
BracketExpression
, the former is considered to be a superclass, providing a base from which to build alternative implementations.
Types
Data-types
Declares a polymorphic data-type.
Any | Any datum matches. Equivalent to |
Literal m | The datum matches, if it's equal to the specified value. Equivalent to |
AnyOf (BracketExpression m) | The datum matches, if |
NoneOf (BracketExpression m) | The datum matches, if |
Predicate (ShowablePredicate m) | The datum matches if |
Instances
Eq m => Eq (Meta m) Source # | |
(ShortcutExpander m, Read m) => Read (Meta m) Source # | |
Show m => Show (Meta m) Source # | |
NFData m => NFData (Meta m) Source # | |
Defined in RegExDot.Meta | |
SelfValidator (Meta m) Source # | |
Consumer (Meta m) Source # | |
Defined in RegExDot.Meta consumptionProfile :: Meta m -> ConsumptionProfile Source # starHeight :: Meta m -> StarHeight Source # |
Constants
shortcutToken :: Char Source #
The token used to precede a Perl-style shortcut, when in the String
-form.