type
Node
Base class for all CommonMark AST nodes.
The CommonMark AST is a tree of nodes where each node can have any number of children and one parent - except the root node which has no parent.
constructors
fields
methods
addSourceSpan |
Add a source span to the end of the list. |
---|---|
appendChild |
Insert the child node as the last child node of this node. |
children |
Get all the direct children of this node |
doc |
Get the root |
eachBetween |
Get nodes between start (exclusive) and end (exclusive) by iterating siblings of the start node. |
eachChild |
Invoke the callback on each direct child of this node |
eachDescendant |
Recursively walk the descendants of this node using a depth-first search and invoke the callback on each node. |
find |
Recursively try to find a node with the given type within the children of this node. |
findAll |
Recursively find all children of this node for which the callback returns true |
insertAfter |
Inserts the sibling node after this node |
insertBefore |
Inserts the sibiling node before this node |
loc |
Get the file location for this node from the original parsed source. |
parent |
The parent node or null if this is the root of the AST |
setParent |
Used by sub-classes to set or clear this node's parent |
setSourceSpans |
Replace the current source spans with the provided list |
toStr | |
toStrAttributes | |
unlink |
Completely detach this node from the AST |
walk |
Walk the AST using the given visitor. |
Slot Details
addSourceSpan
Void addSourceSpan(SourceSpan? sourceSpan)
Add a source span to the end of the list. If it is null, this is a no-op
appendChild
children
Node[] children()
Get all the direct children of this node
doc
eachBetween
eachChild
eachDescendant
find
findAll
firstChild
Node? firstChild { private set }
insertAfter
insertBefore
lastChild
Node? lastChild { private set }
loc
FileLoc loc()
Get the file location for this node from the original parsed source. If the location is not known or source spans were not enabled during parsing, then return FileLoc.unknown
.
make
new make()
next
Node? next { private set }
parent
virtual Node? parent()
The parent node or null if this is the root of the AST
prev
Node? prev { private set }
setParent
setSourceSpans
Void setSourceSpans(SourceSpan[] sourceSpans)
Replace the current source spans with the provided list
sourceSpans
SourceSpan[] sourceSpans := SourceSpan[,] { private set }
toStr
virtual override Str toStr()
toStrAttributes
protected virtual Str toStrAttributes()
unlink
Void unlink()
Completely detach this node from the AST