Safe Haskell | None |
---|---|
Language | Haskell2010 |
A module for preparing the representation of the AST for pretty printing.
- prepareAST :: SourceInfoTraversal node => StringBuffer -> Ann node dom RangeStage -> Ann node dom SrcTemplateStage
- placeComments :: RangeInfo stage => Map SrcSpan [Located AnnotationComment] -> Ann UModule dom stage -> Ann UModule dom stage
- getNormalComments :: Map SrcSpan [Located AnnotationComment] -> Map SrcSpan [Located AnnotationComment]
- getPragmaComments :: Map SrcSpan [Located AnnotationComment] -> Map String [Located String]
- child :: SpanInfo SrcTemplateStage
- opt :: OptionalInfo SrcTemplateStage
- list :: ListInfo SrcTemplateStage
- after :: AfterBefore i => String -> i -> i
- followedBy :: AfterBefore i => String -> i -> i
- relativeIndented :: RelativeIndent i => Int -> i -> i
- minimumIndented :: MinimumIndent i => Int -> i -> i
- separatedBy :: String -> ListInfo SrcTemplateStage -> ListInfo SrcTemplateStage
- indented :: ListInfo SrcTemplateStage -> ListInfo SrcTemplateStage
- (<>) :: SpanInfo SrcTemplateStage -> SpanInfo SrcTemplateStage -> SpanInfo SrcTemplateStage
- sourceTemplateNodeRange :: Simple Lens (SpanInfo SrcTemplateStage) SrcSpan
- sourceTemplateNodeElems :: Simple Lens (SpanInfo SrcTemplateStage) [SourceTemplateElem]
- sourceTemplateListRange :: Simple Lens (ListInfo SrcTemplateStage) SrcSpan
- srcTmpListBefore :: Simple Lens (ListInfo SrcTemplateStage) String
- srcTmpListAfter :: Simple Lens (ListInfo SrcTemplateStage) String
- srcTmpDefaultSeparator :: Simple Lens (ListInfo SrcTemplateStage) String
- srcTmpIndented :: Simple Lens (ListInfo SrcTemplateStage) Bool
- srcTmpSeparators :: Simple Lens (ListInfo SrcTemplateStage) [String]
- sourceTemplateOptRange :: Simple Lens (OptionalInfo SrcTemplateStage) SrcSpan
- srcTmpOptBefore :: Simple Lens (OptionalInfo SrcTemplateStage) String
- srcTmpOptAfter :: Simple Lens (OptionalInfo SrcTemplateStage) String
- rangeToSource :: SourceInfoTraversal node => StringBuffer -> Ann node dom RngTemplateStage -> Ann node dom SrcTemplateStage
- fixRanges :: SourceInfoTraversal node => Ann node dom RangeStage -> Ann node dom NormRangeStage
- cutUpRanges :: forall node dom. SourceInfoTraversal node => Ann node dom NormRangeStage -> Ann node dom RngTemplateStage
- getLocIndices :: SourceInfoTraversal e => Ann e dom RngTemplateStage -> Map OrdSrcSpan Int
- mapLocIndices :: Ord k => StringBuffer -> Map OrdSrcSpan k -> Map k String
Documentation
prepareAST :: SourceInfoTraversal node => StringBuffer -> Ann node dom RangeStage -> Ann node dom SrcTemplateStage Source #
Prepares the AST for pretty printing
placeComments :: RangeInfo stage => Map SrcSpan [Located AnnotationComment] -> Ann UModule dom stage -> Ann UModule dom stage Source #
Puts comments in the nodes they should be attached to. Leaves the AST in a state where parent nodes does not contain all of their children.
getNormalComments :: Map SrcSpan [Located AnnotationComment] -> Map SrcSpan [Located AnnotationComment] Source #
getPragmaComments :: Map SrcSpan [Located AnnotationComment] -> Map String [Located String] Source #
after :: AfterBefore i => String -> i -> i Source #
Put the given string before the element if it is not empty
followedBy :: AfterBefore i => String -> i -> i Source #
The given string should follow the element if it is not empty
relativeIndented :: RelativeIndent i => Int -> i -> i Source #
The element should be indented relatively to its parent
minimumIndented :: MinimumIndent i => Int -> i -> i Source #
The elements should be indented at least to the given number of spaces
separatedBy :: String -> ListInfo SrcTemplateStage -> ListInfo SrcTemplateStage Source #
The elements of the list should be separated by the given string by default (might be overridden)
indented :: ListInfo SrcTemplateStage -> ListInfo SrcTemplateStage Source #
The elements of the list should be indented on the same column
(<>) :: SpanInfo SrcTemplateStage -> SpanInfo SrcTemplateStage -> SpanInfo SrcTemplateStage Source #
Concatenates two source templates to produce a new template with all child elements.
sourceTemplateNodeElems :: Simple Lens (SpanInfo SrcTemplateStage) [SourceTemplateElem] Source #
rangeToSource :: SourceInfoTraversal node => StringBuffer -> Ann node dom RngTemplateStage -> Ann node dom SrcTemplateStage Source #
fixRanges :: SourceInfoTraversal node => Ann node dom RangeStage -> Ann node dom NormRangeStage Source #
Modifies ranges to contain their children
cutUpRanges :: forall node dom. SourceInfoTraversal node => Ann node dom NormRangeStage -> Ann node dom RngTemplateStage Source #
Creates a source template from the ranges and the input file. All source ranges must be good ranges.
getLocIndices :: SourceInfoTraversal e => Ann e dom RngTemplateStage -> Map OrdSrcSpan Int Source #
Assigns an index (in the order they are used) for each range
mapLocIndices :: Ord k => StringBuffer -> Map OrdSrcSpan k -> Map k String Source #
Partitions the source file in the order where the parts are used in the AST