Text.Regex.XMLSchema.Generic.RegexParser

hxt-regex-xmlschema-9.2.0.3: A regular expression library for W3C XML Schema regular expressions

Copyright | Copyright (C) 2014- Uwe Schmidt
License | MIT
Maintainer | Uwe Schmidt (uwe@fh-wedel.de)
Stability | stable
Portability | portable
Safe Haskell | Safe
Language | Haskell2010

Text.Regex.XMLSchema.Generic.RegexParser

Description

W3C XML Schema Regular Expression Parser

This parser supports the full W3C standard, the complete grammar can be found under http://www.w3.org/TR/xmlschema11-2/#regexs and extensions for all missing set operations, intersection, difference, exclusive or, interleave, complement

Synopsis

- parseRegex :: StringLike s => s -> GenRegex s
- parseRegexExt :: StringLike s => s -> GenRegex s
- parseRegex' :: StringLike s => String -> GenRegex s
- parseRegexExt' :: StringLike s => String -> GenRegex s
- parseContextRegex :: StringLike s => (String -> GenRegex s) -> s -> GenRegex s

# Documentation

parseRegex :: StringLike s => s -> GenRegex s #

parse a standard W3C XML Schema regular expression

parseRegexExt :: StringLike s => s -> GenRegex s #

parse an extended syntax W3C XML Schema regular expression

The Syntax of the W3C XML Schema spec is extended by further useful set operations, like intersection, difference, exor. Subexpression match becomes possible with "named" pairs of parentheses. The multi char escape sequence \a represents any Unicode char, The multi char escape sequence \A represents any Unicode word, (\A = \a*). All syntactically wrong inputs are mapped to the Zero expression representing the empty set of words. Zero contains as data field a string for an error message. So error checking after parsing becomes possible by checking against Zero (`isZero` predicate)

parseRegex' :: StringLike s => String -> GenRegex s #

parseRegexExt' :: StringLike s => String -> GenRegex s #

parseContextRegex :: StringLike s => (String -> GenRegex s) -> s -> GenRegex s #

parse a regular expression surrounded by contenxt spec

a leading `^` denotes start of text, a trailing `$` denotes end of text, a leading `\<` denotes word start, a trailing `\>` denotes word end.

The 1. param ist the regex parser (`parseRegex` or `parseRegexExt`)