weighted-regexp-0.1.1.0: Weighted Regular Expression Matcher

Stabilityexperimental
MaintainerSebastian Fischer <mailto:sebf@informatik.uni-kiel.de>

Text.RegExp.Matching.LeftLong

Description

This module implements leftmost longest matching based on weighted regular expressions. It should be imported qualified as the interface resembles that provided by other matching modules.

Synopsis

Documentation

data LeftLong Source

Semiring used for leftmost longest matching.

The LeftLong type satisfies the distributive laws only with a precondition on all involved multiplications: multiplied matches must be adjacent and the start position must be smaller than the end position. This precondition is satisfied for all multiplications during regular expression matching.

Constructors

Zero 
One 
LeftLong !Int !Int 

data Matching Source

Subwords of words that match a regular expression are represented as values of type Matching.

Constructors

Matching 

Fields

matchingIndex :: !Int

Start index of the matching subword in the queried word.

matchingLength :: !Int

Length of the matching subword.

Instances

matching :: RegExp c -> [c] -> Maybe MatchingSource

Returns the leftmost longest of all non-empty matchings for a regular expression in a given word. If the empty word is the only matching its position is zero.