Safe Haskell | None |
---|---|
Language | Haskell2010 |
- runParser :: DynFlags -> Parser a -> String -> ParseOutput a
- type LineNumber = Int
- type ColumnNumber = Int
- type ErrMsg = String
- data StringLoc = Loc LineNumber ColumnNumber
- data ParseOutput a
- data Parser a
- data Located a = Located {
- line :: LineNumber
- unloc :: a
- parserStatement :: Parser (Maybe (LStmt RdrName (LHsExpr RdrName)))
- parserImport :: Parser (LImportDecl RdrName)
- parserDeclaration :: Parser (OrdList (LHsDecl RdrName))
- parserTypeSignature :: Parser (Located (OrdList (LHsDecl RdrName)))
- parserModule :: Parser (Located (HsModule RdrName))
- parserExpression :: Parser (LHsExpr RdrName)
- removeComments :: String -> String
- layoutChunks :: String -> [Located String]
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.
A location in an input string.
data ParseOutput a Source #
Output from running a parser.
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. |
Eq a => Eq (ParseOutput a) Source # | |
Show a => Show (ParseOutput a) Source # | |
Store locations along with a value.
Located | |
|
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.