haskell-tools-ast-fromghc- Creating the Haskell-Tools AST from GHC's representations

Safe HaskellNone



A representation of the tokens that build up the source file.



getKeywordAnywhere :: AnnKeywordId -> SourceMap -> Maybe SrcSpan Source #

Returns the first occurrence of the keyword in the whole source file

getKeywordInside :: AnnKeywordId -> SrcSpan -> SourceMap -> Maybe SrcSpan Source #

Get the source location of a token restricted to a certain source span

getNextToken :: SrcLoc -> SourceMap -> Maybe (SrcSpan, AnnKeywordId) Source #

Returns the next token on the token stream (including the token that starts on the given location)

getTokensAfter :: SrcLoc -> SourceMap -> [(SrcSpan, AnnKeywordId)] Source #

Returns all subsequent tokens (including the token that starts on the given location)

annotationsToSrcMap :: Map ApiAnnKey [SrcSpan] -> SourceMap Source #

Converts GHC Annotations into a convenient format for looking up tokens