Safe Haskell | None |
---|
- unmodified :: Bool
- modified :: Bool
- simpPos0 :: (Int, Int)
- nullSrcSpan :: SrcSpan
- whiteSpaceTokens :: (Int, Int) -> Int -> [PosToken]
- realSrcLocFromTok :: PosToken -> RealSrcLoc
- isWhite :: PosToken -> Bool
- notWhite :: PosToken -> Bool
- isWhiteSpace :: PosToken -> Bool
- isWhiteSpaceOrIgnored :: IsToken a => a -> Bool
- isIgnored :: IsToken a => a -> Bool
- isMultiLineComment :: PosToken -> Bool
- isOpenSquareBracket :: PosToken -> Bool
- isCloseSquareBracket :: PosToken -> Bool
- isIn :: IsToken a => a -> Bool
- isComma :: PosToken -> Bool
- isOpenParen :: PosToken -> Bool
- isBar :: PosToken -> Bool
- endsWithNewLn :: PosToken -> Bool
- startsWithNewLn :: PosToken -> Bool
- hasNewLn :: PosToken -> Bool
- compressPreNewLns :: [PosToken] -> [PosToken]
- compressEndNewLns :: [PosToken] -> [PosToken]
- lengthOfLastLine :: [PosToken] -> Int
- getToks :: (SimpPos, SimpPos) -> [PosToken] -> [PosToken]
- deleteToks :: [PosToken] -> SimpPos -> SimpPos -> [PosToken]
- doRmWhites :: Int -> [PosToken] -> [PosToken]
- srcLocs :: Data t => t -> [SimpPos]
- getSrcSpan :: Data t => t -> Maybe SrcSpan
- getAllSrcLocs :: Data t => t -> [(SimpPos, SimpPos)]
- getBiggestStartEndLoc :: Data t => t -> (SimpPos, SimpPos)
- extendForwards :: [PosToken] -> (SimpPos, SimpPos) -> (PosToken -> Bool) -> (SimpPos, SimpPos)
- extendBackwards :: [PosToken] -> (SimpPos, SimpPos) -> (PosToken -> Bool) -> (SimpPos, SimpPos)
- startEndLocIncFowComment :: Data t => [PosToken] -> t -> (SimpPos, SimpPos)
- startEndLocIncComments :: Data t => [PosToken] -> t -> (SimpPos, SimpPos)
- startEndLocIncComments' :: IsToken a => [a] -> (SimpPos, SimpPos) -> (SimpPos, SimpPos)
- prettyprintPatList :: (t -> String) -> Bool -> [t] -> String
- groupTokensByLine :: IsToken a => [a] -> [[a]]
- toksOnSameLine :: PosToken -> PosToken -> Bool
- addLocInfo :: (LHsBind Name, [PosToken]) -> RefactGhc (LHsBind Name, [PosToken])
- getLineOffset :: [PosToken] -> SimpPos -> Int
- tokenSrcSpan :: (Located t1, t) -> SrcSpan
- tokenCon :: PosToken -> String
- increaseSrcSpan :: IsToken a => SimpPos -> a -> a
- getGhcLoc :: SrcSpan -> (Int, Int)
- getGhcLocEnd :: SrcSpan -> (Int, Int)
- getLocatedStart :: GenLocated SrcSpan t -> (Int, Int)
- getLocatedEnd :: GenLocated SrcSpan t -> (Int, Int)
- getStartEndLoc :: Data t => t -> (SimpPos, SimpPos)
- startEndLocGhc :: Located b -> (SimpPos, SimpPos)
- realSrcLocEndTok :: PosToken -> RealSrcLoc
- fileNameFromTok :: PosToken -> FastString
- splitToks :: IsToken a => (SimpPos, SimpPos) -> [a] -> ([a], [a], [a])
- emptyList :: [t] -> Bool
- nonEmptyList :: [t] -> Bool
- notWhiteSpace :: IsToken a => a -> Bool
- isDoubleColon :: PosToken -> Bool
- isEmpty :: IsToken a => a -> Bool
- isWhereOrLet :: IsToken a => a -> Bool
- isWhere :: IsToken a => a -> Bool
- isLet :: IsToken a => a -> Bool
- isElse :: IsToken a => a -> Bool
- isThen :: IsToken a => a -> Bool
- isOf :: IsToken a => a -> Bool
- isDo :: IsToken a => a -> Bool
- getIndentOffset :: IsToken a => [a] -> SimpPos -> Int
- splitOnNewLn :: IsToken a => [a] -> ([a], [a])
- tokenLen :: IsToken a => a -> Int
- newLnToken :: IsToken a => a -> a
- reSequenceToks :: [PosToken] -> [PosToken]
- mkToken :: Token -> SimpPos -> String -> GhcPosToken
- mkZeroToken :: IsToken a => a
- markToken :: IsToken a => a -> a
- isMarked :: IsToken a => a -> Bool
- rmOffsetFromToks :: [PosToken] -> [PosToken]
Documentation
isWhiteSpace :: PosToken -> BoolSource
isWhiteSpaceOrIgnored :: IsToken a => a -> Bool
isOpenParen :: PosToken -> BoolSource
endsWithNewLn :: PosToken -> BoolSource
Returns True if the token ends with '\n' ++AZ++: is this meaningful?
startsWithNewLn :: PosToken -> BoolSource
Returns True if the token starts with `\n`. ++AZ++: is this meaningful?
compressPreNewLns :: [PosToken] -> [PosToken]Source
Remove the extra preceding empty lines.
compressEndNewLns :: [PosToken] -> [PosToken]Source
Remove the following extra empty lines.
lengthOfLastLine :: [PosToken] -> IntSource
Given a token stream covering multi-lines, calculate the length of the last line AZ: should be the last token start col, plus length of token.
getToks :: (SimpPos, SimpPos) -> [PosToken] -> [PosToken]Source
get a token stream specified by the start and end position.
deleteToks :: [PosToken] -> SimpPos -> SimpPos -> [PosToken]Source
Delete a sequence of tokens specified by the start position and end position from the token stream, then adjust the remaining token stream to preserve layout
doRmWhites :: Int -> [PosToken] -> [PosToken]Source
remove at most n white space tokens from the beginning of ts
srcLocs :: Data t => t -> [SimpPos]Source
get all the source locations (use locations) in an AST phrase t according the the occurrence order of identifiers.
getSrcSpan :: Data t => t -> Maybe SrcSpanSource
Get the first SrcSpan found, in top down traversal
getAllSrcLocs :: Data t => t -> [(SimpPos, SimpPos)]Source
Get all the source locations in a given syntax fragment
getBiggestStartEndLoc :: Data t => t -> (SimpPos, SimpPos)Source
extendForwards :: [PosToken] -> (SimpPos, SimpPos) -> (PosToken -> Bool) -> (SimpPos, SimpPos)Source
Extend the given position forwards to the end of the file while the supplied condition holds
extendBackwards :: [PosToken] -> (SimpPos, SimpPos) -> (PosToken -> Bool) -> (SimpPos, SimpPos)Source
Extend the given position backwards to the front of the file while the supplied condition holds
startEndLocIncFowComment :: Data t => [PosToken] -> t -> (SimpPos, SimpPos)Source
Get the start&end location of syntax phrase t, then extend the end location to cover the comment/white spaces or new line which starts in the same line as the end location TODO: deprecate this in favour of startEndLocIncComments
startEndLocIncComments :: Data t => [PosToken] -> t -> (SimpPos, SimpPos)Source
Get the start&end location of t in the token stream, then extend the start and end location to cover the preceding and following comments.
In this routine, 'then','else','do' and 'in' are treated as comments.
startEndLocIncComments' :: IsToken a => [a] -> (SimpPos, SimpPos) -> (SimpPos, SimpPos)
Get the start&end location of t in the token stream, then extend the start and end location to cover the preceding and following comments.
prettyprintPatList :: (t -> String) -> Bool -> [t] -> StringSource
groupTokensByLine :: IsToken a => [a] -> [[a]]
toksOnSameLine :: PosToken -> PosToken -> BoolSource
getLineOffset :: [PosToken] -> SimpPos -> IntSource
Get the start of the line before the pos,
tokenSrcSpan :: (Located t1, t) -> SrcSpanSource
increaseSrcSpan :: IsToken a => SimpPos -> a -> a
Shift the whole token by the given offset
getGhcLoc :: SrcSpan -> (Int, Int)Source
gets the (row,col) of the start of the GHC.SrcSpan
, or (-1,-1)
if there is an GHC.UnhelpfulSpan
getGhcLocEnd :: SrcSpan -> (Int, Int)Source
gets the (row,col) of the end of the GHC.SrcSpan
, or (-1,-1)
if there is an GHC.UnhelpfulSpan
getLocatedStart :: GenLocated SrcSpan t -> (Int, Int)Source
getLocatedEnd :: GenLocated SrcSpan t -> (Int, Int)Source
getStartEndLoc :: Data t => t -> (SimpPos, SimpPos)Source
startEndLocGhc :: Located b -> (SimpPos, SimpPos)Source
splitToks :: IsToken a => (SimpPos, SimpPos) -> [a] -> ([a], [a], [a])
Split the token stream into three parts: the tokens before the startPos, the tokens between startPos and endPos, and the tokens after endPos. Note: The startPos and endPos refer to the startPos of a token only. So a single token will have the same startPos and endPos NO^^^^
emptyList :: [t] -> BoolSource
Get around lack of instance Eq when simply testing for empty list
TODO: get rid of this in favour of null
built in fn
nonEmptyList :: [t] -> BoolSource
notWhiteSpace :: IsToken a => a -> Bool
isDoubleColon :: PosToken -> BoolSource
isWhereOrLet :: IsToken a => a -> Bool
getIndentOffset :: IsToken a => [a] -> SimpPos -> Int
Get the indent of the line before, taking into account in-line 'where', 'let', 'in' and 'do' tokens
splitOnNewLn :: IsToken a => [a] -> ([a], [a])
tokenLen :: IsToken a => a -> Int
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
newLnToken :: IsToken a => a -> a
reSequenceToks :: [PosToken] -> [PosToken]Source
Adjust token stream to cater for changes in token length due to token renaming
mkToken :: Token -> SimpPos -> String -> GhcPosToken
Compose a new token using the given arguments.
mkZeroToken :: IsToken a => a
markToken :: IsToken a => a -> a
Mark a token so that it can be use to trigger layout checking later when the toks are retrieved
rmOffsetFromToks :: [PosToken] -> [PosToken]Source