Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
makePygments :: SharedOptions -> CF -> Backend Source #
pyRegex :: Reg -> Doc Source #
Convert a Reg to a python regex
>>> pyRegex (RSeqs "abc")
abc
>>> pyRegex (RAlt (RSeqs "::=") (RChar .
))
::=|.
>>> pyRegex (RChar '=')
=
>>> pyRegex RAny
.
>>> pyRegex (RStar RAny)
.*
>>> pyRegex (RPlus (RSeqs "xxx"))
(xxx)+
>>> pyRegex (ROpt (RSeqs "abc"))
(abc)?
>>> pyRegex (RSeq (RSeqs "--") (RSeq (RStar RAny) (RChar 'n')))
--.*n
>>> pyRegex (RStar (RSeq (RSeqs "abc") (RChar *
)))
(abc*)*
>>> pyRegex REps
BLANKLINE
>>> pyRegex (RAlts "abc[].")
[abc[].]
>>> pyRegex RDigit
d
>>> pyRegex RLetter
[a-zA-Z]
>>> pyRegex RUpper
[A-Z]
>>> pyRegex RLower
[a-z]
>>> pyRegex (RMinus RAny RDigit)
(.)(?<!d)
>>> pyRegex (RSeq (RAlt (RChar a
) RAny) (RAlt (RChar b
) (RChar c
)))
(a|.)(b|c)