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

RegExDot.Repeatable

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION
• A data-type, which represents the permissible range of instances, of the underlying polymorphic datum.
• Designed for use in a polymorphic regex-engine, which specifies patterns composed of repeated greedy & non-greedy sequences of Meta-data;
		*	+	?	{fewest, most}	{fewest,}	{fewest}
*?	+?	??	{fewest, most}?	{fewest,}?
• In the context of regexes, this concept is known as Quantification.
• regexes evolved from the minimal ability to optionally qualify the datum with a https://en.wikipedia.org/wiki/Kleene_star suffix. More exotic repetition-specifications could be composed by concatenating these atomic building-blocks. Here, I've taken the contrary top-down view, & assumed that all data are qualified by a full RepetitionBounds, which in most cases will degenerate into a simpler form.
• The type of entity which is being repeated, isn't the domain of this data-type; it's polymorphic.
Synopsis

# Types

## Type-synonyms

A number of repetitions.

Defines the bounds of a range of permissible repetitions.

## Data-types

data Repeatable a Source #

Declares a polymorphic data-type, which augments the underlying base datum, with the range of times it may be used.

Constructors

 MkRepeatable Fieldsbase :: aThe underlying polymorphic datum.repetitionBounds :: RepetitionBoundsThe bounds delimiting the range of permissible repetitions, of base.isGreedy :: BoolWhether to demand as many matching instances of base as possible; or as few (AKA lazy quantification).
Instances
 Source # Instance detailsDefined in RegExDot.Repeatable Methodsfmap :: (a -> b) -> Repeatable a -> Repeatable b #(<\$) :: a -> Repeatable b -> Repeatable a # Eq a => Eq (Repeatable a) Source # Instance detailsDefined in RegExDot.Repeatable Methods(==) :: Repeatable a -> Repeatable a -> Bool #(/=) :: Repeatable a -> Repeatable a -> Bool # Read a => Read (Repeatable a) Source # Instance detailsDefined in RegExDot.Repeatable MethodsreadsPrec :: Int -> ReadS (Repeatable a) # Show a => Show (Repeatable a) Source # Instance detailsDefined in RegExDot.Repeatable MethodsshowsPrec :: Int -> Repeatable a -> ShowS #show :: Repeatable a -> String #showList :: [Repeatable a] -> ShowS # NFData a => NFData (Repeatable a) Source # Instance detailsDefined in RegExDot.Repeatable Methodsrnf :: Repeatable a -> () # Source # Instance detailsDefined in RegExDot.Repeatable MethodsgetErrors :: Repeatable a -> [String] #isValid :: Repeatable a -> Bool # Consumer a => Consumer (Repeatable a) Source # Instance detailsDefined in RegExDot.Repeatable MethodsstarHeight :: Repeatable a -> StarHeight Source #

# Constants

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

The delimiters of ^#->#, when in the String-form.

The token used to separate RepetitionBounds, when in the String-form.

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

• The token used to denote zeroOrMore, when in the String-form.
• AKA Kleene Star.

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

# Functions

one :: a -> Repeatable a Source #

• Construct a Repeatable, tailored for unrepeated data.
• A degenerate case of ^#.

oneOrMore :: a -> Repeatable a Source #

• Construct a greedy Repeatable, from a polymorphic datum, with lower RepetitionBounds == one.
• A specific case of ^#->.

oneOrMore' :: a -> Repeatable a Source #

Construct a non-greedy version of oneOrMore.

zeroOrMore :: a -> Repeatable a Source #

• Construct a greedy Repeatable, from a polymorphic datum, with fewest == 0.
• A specific case of ^#->.

zeroOrMore' :: a -> Repeatable a Source #

Construct a non-greedy version of zeroOrMore.

zeroOrOne :: a -> Repeatable a Source #

• Construct a greedy Repeatable, from a polymorphic datum, with fewest == 0 & most == 1.
• A specific case of ^#->#.

zeroOrOne' :: a -> Repeatable a Source #

Construct a non-greedy version of zeroOrOne.

repeatableParser :: a -> Parser (Repeatable a) Source #

Builds a parser for a specification of the number of permissible instances of the specified polymorphic parameter.

• A ShowS-function for the suffix, denoting the permissible repetitions, of base.
• This function converts the internal, into the tradition greedy & non-greedy quantifiers of various specific varieties.

Accessor.

Accessor.

## Mutators

Reduces a Repeatable, with a range of RepetitionBounds, to a precise number of repetitions.

• Reduces a Repeatable, with a range of RepetitionBounds, to a singleton.
• A degenerate case of focus.

## Operators

(^#->#) infix 6 Source #

Arguments

 :: a The polymorphic payload from which to construct the Repeatable. -> RepetitionBounds The permissible repetition-bounds for the polymorphic data. -> Repeatable a
• Construct a greedy Repeatable, from a polymorphic datum, with the specified range of permissible instances.
• The #s in the identifier represent the two bounds.
• a{f, m}

(^#->#?) infix 6 Source #

Arguments

 :: a The polymorphic payload from which to construct the Repeatable. -> RepetitionBounds The permissible repetition-bounds for the polymorphic data. -> Repeatable a
• Construct a non-greedy version of ^#->#.
• a{f, m}?

(^#->) infix 6 Source #

Arguments

 :: a The polymorphic payload from which to construct the Repeatable. -> Repetitions The minimum permissible repetitions of the polymorphic data. -> Repeatable a
• Construct a greedy Repeatable, tailored for data repeated at least the specified number of times.
• The # in the identifier represents the single bound.
• a{f,}

(^#->?) infix 6 Source #

Arguments

 :: a The polymorphic payload from which to construct the Repeatable. -> Repetitions The minimum permissible repetitions of the polymorphic data. -> Repeatable a
• Construct a non-greedy version of ^#->.
• a{f,}?

(^#) infix 6 Source #

Arguments

 :: a The polymorphic payload from which to construct the Repeatable. -> Repetitions The precise number of repetitions of the polymorphic data which is required. -> Repeatable a
• Construct a Repeatable, tailored for data repeated a precise number of times.
• The # in the identifier represents the single bound.
• a{f}

## Predicates

True if there's no choice in the number of repetitions; implemented via isPrecise.

Predicate which is True if exactly one value is permissible, ie lower & upper bounds on the number of Repetitions are identical.