language-qux-0.1.1.3: Utilities for working with the Qux language

Copyright(c) Henry J. Wylde, 2015
LicenseBSD3
Maintainerpublic@hjwylde.com
Safe HaskellNone
LanguageHaskell2010

Language.Qux.Annotated.Parser

Contents

Description

A Text.Parsec indentation-based parser for generating a Program.

Synopsis

Types

type Parser a = ParsecT String () (State SourcePos) a Source

A ParsecT that retains indentation information.

data ParseError :: *

The abstract data type ParseError represents parse errors. It provides the source position (SourcePos) of the error and a list of error messages (Message). A ParseError can be returned by the function parse. ParseError is an instance of the Show and Eq classes.

data SourcePos :: *

The abstract data type SourcePos represents source positions. It contains the name of the source (i.e. file name), a line number and a column number. SourcePos is an instance of the Show, Eq and Ord class.

sourceName :: SourcePos -> SourceName

Extracts the name of the source from a source position.

sourceLine :: SourcePos -> Line

Extracts the line number from a source position.

sourceColumn :: SourcePos -> Column

Extracts the column number from a source position.

Parsing

parse :: Parser a -> SourceName -> String -> Except ParseError a Source

parse parser sourceName input parses input using parser. Returns either a ParseError or a. This method wraps runParserT by running the indentation resolver over the parser's state.

Parsers