This module contains the building blocks used to construct the lexer.
- lexToken :: Parser Token
- token :: (String -> Parser tok) -> LexAction tok
- withInterval :: ((Interval, String) -> tok) -> LexAction tok
- withInterval' :: (String -> a) -> ((Interval, a) -> tok) -> LexAction tok
- withInterval_ :: (Interval -> r) -> LexAction r
- withLayout :: LexAction r -> LexAction r
- begin :: LexState -> LexAction Token
- end :: LexAction Token
- endWith :: LexAction a -> LexAction a
- begin_ :: LexState -> LexAction Token
- end_ :: LexAction Token
- lexError :: String -> Parser a
- keyword :: Keyword -> LexAction Token
- symbol :: Symbol -> LexAction Token
- identifier :: LexAction Token
- literal :: Read a => (Range -> a -> Literal) -> LexAction Token
- followedBy :: Char -> LexPredicate
- eof :: LexPredicate
- inState :: LexState -> LexPredicate
Parse a token from an
Interval and the lexed string.
withInterval, but applies a function to the string.
Return a token without looking at the lexed string.
Executed for layout keywords. Enters the
state and performs the given action.
For lexical errors we want to report the current position as the site of
the error, whereas for parse errors the previous position is the one
we're interested in (since this will be the position of the token we just
lexed). This function does
parseErrorAt the current position.
Parse an identifier. Identifiers can be qualified (see
True when the given character is the next character of the input string.