purescript-0.15.15: PureScript Programming Language Compiler

Safe Haskell | None
Language | Haskell2010

Language.PureScript.CST.Positions

Description

This module contains utilities for calculating positions and offsets. While tokens are annotated with ranges, CST nodes are not, but they can be dynamically derived with the functions in this module, which will return the first and last tokens for a given node.

# Documentation

advanceToken :: SourcePos -> Token -> SourcePos #

advanceLeading :: SourcePos -> [Comment LineFeed] -> SourcePos #

advanceTrailing :: SourcePos -> [Comment Void] -> SourcePos #

tokenDelta :: Token -> (Int, Int) #

qualDelta :: [Text] -> Int #

multiLine :: Int -> (Int, Int) -> (Int, Int) #

commentDelta :: (a -> (Int, Int)) -> Comment a -> (Int, Int) #

lineDelta :: LineFeed -> (Int, Int) #

textDelta :: Text -> (Int, Int) #

applyDelta :: SourcePos -> (Int, Int) -> SourcePos #

sepLast :: Separated a -> a #

type TokenRange = (SourceToken, SourceToken) #

toSourceRange :: TokenRange -> SourceRange #

widen :: SourceRange -> SourceRange -> SourceRange #

srcRange :: SourceToken -> SourceRange #

nameRange :: Name a -> TokenRange #

qualRange :: QualifiedName a -> TokenRange #

wrappedRange :: Wrapped a -> TokenRange #

moduleRange :: Module a -> TokenRange #

exportRange :: Export a -> TokenRange #

importDeclRange :: ImportDecl a -> TokenRange #

importRange :: Import a -> TokenRange #

dataMembersRange :: DataMembers a -> TokenRange #

declRange :: Declaration a -> TokenRange #

dataHeadRange :: DataHead a -> TokenRange #

dataCtorRange :: DataCtor a -> TokenRange #

classHeadRange :: ClassHead a -> TokenRange #

classFundepRange :: ClassFundep -> TokenRange #

instanceRange :: Instance a -> TokenRange #

instanceHeadRange :: InstanceHead a -> TokenRange #

instanceBindingRange :: InstanceBinding a -> TokenRange #

foreignRange :: Foreign a -> TokenRange #

valueBindingFieldsRange :: ValueBindingFields a -> TokenRange #

guardedRange :: Guarded a -> TokenRange #

guardedExprRange :: GuardedExpr a -> TokenRange #

whereRange :: Where a -> TokenRange #

typeRange :: Type a -> TokenRange #

constraintRange :: Constraint a -> TokenRange #

typeVarBindingRange :: TypeVarBinding a -> TokenRange #

exprRange :: Expr a -> TokenRange #

letBindingRange :: LetBinding a -> TokenRange #

doStatementRange :: DoStatement a -> TokenRange #

binderRange :: Binder a -> TokenRange #

recordUpdateRange :: RecordUpdate a -> TokenRange #