Module
Type.Regex.Parse
- Package
- purescript-typelevel-regex
- Repository
- thought2/purescript-typelevel-regex
#ErrorMissingClose Source
type ErrorMissingClose :: Doc
type ErrorMissingClose = MkError (Text "Parenthesis mismatch: Missing \')\'")
#ErrorMissingOpen Source
type ErrorMissingOpen :: Doc
type ErrorMissingOpen = MkError (Text "Parenthesis mismatch: Missing \'(\'")
#ErrorIllegalQuantification Source
type ErrorIllegalQuantification :: Doc
type ErrorIllegalQuantification = MkError (Text "Nothing to repeat")
#ErrorInvalidRange Source
type ErrorInvalidRange :: Doc
type ErrorInvalidRange = MkError (Text "Invalid character range")
#UnexpectedEndOfCharClass Source
type UnexpectedEndOfCharClass :: Doc
type UnexpectedEndOfCharClass = MkError (Text "Unexpected end of character class")
#ErrorUnexpectedEnd Source
type ErrorUnexpectedEnd :: Doc
type ErrorUnexpectedEnd = Text "Regex Parse Error: Unexpected end"
#ParseRegex Source
class ParseRegex :: Symbol -> Regex -> Constraint
class ParseRegex (spec :: Symbol) (regex :: Regex) | spec -> regex
Instances
(ParseRegexAtDepth spec 0 "" regex) => ParseRegex spec regex
#parseRegex Source
parseRegex :: forall @spec regex. ParseRegex spec regex => Proxy regex
#ParseRegexAtDepth Source
class ParseRegexAtDepth :: Symbol -> Int -> Symbol -> Regex -> Constraint
class ParseRegexAtDepth (spec :: Symbol) (depth :: Int) (rest :: Symbol) (regex :: Regex) | spec depth -> rest regex
Instances
(ParseRegexGo spec Nil depth rest regex, ReverseRegex regex regex') => ParseRegexAtDepth spec depth rest regex'
#ParseRegexGo Source
class ParseRegexGo :: Symbol -> Regex -> Int -> Symbol -> Regex -> Constraint
class ParseRegexGo (sym :: Symbol) (regexFrom :: Regex) (depth :: Int) (rest :: Symbol) (regexTo :: Regex) | sym regexFrom depth -> rest regexTo
Instances
ParseRegexGo "" regex 0 "" regex
(Fail ErrorMissingClose) => ParseRegexGo "" regex depth "" regex
(Cons head tail sym, ParseRegexMatch head tail regexFrom depth rest regexTo) => ParseRegexGo sym regexFrom depth rest regexTo
#ParseRegexMatch Source
class ParseRegexMatch :: Symbol -> Symbol -> Regex -> Int -> Symbol -> Regex -> Constraint
class ParseRegexMatch (head :: Symbol) (tail :: Symbol) (regexFrom :: Regex) (depth :: Int) (rest :: Symbol) (regex :: Regex) | head tail regexFrom depth -> rest regex
Instances
(Fail ErrorMissingOpen) => ParseRegexMatch ")" tail regexFrom 0 rest regexTo
ParseRegexMatch ")" tail regex depth tail regex
(Increment depth depthNext, ParseRegexAtDepth tail depthNext rest' regexTo', ParseRegexGo rest' (Cat (Group regexTo') regexFrom) depth rest regexTo) => ParseRegexMatch "(" tail regexFrom depth rest regexTo
(ParseRegexGo tail (Cat Wildcard regexFrom) depth rest regexTo) => ParseRegexMatch "." tail regexFrom depth rest regexTo
(ParseRegexGo tail (Cat StartOfStr regexFrom) depth rest regexTo) => ParseRegexMatch "^" tail regexFrom depth rest regexTo
(ParseRegexGo tail (Cat EndOfStr regexFrom) depth rest regexTo) => ParseRegexMatch "$" tail regexFrom depth rest regexTo
(ParseRegexGo tail (Cat (Optional regexHead) regexTail) depth rest regexTo, IsQuantifiable regexHead) => ParseRegexMatch "?" tail (Cat regexHead regexTail) depth rest regexTo
(Fail ErrorIllegalQuantification) => ParseRegexMatch "?" tail regex depth rest regexTo
(ParseRegexGo tail (Cat (OneOrMore regexHead) regexTail) depth rest regexTo, IsQuantifiable regexHead) => ParseRegexMatch "+" tail (Cat regexHead regexTail) depth rest regexTo
(Fail ErrorIllegalQuantification) => ParseRegexMatch "?" tail regex depth rest regexTo
(ParseRegexGo tail (Cat (Many regexHead) regexTail) depth rest regexTo, IsQuantifiable regexHead) => ParseRegexMatch "*" tail (Cat regexHead regexTail) depth rest regexTo
(Fail ErrorIllegalQuantification) => ParseRegexMatch "?" tail regex depth rest regexTo
(ParseRegexAtDepth tail depth rest regexTo, Decrement depth depth', ReverseRegex regex regex') => ParseRegexMatch "|" tail regex depth rest (Cat (Alt regex' regexTo) Nil)
(Cons "[" tail sym, ParseCharacterClass sym rest charClass positive, ParseRegexGo rest (Cat (RegexCharClass charClass positive) regexFrom) depth rest' regexTo) => ParseRegexMatch "[" tail regexFrom depth rest' regexTo
(ParseRegexGo tail' (Cat (Quote char) regexFrom) depth rest regexTo, Cons head' tail' tail, SymIsChar head' char) => ParseRegexMatch "\\" tail regexFrom depth rest regexTo
(ParseRegexGo tail (Cat (Lit char) regexFrom) depth rest regexTo, SymIsChar head char) => ParseRegexMatch head tail regexFrom depth rest regexTo
#ParseCharacterClass Source
class ParseCharacterClass :: Symbol -> Symbol -> CharClass -> Boolean -> Constraint
class ParseCharacterClass (sym :: Symbol) (rest :: Symbol) (chars :: CharClass) (positive :: Boolean) | sym -> rest chars positive
Instances
(ConsOrFail (Text "Regex Parse Error: Expecting \'[\'") "[" tail sym, ParseCharacterClassGo tail CharClassNil rest positive charClass) => ParseCharacterClass sym rest charClass positive
#parseCharacterClass Source
parseCharacterClass :: forall @sym @rest @chars @positive. ParseCharacterClass sym rest chars positive => Unit
#ParseCharacterClassGo Source
class ParseCharacterClassGo :: Symbol -> CharClass -> Symbol -> Boolean -> CharClass -> Constraint
class ParseCharacterClassGo (sym :: Symbol) (charsIn :: CharClass) (rest :: Symbol) (positive :: Boolean) (chars :: CharClass) | sym charsIn -> rest positive chars
Instances
(Fail UnexpectedEndOfCharClass) => ParseCharacterClassGo "" charsClassFrom rest positive charsClassTo
(Cons head tail sym, ParseCharacterClassMatch head tail charsClassFrom rest positive charsClassTo) => ParseCharacterClassGo sym charsClassFrom rest positive charsClassTo
#ParseCharacterClassMatch Source
class ParseCharacterClassMatch :: Symbol -> Symbol -> CharClass -> Symbol -> Boolean -> CharClass -> Constraint
class ParseCharacterClassMatch (head :: Symbol) (tail :: Symbol) (charClassFrom :: CharClass) (rest :: Symbol) (positive :: Boolean) (charClassTo :: CharClass) | head tail charClassFrom -> rest positive charClassTo
Instances
ParseCharacterClassMatch "]" tail charClass tail True charClass
(ParseCharacterClassGo tail CharClassNil tail' positive charClass') => ParseCharacterClassMatch "^" tail CharClassNil tail' False charClass'
(Cons head' tail' tail, SymIsChar head' char, ParseCharacterClassGo tail' (CharClassLit char charClassFrom) rest positive charClassTo) => ParseCharacterClassMatch "\\" tail charClassFrom rest positive charClassTo
(ConsOrFail ErrorUnexpectedEnd charEnd' tail' tail, SymIsChar charEnd' charEnd, ParseCharacterClassGo tail' (CharClassRange charStart charEnd charClassFrom) rest positive charClassTo) => ParseCharacterClassMatch "-" tail (CharClassLit charStart charClassFrom) rest positive charClassTo
(SymIsChar head char, ParseCharacterClassGo tail (CharClassLit char charClassFrom) rest positive charClassTo) => ParseCharacterClassMatch head tail charClassFrom rest positive charClassTo
#ConsOrFail Source
class ConsOrFail :: Doc -> Symbol -> Symbol -> Symbol -> Constraint
class ConsOrFail (doc :: Doc) (head :: Symbol) (tail :: Symbol) (sym :: Symbol) | sym -> head tail
Instances
(Fail doc) => ConsOrFail doc head tail ""
(Cons head tail sym) => ConsOrFail doc head tail sym
#IsQuantifiable Source
class IsQuantifiable :: Regex -> Constraint
class IsQuantifiable (regex :: Regex)
Instances
IsQuantifiable (Lit s)
IsQuantifiable (RegexCharClass positive s)
IsQuantifiable (Group r)
(Fail ErrorIllegalQuantification) => IsQuantifiable r
#ReverseRegex Source
class ReverseRegex :: Regex -> Regex -> Constraint
class ReverseRegex (regexFrom :: Regex) (regexOut :: Regex) | regexFrom -> regexOut
Instances
(ReverseRegexGo regex Nil regexOut) => ReverseRegex regex regexOut
#ReverseRegexGo Source
class ReverseRegexGo :: Regex -> Regex -> Regex -> Constraint
class ReverseRegexGo (regex :: Regex) (regexFrom :: Regex) (regexTo :: Regex) | regex regexFrom -> regexTo
Instances
ReverseRegexGo Nil a a
(ReverseRegexGo tail (Cat head regexFrom) regexTo) => ReverseRegexGo (Cat head tail) regexFrom regexTo