Safe Haskell | Safe-Inferred |
---|
- data Entry a
- = Entry !ForestSpan !Layout ![a]
- | Deleted !ForestSpan !RowOffset !SimpPos
- data TokenCache a = TK {}
- data TreeId = TId !Int
- mainTid :: TreeId
- type ForestSpan = (ForestPos, ForestPos)
- type ForestPos = (ForestLine, Int)
- data ForestLine = ForestLine {
- flSpanLengthChanged :: !Bool
- flTreeSelector :: !Int
- flInsertVersion :: !Int
- flLine :: !Int
- type RowOffset = Int
- type ColOffset = Int
- type Row = Int
- type Col = Int
- type SimpPos = (Int, Int)
- data Layout
- data EndOffset
- data Located e = L Span e
- data Span = Span (Row, Col) (Row, Col)
- nullSpan :: Span
- data TokenLayout a
- type LayoutTree a = Tree (Entry a)
- forestSpanFromEntry :: Entry a -> ForestSpan
- putForestSpanInEntry :: Entry a -> ForestSpan -> Entry a
- forestSpanToSimpPos :: ForestSpan -> (SimpPos, SimpPos)
- forestSpanVersionSet :: ForestSpan -> Bool
- treeStartEnd :: Tree (Entry a) -> ForestSpan
- groupTokensByLine :: IsToken a => [a] -> [[a]]
- tokenRow :: IsToken a => a -> Int
- tokenCol :: IsToken a => a -> Int
- tokenColEnd :: IsToken a => a -> Int
- tokenPos :: IsToken a => a -> SimpPos
- tokenPosEnd :: IsToken a => a -> SimpPos
- increaseSrcSpan :: IsToken a => SimpPos -> a -> a
- srcPosToSimpPos :: (Int, Int) -> (Int, Int)
- addOffsetToToks :: IsToken a => SimpPos -> [a] -> [a]
- ghcLineToForestLine :: Int -> ForestLine
- forestLineToGhcLine :: ForestLine -> Int
- forestLenChangedMask :: Int
- class Show a => IsToken a where
- getSpan :: a -> Span
- putSpan :: a -> Span -> a
- tokenLen :: a -> Int
- isComment :: a -> Bool
- isEmpty :: a -> Bool
- mkZeroToken :: a
- isDo :: a -> Bool
- isElse :: a -> Bool
- isIn :: a -> Bool
- isLet :: a -> Bool
- isOf :: a -> Bool
- isThen :: a -> Bool
- isWhere :: a -> Bool
- tokenToString :: a -> String
- showTokenStream :: [a] -> String
- markToken :: a -> a
- isMarked :: a -> Bool
- notWhiteSpace :: IsToken a => a -> Bool
- isWhiteSpaceOrIgnored :: IsToken a => a -> Bool
- isIgnored :: IsToken a => a -> Bool
- isIgnoredNonComment :: IsToken a => a -> Bool
- isWhereOrLet :: IsToken a => a -> Bool
- showFriendlyToks :: IsToken a => [a] -> String
- class HasLoc a where
- class Allocatable b a where
- allocTokens :: b -> [a] -> LayoutTree a
Documentation
An entry in the data structure for a particular srcspan.
Entry !ForestSpan !Layout ![a] | Entry has * the source span contained in this Node * how the sub-elements nest * the tokens for the SrcSpan if subtree is empty |
Deleted !ForestSpan !RowOffset !SimpPos | Deleted has * the source span has been deleted * prior gap in lines * the gap between this span end and the start of the next in the fringe of the tree. |
data TokenCache a Source
Identifies the tree carrying the main tokens, not any work in progress or deleted ones
type ForestSpan = (ForestPos, ForestPos)Source
Match a SrcSpan, using a ForestLine as the marker
type ForestPos = (ForestLine, Int)Source
data ForestLine Source
ForestLine | |
|
Above EndOffset (Row, Col) (Row, Col) EndOffset | Initial offset from token before the stacked list of items, the (r,c) of the first non-comment token, the (r,c) of the end of the last non-comment token in the stacked list to be able to calculate the (RowOffset,ColOffset) between the last token and the start of the next item. |
NoChange |
data TokenLayout a Source
type LayoutTree a = Tree (Entry a)Source
forestSpanFromEntry :: Entry a -> ForestSpanSource
putForestSpanInEntry :: Entry a -> ForestSpan -> Entry aSource
forestSpanToSimpPos :: ForestSpan -> (SimpPos, SimpPos)Source
Strip out the version markers
forestSpanVersionSet :: ForestSpan -> BoolSource
Checks if the version is non-zero in either position
treeStartEnd :: Tree (Entry a) -> ForestSpanSource
Get the start and end position of a Tree treeStartEnd :: Tree Entry -> (SimpPos,SimpPos) treeStartEnd (Node (Entry sspan _) _) = (getGhcLoc sspan,getGhcLocEnd sspan)
groupTokensByLine :: IsToken a => [a] -> [[a]]Source
tokenColEnd :: IsToken a => a -> IntSource
tokenPosEnd :: IsToken a => a -> SimpPosSource
increaseSrcSpan :: IsToken a => SimpPos -> a -> aSource
Shift the whole token by the given offset
addOffsetToToks :: IsToken a => SimpPos -> [a] -> [a]Source
Add a constant line and column offset to a span of tokens
ghcLineToForestLine :: Int -> ForestLineSource
Extract an encoded ForestLine from a GHC line
class Show a => IsToken a whereSource
The IsToken class captures the different token type in use. For
GHC it represents the type returned by getRichTokenStream
,
namely [(GHC.Located GHC.Token, String)]
For haskell-src-exts this is the reult of lexTokenStream
, namely `[HSE.Loc HSE.Token]`
putSpan :: a -> Span -> aSource
tokenLen returns the length of the string representation of the token, not just the difference in the location, as the string may have changed without the position being updated, e.g. in a renaming
Zero-length tokens, as appear in GHC as markers
mkZeroToken :: aSource
tokenToString :: a -> StringSource
showTokenStream :: [a] -> StringSource
Mark a token so that it can be use to trigger layout checking later when the toks are retrieved
notWhiteSpace :: IsToken a => a -> BoolSource
isWhiteSpaceOrIgnored :: IsToken a => a -> BoolSource
isIgnoredNonComment :: IsToken a => a -> BoolSource
Tokens that are ignored when determining the first non-comment token in a span
isWhereOrLet :: IsToken a => a -> BoolSource
showFriendlyToks :: IsToken a => [a] -> StringSource
class Allocatable b a whereSource
allocTokens :: b -> [a] -> LayoutTree aSource
Allocatable (Module SrcSpanInfo) (Loc TuToken) | This instance is the purpose of this module |