regexdot-0.12.1.0: A polymorphic, POSIX, extended regex-engine.

Safe HaskellSafe
LanguageHaskell2010

RegExDot.Meta

Contents

Description

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 of Read looks for a back-slashed Char, for which it expects there to be a corresponding canned Meta. 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-slashed Char to corresponding Meta-data, is performed through the expand interface of the ShortcutExpander class, which should be implemented elsewhere.

Synopsis

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.

Minimal complete definition

expand

Methods

expand Source #

Arguments

:: Char 
-> Meta m

Expand a Perl-style shortcut.

Types

Data-types

data Meta m Source #

Declares a polymorphic data-type.

Constructors

Any

Any datum matches. Equivalent to NoneOf [], but more efficient. CAVEAT: independent of the type-parameter a.

Literal m

The datum matches, if it's equal to the specified value. Equivalent to AnyOf [BracketExpression.Literal x], but more efficient.

AnyOf (BracketExpression m)

The datum matches, if containsMatch.

NoneOf (BracketExpression m)

The datum matches, if not BracketExpression.containsMatch.

Predicate (ShowablePredicate m)

The datum matches if ShowablePredicate.

Instances

Eq m => Eq (Meta m) Source # 

Methods

(==) :: Meta m -> Meta m -> Bool #

(/=) :: Meta m -> Meta m -> Bool #

(ShortcutExpander m, Read m) => Read (Meta m) Source # 
Show m => Show (Meta m) Source # 

Methods

showsPrec :: Int -> Meta m -> ShowS #

show :: Meta m -> String #

showList :: [Meta m] -> ShowS #

NFData m => NFData (Meta m) Source # 

Methods

rnf :: Meta m -> () #

SelfValidator (Meta m) Source # 

Methods

getErrors :: Meta m -> [String] #

isValid :: Meta m -> Bool #

Consumer (Meta m) Source # 

Constants

shortcutToken :: Char Source #

The token used to precede a Perl-style shortcut, when in the String-form.

anyToken :: Char Source #

The token used to denote Any, when in the String-form.

tokens :: String Source #

The set of Char to which a specific meaning is attributed, when reading from String.

Functions

Predicates

isMatch Source #

Arguments

:: Eq m 
=> m

The input datum.

-> Meta m

The meta-entity against which the input datum is to be matched.

-> Bool

The result of the match-operation.

True if the specified datum matches.