haskell-src-exts-0.5.5: Manipulating Haskell source: abstract syntax, lexer, parser, and pretty-printer

Portabilityportable
Stabilityexperimental
MaintainerNiklas Broberg, d00nibro@dtek.chalmers.se

Language.Haskell.Exts.Parser

Description

 

Synopsis

Documentation

class Parseable ast whereSource

Class to reuse the parse function at many different types

parseModule :: String -> ParseResult ModuleSource

Parse of a string, which should contain a complete Haskell module.

parseModuleWithMode :: ParseMode -> String -> ParseResult ModuleSource

Parse of a string, which should contain a complete Haskell 98 module.

parseExp :: String -> ParseResult ExpSource

Parse of a string containing a Haskell expression.

parseExpWithMode :: ParseMode -> String -> ParseResult ExpSource

Parse of a string, which should contain a complete Haskell 98 module.

parsePat :: String -> ParseResult PatSource

Parse of a string containing a Haskell pattern.

parsePatWithMode :: ParseMode -> String -> ParseResult PatSource

Parse of a string, which should contain a complete Haskell 98 module.

parseDecl :: String -> ParseResult DeclSource

Parse of a string containing a Haskell top-level declaration.

parseDeclWithMode :: ParseMode -> String -> ParseResult DeclSource

Parse of a string, which should contain a complete Haskell 98 module.

parseType :: String -> ParseResult TypeSource

Parse of a string containing a Haskell type.

parseTypeWithMode :: ParseMode -> String -> ParseResult TypeSource

Parse of a string, which should contain a complete Haskell 98 module.

getTopPragmas :: String -> ParseResult [OptionPragma]Source

Parse of a string starting with a series of top-level option pragmas.

data ParseMode Source

Static parameters governing a parse. More to come later, e.g. literate mode, language extensions.

Constructors

ParseMode 

Fields

parseFilename :: String

original name of the file being parsed

extensions :: [Extension]

list of extensions enabled

ignoreLanguagePragmas :: Bool

if True, the parser won't look for further extensions in LANGUAGE pragmas in source files

fixities :: [Fixity]

list of fixities to be aware of

defaultParseMode :: ParseModeSource

Default parameters for a parse, currently just a marker for an unknown filename.

data ParseResult a Source

The result of a parse.

Constructors

ParseOk

The parse succeeded, yielding a value.

Fields

unParseOk :: a
 
ParseFailed SrcLoc String

The parse failed at the specified source location, with an error message.