Copyright | (c) 2024 Pierre Le Marre |
---|---|
Maintainer | dev@wismill.eu |
Stability | experimental |
Safe Haskell | None |
Language | GHC2021 |
Miscellaneous bits common to various parsers
Synopsis
- readCodePoint :: ByteString -> Char
- readCodePointM :: ByteString -> Maybe Char
- data UnicodeRange a
- = SingleChar {
- _first :: !Char
- | CharRange {
- _first :: !Char
- _last :: !Char
- _rangeName :: !a
- = SingleChar {
- parseRange :: ByteString -> UnicodeRange ()
- pattern Comma :: Word8
- pattern HashTag :: Word8
- pattern NewLine :: Word8
- pattern Period :: Word8
- pattern SemiColon :: Word8
- pattern Slash :: Word8
Documentation
readCodePoint :: ByteString -> Char Source #
Parse a code point formatted as hexadecimal
Warning: raise an error on invalid input.
>>>
readCodePoint "0061"
'a'
Since: 0.1.0
readCodePointM :: ByteString -> Maybe Char Source #
Parse a code point formatted as hexadecimal, or return Nothing
on an
empty string.
Warning: raise an error on invalid input.
>>>
readCodePointM "0061"
Just 'a'>>>
readCodePointM ""
Nothing
See also: readCodePoint
.
Since: 0.1.0
data UnicodeRange a Source #
A Unicode code point range
Since: 0.1.0
SingleChar | |
| |
CharRange | |
|
Instances
Show a => Show (UnicodeRange a) Source # | |
Defined in UCD.Parser.Common showsPrec :: Int -> UnicodeRange a -> ShowS show :: UnicodeRange a -> String showList :: [UnicodeRange a] -> ShowS | |
Eq a => Eq (UnicodeRange a) Source # | |
Defined in UCD.Parser.Common (==) :: UnicodeRange a -> UnicodeRange a -> Bool (/=) :: UnicodeRange a -> UnicodeRange a -> Bool |
parseRange :: ByteString -> UnicodeRange () Source #
Parse AAAA..BBBB
range
Since: 0.1.0