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

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.Tools.AST.FromGHC.SourceMap

Description

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

Synopsis

Documentation

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