lexer-applicative-1.0: Simple lexer based on applicative regular expressions

Safe HaskellSafe-Inferred
LanguageHaskell2010

Language.Lexer.Applicative

Description

Synopsis

Documentation

tokens Source

Arguments

:: RE Char token

regular expression for tokens

-> RE Char ()

regular expression for whitespace and comments

-> String

source file name (used in locations)

-> String

source text

-> [L token] 

The lexer.

In case of a lexical error, throws the LexicalError exception. This may seem impure compared to using Either, but it allows to consume the token list lazily.

data LexicalError Source

The lexical error exception

Constructors

LexicalError !Pos