Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Utilities related to the parsing and printing of name segments using the default syntax.
Synopsis
- toEscapedText :: NameSegment -> Text
- toEscapedTextBuilder :: NameSegment -> Builder
- parseText :: Text -> Either Text NameSegment
- unsafeParseText :: Text -> NameSegment
- isSymboly :: NameSegment -> Bool
- data ParseErr
- renderParseErr :: ParseErr -> Text
- segmentP :: Monad m => ParsecT (Token ParseErr) [Char] m NameSegment
- symbolyP :: ParsecT (Token Text) [Char] m NameSegment
- wordyP :: ParsecT (Token Text) [Char] m NameSegment
- segmentStartChar :: Char -> Bool
- symbolyIdChar :: Char -> Bool
- wordyIdStartChar :: Char -> Bool
- wordyIdChar :: Char -> Bool
String conversions
toEscapedText :: NameSegment -> Text Source #
Convert a name segment to escaped text, for display purposes.
toEscapedText (unsafeFromText ".~") = "`.~`"
parseText :: Text -> Either Text NameSegment Source #
Parse text as a name segment.
parseText "foo" = Right (NameSegment "foo") parseText ".~" = Left ... parseText "`.~`" = Right (NameSegment ".~")
unsafeParseText :: Text -> NameSegment Source #
Parse text as a name segment.
Name segment parsers
isSymboly :: NameSegment -> Bool Source #
Name segment classifiers
renderParseErr :: ParseErr -> Text Source #
symbolyP :: ParsecT (Token Text) [Char] m NameSegment Source #
A symboly name segment parser, which consists only of symboly characters.
A symboly name segment can optionally be escaped by surrounding it with backticks, which expands the list of allowed symbols to include these three: . ( )
Throws the parsed name segment as an error if it's unescaped and reserved, e.g. "=".
wordyP :: ParsecT (Token Text) [Char] m NameSegment Source #
A wordy name segment parser, which consists only of wordy characters.
Throws the parsed name segment as an error if it's an unescaped keyword, e.g. "match".
Character classifiers
segmentStartChar :: Char -> Bool Source #
symbolyIdChar :: Char -> Bool Source #
wordyIdStartChar :: Char -> Bool Source #
wordyIdChar :: Char -> Bool Source #