Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data LookAhead a
- runLookAhead :: (forall b. String -> LookAhead b) -> LookAhead a -> Parser a
- lookAheadError :: String -> LookAhead a
- getInput :: LookAhead AlexInput
- setInput :: AlexInput -> LookAhead ()
- liftP :: Parser a -> LookAhead a
- nextChar :: LookAhead Char
- eatNextChar :: LookAhead Char
- sync :: LookAhead ()
- rollback :: LookAhead ()
- match :: [(String, LookAhead a)] -> LookAhead a -> LookAhead a
- match' :: Char -> [(String, LookAhead a)] -> LookAhead a -> LookAhead a
The LookAhead monad
The LookAhead monad is basically a state monad keeping with an extra
AlexInput
, wrapped around the Parser
monad.
runLookAhead :: (forall b. String -> LookAhead b) -> LookAhead a -> Parser a Source #
Run a LookAhead
computation. The first argument is the error function.
Operations
lookAheadError :: String -> LookAhead a Source #
Throw an error message according to the supplied method.
nextChar :: LookAhead Char Source #
Look at the next character. Fails if there are no more characters.
rollback :: LookAhead () Source #
Undo look-ahead. Restores the input from the ParseState
.
match :: [(String, LookAhead a)] -> LookAhead a -> LookAhead a Source #
Do a case on the current input string. If any of the given strings match we move past it and execute the corresponding action. If no string matches, we execute a default action, advancing the input one character. This function only affects the look-ahead position.