nitc :: ASTDump :: _display_structural
Display tokens and structural production?nitc :: ASTDump :: _last_parent
Reference to the last parent in the Ordered Treenitc :: ASTDump :: defaultinit
nitc :: ASTDump :: display_structural
Display tokens and structural production?nitc :: ASTDump :: display_structural=
Display tokens and structural production?nitc :: ASTDump :: last_parent
Reference to the last parent in the Ordered Treenitc :: ASTDump :: last_parent=
Reference to the last parent in the Ordered Treenitc $ ASTDump :: write_line
Write the full line for the elemente
in o
.
core :: Collection :: CONCURRENT
Type of the concurrent variant of this collectionnitc :: ASTDump :: _display_structural
Display tokens and structural production?nitc :: ASTDump :: _last_parent
Reference to the last parent in the Ordered Treeordered_tree :: OrderedTree :: _parents
The parent of each element.ordered_tree :: OrderedTree :: _roots
The roots of the tree (in sequence)ordered_tree :: OrderedTree :: _sub
The branches of the trees.ordered_tree :: OrderedTree :: add_all
Append all nodeses
as children of p
.
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: Collection :: combinations
Allr
-length combinations on self (in same order) without repeated elements.
core :: Collection :: combinations_with_replacement
Allr
-length combination on self (in same order) with repeated elements.
nitc :: Visitor :: current_node=
The current visited nodenitc :: Visitor :: defaultinit
core :: Cloneable :: defaultinit
core :: Writable :: defaultinit
nitc :: ASTDump :: defaultinit
core :: Collection :: defaultinit
core :: Object :: defaultinit
ordered_tree :: OrderedTree :: display
How to display a specific element of the treenitc :: ASTDump :: display_structural
Display tokens and structural production?nitc :: ASTDump :: display_structural=
Display tokens and structural production?nitc :: Visitor :: enter_visit
Ask the visitor to visit a given node.core :: Collection :: has_all
Does the collection contain at least each element ofother
?
core :: Collection :: has_any
Does the collection contain at least one element ofother
?
core :: Collection :: has_exactly
Does the collection contain exactly all the elements ofother
?
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
nitc :: ASTDump :: last_parent
Reference to the last parent in the Ordered Treenitc :: ASTDump :: last_parent=
Reference to the last parent in the Ordered Treecore :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).ordered_tree :: OrderedTree :: parents
The parent of each element.ordered_tree :: OrderedTree :: parents=
The parent of each element.core :: Collection :: permutations
Allr
-length permutations on self (all possible ordering) without repeated elements.
core :: Collection :: product
Cartesian product, overr
times self
.
ordered_tree :: OrderedTree :: roots=
The roots of the tree (in sequence)core :: Collection :: serialize_to_pure_json
Utility to serialize a normal Json arrayordered_tree :: OrderedTree :: sort_with
Sort roots and other elements using a comparator methodordered_tree :: OrderedTree :: sub=
The branches of the trees.ordered_tree :: OrderedTree :: sub_to_a
core :: Collection :: to_concurrent
Wrapsself
in a thread-safe collection
core :: Collection :: to_counter
Create and fill up a counter with the elements of `self.core :: Collection :: to_curlslist
Convert Collection[String] to CURLSListcore :: Collection :: to_shuffle
Return a new array made of elements in a random order.ordered_tree :: OrderedTree :: write_line
Write the full line for the elemente
in o
.
core :: Writable :: write_to_bytes
Likewrite_to
but return a new Bytes (may be quite large)
core :: Writable :: write_to_file
Likewrite_to
but take care of creating the file
core :: Writable :: write_to_string
Likewrite_to
but return a new String (may be quite large).
# A helper class to handle (print) Nit AST as an OrderedTree
class ASTDump
super Visitor
super OrderedTree[ANode]
# Reference to the last parent in the Ordered Tree
# Is used to handle the initial node parent and workaround possible inconsistent `ANode::parent`
private var last_parent: nullable ANode = null
# Display tokens and structural production?
#
# Should tokens (and structural production like AQId) be displayed?
var display_structural: Bool
# Display lines?
#
# Should each new line be displayed (numbered and in gray)?
var display_line: Bool
# Current line number (when printing lines)
private var line = 0
redef fun visit(n)
do
if not display_structural and n.is_structural then return
var p = last_parent
add(p, n)
last_parent = n
n.visit_all(self)
last_parent = p
end
redef fun write_line(o, n, p)
do
if display_line then
var ls = n.location.line_start
var file = n.location.file
var line = self.line
if ls > line and file != null then
if line == 0 then line = ls - 1
while line < ls do
line += 1
o.write "{line}\t{file.get_line(line)}\n".light_gray
end
self.line = ls
end
end
super
end
redef fun display(n)
do
return "{n.class_name} {n.dump_info(self)} @{n.location}"
end
# `s` as yellow
fun yellow(s: String): String do return s.yellow
# `s` as red
fun red(s: String): String do return s.red
end
src/parser/parser_nodes.nit:185,1--246,3