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)
- type SimpSpan = (SimpPos, SimpPos)
- data Layout
- data EndOffset
- class Outputable a where
- data TokenLayout a
- type LayoutTree a = Tree (Entry a)
- ghcLineToForestLine :: Int -> ForestLine
- forestLineToGhcLine :: ForestLine -> Int
- forestLenChangedMask :: Int
- class (Show a, HasLoc a) => IsToken a where
- 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
- lexStringToTokens :: SimpSpan -> String -> [a]
- 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 :: IsToken a => 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. |
IsToken a => Eq (Entry a) | |
IsToken t => Ord (LayoutTree t) | |
Show a => Show (Entry a) | |
Outputable (LayoutTree GhcPosToken) | |
Outputable (Entry GhcPosToken) | |
HasLoc (Entry a) |
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 |
class Outputable a whereSource
Outputable Bool | |
Outputable ForestLine | |
Outputable EndOffset | |
Outputable Row | |
Outputable Annot | |
Outputable LineOpt | |
Outputable Source | |
Outputable Alignment | |
Outputable Transformation | |
Outputable DeletedSpan | |
Outputable a => Outputable [a] | |
Outputable a => Outputable (NonEmpty a) | |
IsToken a => Outputable (SourceTree a) | |
IsToken a => Outputable (Prim a) | |
IsToken a => Outputable (Line a) | |
IsToken a => Outputable (Up a) | |
(Outputable a, Outputable b) => Outputable (a, b) | |
IsToken a => Outputable (DUALTreeNE Transformation (Up a) Annot (Prim a)) | |
IsToken a => Outputable (DUALTreeU Transformation (Up a) Annot (Prim a)) |
data TokenLayout a Source
type LayoutTree a = Tree (Entry a)Source
ghcLineToForestLine :: Int -> ForestLineSource
Extract an encoded ForestLine from a GHC line
class (Show a, HasLoc 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]`
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
lexStringToTokens :: SimpSpan -> String -> [a]Source
Create a stream of tokens from source, with first token start at given location
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 :: IsToken a => b -> [a] -> LayoutTree aSource
Construct a LayoutTree
from a Haskell AST and a stream of tokens.
Allocatable ParsedSource GhcPosToken | |
Allocatable (Module SrcSpanInfo) (Loc TuToken) | This instance is the purpose of this module |