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

Safe HaskellSafe-Inferred

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 whereSource

  • 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.

Methods

expandSource

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) 
(ShortcutExpander m, Read m) => Read (Meta m) 
Show m => Show (Meta m) 
NFData m => NFData (Meta m) 
SelfValidator (Meta m) 
Consumer (Meta m) 

Constants

shortcutToken :: CharSource

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

anyToken :: CharSource

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

tokens :: StringSource

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

Functions

Predicates

isMatchSource

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.