BNFC-2.9.4.1: A compiler front-end generator.
Safe HaskellNone
LanguageHaskell2010

BNFC.Backend.Pygments

Synopsis

Documentation

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)