regex-tdfa-1.3.1.1: Pure Haskell Tagged DFA Backend for "Text.Regex" (regex-base)
Safe HaskellNone
LanguageHaskell2010

Text.Regex.TDFA.Pattern

Description

This Text.Regex.TDFA.Pattern module provides the Pattern data type and its subtypes. This Pattern type is used to represent the parsed form of a Regular Expression.

Synopsis

Documentation

data Pattern Source #

Pattern is the type returned by the regular expression parser. This is consumed by the CorePattern module and the tender leaves are nibbled by the TNFA module.

Instances

Instances details
Eq Pattern Source # 
Instance details

Defined in Text.Regex.TDFA.Pattern

Methods

(==) :: Pattern -> Pattern -> Bool #

(/=) :: Pattern -> Pattern -> Bool #

Show Pattern Source # 
Instance details

Defined in Text.Regex.TDFA.Pattern

type GroupIndex = Int Source #

GroupIndex is for indexing submatches from capturing parenthesized groups (PGroup/Group)

newtype DoPa Source #

Used to track elements of the pattern that accept characters or are anchors

Constructors

DoPa 

Fields

Instances

Instances details
Enum DoPa Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

succ :: DoPa -> DoPa #

pred :: DoPa -> DoPa #

toEnum :: Int -> DoPa #

fromEnum :: DoPa -> Int #

enumFrom :: DoPa -> [DoPa] #

enumFromThen :: DoPa -> DoPa -> [DoPa] #

enumFromTo :: DoPa -> DoPa -> [DoPa] #

enumFromThenTo :: DoPa -> DoPa -> DoPa -> [DoPa] #

Eq DoPa Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

(==) :: DoPa -> DoPa -> Bool #

(/=) :: DoPa -> DoPa -> Bool #

Ord DoPa Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

compare :: DoPa -> DoPa -> Ordering #

(<) :: DoPa -> DoPa -> Bool #

(<=) :: DoPa -> DoPa -> Bool #

(>) :: DoPa -> DoPa -> Bool #

(>=) :: DoPa -> DoPa -> Bool #

max :: DoPa -> DoPa -> DoPa #

min :: DoPa -> DoPa -> DoPa #

Show DoPa Source # 
Instance details

Defined in Text.Regex.TDFA.Common

Methods

showsPrec :: Int -> DoPa -> ShowS #

show :: DoPa -> String #

showList :: [DoPa] -> ShowS #

showPattern :: Pattern -> String Source #

I have not been checking, but this should have the property that parsing the resulting string should result in an identical Pattern. This is not true if starTrans has created PNonCapture and PNonEmpty values or a (PStar False). The contents of a "[ ]" grouping are always shown in a sorted canonical order.

Internal use

starTrans :: Pattern -> Pattern Source #

Do the transformation and simplification in a single traversal. This removes the PPlus, PQuest, and PBound values, changing to POr and PEmpty and PStar True/False. For some PBound values it adds PNonEmpty and PNonCapture semantic marker. It also simplifies to flatten out nested POr and PConcat instances and eliminate some unneeded PEmpty values.

Internal use, Operations to support debugging under ghci

simplify' :: Pattern -> Pattern Source #

Function to transform a pattern into an equivalent, but less redundant form. Nested POr and PConcat are flattened. PEmpty is propagated.

dfsPattern Source #

Arguments

:: (Pattern -> Pattern)

The transformation function

-> Pattern

The Pattern to transform

-> Pattern

The transformed Pattern

Apply a Pattern transfomation function depth first