| Agda-2.2.6: A dependently typed functional programming language and proof assistant | Source code | Contents | Index

Agda.Syntax.Parser.Alex

Contents

Alex requirements
Lex actions
Monad operations

Description
This module defines the things required by Alex and some other Alex related things.
Synopsis

data AlexInput = AlexInput {

lexPos :: !Position
lexInput :: String
lexPrevChar :: !Char

}

alexInputPrevChar :: AlexInput -> Char
alexGetChar :: AlexInput -> Maybe (Char, AlexInput)
type LexAction r = PreviousInput -> CurrentInput -> TokenLength -> Parser r
type LexPredicate = ([LexState], ParseFlags) -> PreviousInput -> TokenLength -> CurrentInput -> Bool
(.&&.) :: LexPredicate -> LexPredicate -> LexPredicate
(.||.) :: LexPredicate -> LexPredicate -> LexPredicate
not' :: LexPredicate -> LexPredicate
type PreviousInput = AlexInput
type CurrentInput = AlexInput
type TokenLength = Int
getLexInput :: Parser AlexInput
setLexInput :: AlexInput -> Parser ()

Alex requirements

data AlexInput | Source

This is what the lexer manipulates.
Constructors

AlexInput |

lexPos :: !Position | current position
lexInput :: String | current input
lexPrevChar :: !Char | previously read character

alexInputPrevChar :: AlexInput -> Char | Source

Get the previously lexed character. Same as `lexPrevChar`. Alex needs this to be defined to handle "patterns with a left-context".

alexGetChar :: AlexInput -> Maybe (Char, AlexInput) | Source

Lex a character. No surprises.
Lex actions

type LexAction r = PreviousInput -> CurrentInput -> TokenLength -> Parser r | Source

In the lexer, regular expressions are associated with lex actions who's task it is to construct the tokens.

type LexPredicate = ([LexState], ParseFlags) -> PreviousInput -> TokenLength -> CurrentInput -> Bool | Source

Sometimes regular expressions aren't enough. Alex provides a way to do arbitrary computations to see if the input matches. This is done with a lex predicate.

(.&&.) :: LexPredicate -> LexPredicate -> LexPredicate | Source

Conjunction of `LexPredicate`s.

(.||.) :: LexPredicate -> LexPredicate -> LexPredicate | Source

Disjunction of `LexPredicate`s.

not' :: LexPredicate -> LexPredicate | Source

Negation of `LexPredicate`s.

type PreviousInput = AlexInput | Source

type CurrentInput = AlexInput | Source

type TokenLength = Int | Source

Monad operations

getLexInput :: Parser AlexInput | Source

setLexInput :: AlexInput -> Parser () | Source

Produced by Haddock version 2.4.2