Package com.vladsch.flexmark.util.ast
Class Node
java.lang.Object
com.vladsch.flexmark.util.ast.Node
- Direct Known Subclasses:
Abbreviation
,AnchorLink
,AttributeNode
,AttributesNode
,ContentNode
,DelimitedNodeImpl
,EmbeddedAttributeProvider.EmbeddedNodeAttributes
,Emoji
,EnumeratedReferenceBase
,EscapedCharacter
,Footnote
,GfmIssue
,GfmUser
,GitLabInline
,GitLabInlineMath
,HardLineBreak
,HtmlEntity
,HtmlInlineBase
,Ins
,LinkNodeBase
,Macro
,MacroAttribute
,MacroClose
,MacroReference
,RefNode
,ResizableImage
,SimTocOption
,SimTocOptionList
,SoftLineBreak
,SpecExampleAst
,SpecExampleHtml
,SpecExampleOption
,SpecExampleOptionSeparator
,SpecExampleOptionsList
,SpecExampleSeparator
,SpecExampleSource
,Strikethrough
,Subscript
,Superscript
,TableBody
,TableCaption
,TableCell
,TableColumnSeparator
,TableHead
,TableRow
,TableSeparator
,Text
,TextBase
,TypographicQuotes
,TypographicSmarts
,WhiteSpace
,WikiNode
,YamlFrontMatterNode
,YamlFrontMatterValue
,Zzzzzz
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate @NotNull BasedSequence
static final BasedSequence[]
(package private) @Nullable Node
private @Nullable Node
(package private) @Nullable Node
private @Nullable Node
private @Nullable Node
static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendChain
(@NotNull Node firstNode) Append all from child to end of chain to this nodevoid
appendChild
(Node child) static void
astChars
(@NotNull StringBuilder out, @NotNull CharSequence chars, @NotNull String name) void
astExtraChars
(@NotNull StringBuilder out) void
astString
(@NotNull StringBuilder out, boolean withExtra) baseSubSequence
(int startIndex) baseSubSequence
(int startIndex, int endIndex) int
countAncestorsOfType
(@NotNull Class<?>... classes) int
countDirectAncestorsOfType
(@Nullable Class<?> skip, @NotNull Class<?>... classes) static void
delimitedSegmentSpan
(@NotNull StringBuilder out, @NotNull BasedSequence openingSequence, @NotNull BasedSequence sequence, @NotNull BasedSequence closingSequence, @NotNull String name) static void
delimitedSegmentSpanChars
(@NotNull StringBuilder out, @NotNull BasedSequence openingSequence, @NotNull BasedSequence sequence, @NotNull BasedSequence closingSequence, @NotNull String name) int
endOfLine
(int index) void
extractChainTo
(@NotNull Node node) void
extractToFirstInChain
(@NotNull Node node) @Nullable Node
getAncestorOfType
(@NotNull Class<?>... classes) void
getAstExtra
(@NotNull StringBuilder out) @NotNull Node
@NotNull BasedSequence
getChars()
@NotNull BasedSequence
Get the char sequence from segments making up the node's characters.@NotNull ReversiblePeekingIterator
<Node> @Nullable Node
getChildOfType
(@NotNull Class<?>... classes) @NotNull ReversiblePeekingIterable
<Node> @NotNull ReversiblePeekingIterable
<Node> @NotNull Document
int
int
int
@Nullable Node
@Nullable Node
getFirstChildAny
(@NotNull Class<?>... classes) @Nullable Node
getFirstChildAnyNot
(@NotNull Class<?>... classes) @NotNull Node
@Nullable Node
@Nullable Node
Overridden by ListBlock and any others whose children propagate their blank line to parent@Nullable Node
@Nullable Node
getLastChildAny
(@NotNull Class<?>... classes) @Nullable Node
getLastChildAnyNot
(@NotNull Class<?>... classes) @NotNull Node
static @NotNull BasedSequence
getLeadSegment
(@NotNull BasedSequence[] segments) int
@Nullable Node
getNext()
@Nullable Node
getNextAny
(@NotNull Class<?>... classes) @Nullable Node
getNextAnyNot
(@NotNull Class<?>... classes) @NotNull String
static int
getNodeOfTypeIndex
(@NotNull Node node, @NotNull Class<?>... classes) int
getNodeOfTypeIndex
(@NotNull Class<?>... classes) @Nullable Node
getOldestAncestorOfTypeAfter
(@NotNull Class<?> ancestor, @NotNull Class<?> after) @Nullable Node
@Nullable Node
@Nullable Node
getPreviousAny
(@NotNull Class<?>... classes) @Nullable Node
getPreviousAnyNot
(@NotNull Class<?>... classes) @NotNull ReversiblePeekingIterator
<Node> @NotNull ReversiblePeekingIterable
<Node> @NotNull ReversiblePeekingIterable
<Node> abstract @NotNull BasedSequence[]
@NotNull BasedSequence[]
Get the segments making up the node's characters.int
int
int
int
static @NotNull BasedSequence
getTrailSegment
(BasedSequence[] segments) boolean
boolean
hasOrMoreChildren
(int childCount) void
insertAfter
(@NotNull Node sibling) void
insertBefore
(Node sibling) void
insertChainAfter
(@NotNull Node firstNode) Append all from child to end of chain to this nodevoid
insertChainBefore
(@NotNull Node firstNode) Append all from child to end of chain to this nodeboolean
isOrDescendantOfType
(@NotNull Class<?>... classes) lineColumnAtIndex
(int index) void
void
prependChild
(@NotNull Node child) void
static void
segmentSpan
(@NotNull StringBuilder out, int startOffset, int endOffset, @Nullable String name) static void
segmentSpan
(@NotNull StringBuilder out, @NotNull BasedSequence sequence, @Nullable String name) static void
segmentSpanChars
(@NotNull StringBuilder out, int startOffset, int endOffset, @Nullable String name, @NotNull String chars) static void
segmentSpanChars
(@NotNull StringBuilder out, int startOffset, int endOffset, @Nullable String name, @NotNull String chars1, @NotNull String splice, @NotNull String chars2) static void
segmentSpanChars
(@NotNull StringBuilder out, @NotNull BasedSequence sequence, @NotNull String name) static void
segmentSpanCharsToVisible
(@NotNull StringBuilder out, @NotNull BasedSequence sequence, @NotNull String name) void
setChars
(@NotNull BasedSequence chars) void
void
void
Set the node's char string from segments making up the node's characters.protected void
static @NotNull BasedSequence
spanningChars
(BasedSequence... segments) int
startOfLine
(int index) void
takeChildren
(@NotNull Node node) @NotNull String
toAstString
(boolean withExtra) static @NotNull String
toSegmentSpan
(@NotNull BasedSequence sequence, @Nullable String name) toString()
protected @NotNull String
void
unlink()
-
Field Details
-
EMPTY_SEGMENTS
-
SPLICE
- See Also:
-
AST_ADAPTER
-
parent
-
firstChild
-
lastChild
-
prev
-
next
-
chars
-
-
Constructor Details
-
Node
public Node() -
Node
-
-
Method Details
-
getStartOffset
public int getStartOffset() -
getEndOffset
public int getEndOffset() -
getTextLength
public int getTextLength() -
getBaseSequence
-
getSourceRange
-
baseSubSequence
-
baseSubSequence
-
getEmptyPrefix
-
getEmptySuffix
-
getStartOfLine
public int getStartOfLine() -
getEndOfLine
public int getEndOfLine() -
startOfLine
public int startOfLine(int index) -
endOfLine
public int endOfLine(int index) -
lineColumnAtIndex
-
lineColumnAtStart
-
getLineColumnAtEnd
-
getAncestorOfType
-
countAncestorsOfType
-
countDirectAncestorsOfType
-
getOldestAncestorOfTypeAfter
-
getChildOfType
-
getNodeOfTypeIndex
-
isOrDescendantOfType
-
getNodeOfTypeIndex
-
getLastBlankLineChild
Overridden by ListBlock and any others whose children propagate their blank line to parent- Returns:
- return a child block that can contain the parent's last blank line
-
getChildren
-
getReversedChildren
-
getDescendants
-
getReversedDescendants
-
getChildIterator
-
getReversedChildIterator
-
getChars
-
removeChildren
public void removeChildren() -
hasChildren
public boolean hasChildren() -
hasOrMoreChildren
public boolean hasOrMoreChildren(int childCount) -
getDocument
-
setChars
-
getNext
-
getLastInChain
-
getPrevious
-
extractToFirstInChain
-
extractChainTo
-
getFirstInChain
-
getPreviousAnyNot
-
getPreviousAny
-
getNextAnyNot
-
getNextAny
-
getFirstChild
-
getFirstChildAnyNot
-
getFirstChildAny
-
getLastChild
-
getLastChildAnyNot
-
getLastChildAny
-
getParent
-
getGrandParent
-
setParent
-
appendChild
-
prependChild
-
unlink
public void unlink() -
insertAfter
-
insertBefore
-
toString
-
getAstExtra
-
astExtraChars
-
astChars
public static void astChars(@NotNull @NotNull StringBuilder out, @NotNull @NotNull CharSequence chars, @NotNull @NotNull String name) -
toStringAttributes
-
getSegments
-
getLeadSegment
@NotNull public static @NotNull BasedSequence getLeadSegment(@NotNull @NotNull BasedSequence[] segments) -
getTrailSegment
-
spanningChars
-
setCharsFromContentOnly
public void setCharsFromContentOnly() -
setCharsFromContent
public void setCharsFromContent() -
segmentSpan
public static void segmentSpan(@NotNull @NotNull StringBuilder out, int startOffset, int endOffset, @Nullable @Nullable String name) -
segmentSpanChars
public static void segmentSpanChars(@NotNull @NotNull StringBuilder out, int startOffset, int endOffset, @Nullable @Nullable String name, @NotNull @NotNull String chars) -
segmentSpanChars
public static void segmentSpanChars(@NotNull @NotNull StringBuilder out, int startOffset, int endOffset, @Nullable @Nullable String name, @NotNull @NotNull String chars1, @NotNull @NotNull String splice, @NotNull @NotNull String chars2) -
segmentSpan
public static void segmentSpan(@NotNull @NotNull StringBuilder out, @NotNull @NotNull BasedSequence sequence, @Nullable @Nullable String name) -
segmentSpanChars
public static void segmentSpanChars(@NotNull @NotNull StringBuilder out, @NotNull @NotNull BasedSequence sequence, @NotNull @NotNull String name) -
segmentSpanCharsToVisible
public static void segmentSpanCharsToVisible(@NotNull @NotNull StringBuilder out, @NotNull @NotNull BasedSequence sequence, @NotNull @NotNull String name) -
delimitedSegmentSpan
public static void delimitedSegmentSpan(@NotNull @NotNull StringBuilder out, @NotNull @NotNull BasedSequence openingSequence, @NotNull @NotNull BasedSequence sequence, @NotNull @NotNull BasedSequence closingSequence, @NotNull @NotNull String name) -
delimitedSegmentSpanChars
public static void delimitedSegmentSpanChars(@NotNull @NotNull StringBuilder out, @NotNull @NotNull BasedSequence openingSequence, @NotNull @NotNull BasedSequence sequence, @NotNull @NotNull BasedSequence closingSequence, @NotNull @NotNull String name) -
takeChildren
-
getNodeName
-
astString
-
toAstString
-
toSegmentSpan
@NotNull public static @NotNull String toSegmentSpan(@NotNull @NotNull BasedSequence sequence, @Nullable @Nullable String name) -
getChildChars
-
getExactChildChars
-
getBlankLineSibling
-
moveTrailingBlankLines
public void moveTrailingBlankLines() -
getLineNumber
public int getLineNumber() -
getStartLineNumber
public int getStartLineNumber() -
getEndLineNumber
public int getEndLineNumber() -
getSegmentsForChars
Get the segments making up the node's characters.Used to get segments after the some of the node's elements were modified
- Returns:
- array of segments
-
getCharsFromSegments
Get the char sequence from segments making up the node's characters.Used to get segments after the some of the node's elements were modified
- Returns:
- concatenated string of all segments
-
setCharsFromSegments
public void setCharsFromSegments()Set the node's char string from segments making up the node's characters.Used to get segments after the some of the node's elements were modified
-
appendChain
Append all from child to end of chain to this node- Parameters:
firstNode
- first child in chain
-
insertChainAfter
Append all from child to end of chain to this node- Parameters:
firstNode
- first child in chain
-
insertChainBefore
Append all from child to end of chain to this node- Parameters:
firstNode
- first child in chain
-