ghc-parser-0.2.0.1: Haskell source parser from GHC.

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.GHC.Parser

Synopsis

Documentation

runParser :: DynFlags -> Parser a -> String -> ParseOutput a Source #

Run a GHC parser on a string. Return success or failure with associated information for both.

type LineNumber = Int Source #

A line number in an input string.

type ColumnNumber = Int Source #

A column number in an input string.

type ErrMsg = String Source #

An error message string.

data StringLoc Source #

A location in an input string.

data ParseOutput a Source #

Output from running a parser.

Constructors

Failure ErrMsg StringLoc

Parser failed with given error message and location.

Parsed a

Parser succeeded with an output.

Partial a (String, String)

Partial parser succeeded with an output.

Instances

data Parser a Source #

data Located a Source #

Store locations along with a value.

Constructors

Located 

Fields

Instances

Functor Located Source # 

Methods

fmap :: (a -> b) -> Located a -> Located b #

(<$) :: a -> Located b -> Located a #

Eq a => Eq (Located a) Source # 

Methods

(==) :: Located a -> Located a -> Bool #

(/=) :: Located a -> Located a -> Bool #

Show a => Show (Located a) Source # 

Methods

showsPrec :: Int -> Located a -> ShowS #

show :: Located a -> String #

showList :: [Located a] -> ShowS #

removeComments :: String -> String Source #

Drop comments from Haskell source. Simply gets rid of them, does not replace them in any way.

layoutChunks :: String -> [Located String] Source #

Split an input string into chunks based on indentation. A chunk is a line and all lines immediately following that are indented beyond the indentation of the first line. This parses Haskell layout rules properly, and allows using multiline expressions via indentation.

Quasiquotes are allowed via a post-processing step.