nitcc_runtime :: Node :: children
A point of view on the direct children of the nodenitcc_runtime :: Node :: defaultinit
nitcc_runtime :: Node :: depth
A point of view of a depth-first visit of all non-null childrennitcc_runtime :: Node :: depth=
A point of view of a depth-first visit of all non-null childrennitcc_runtime :: Node :: node_name
The name of the node (as used in the grammar file)nitcc_runtime :: Node :: position
The position of the node in the input streamnitcc_runtime :: Node :: position=
The position of the node in the input streamnitcc_runtime :: Node :: to_dot
Produce a graphiz file for the syntaxtic tree rooted atself
.
nitcc_runtime :: Node :: visit_children
Visit all the children of the node with the visitorv
nitcc_runtime $ Node :: SELF
Type of this instance, automatically specialized in every classnitcc_runtime :: Node :: children
A point of view on the direct children of the nodecore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
core :: Object :: defaultinit
nitcc_runtime :: Node :: defaultinit
nitcc_runtime :: Node :: depth
A point of view of a depth-first visit of all non-null childrennitcc_runtime :: Node :: depth=
A point of view of a depth-first visit of all non-null childrencore :: 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.
nitcc_runtime :: Node :: node_name
The name of the node (as used in the grammar file)core :: Object :: output_class_name
Display class name on stdout (debug only).nitcc_runtime :: Node :: position
The position of the node in the input streamnitcc_runtime :: Node :: position=
The position of the node in the input streamnitcc_runtime :: Node :: to_dot
Produce a graphiz file for the syntaxtic tree rooted atself
.
nitcc_runtime :: Node :: visit_children
Visit all the children of the node with the visitorv
# A node of a syntactic tree
abstract class Node
# The name of the node (as used in the grammar file)
fun node_name: String do return class_name
# A point of view on the direct children of the node
fun children: SequenceRead[nullable Node] is abstract
# A point of view of a depth-first visit of all non-null children
var depth: Collection[Node] = new DephCollection(self) is lazy
# Visit all the children of the node with the visitor `v`
protected fun visit_children(v: Visitor)
do
for c in children do if c != null then v.enter_visit(c)
end
# The position of the node in the input stream
var position: nullable Position = null is writable
# Produce a graphiz file for the syntaxtic tree rooted at `self`.
fun to_dot(filepath: String)
do
var f = new FileWriter.open(filepath)
f.write("digraph g \{\n")
f.write("rankdir=BT;\n")
var a = new Array[NToken]
to_dot_visitor(f, a)
f.write("\{ rank=same\n")
var first = true
for n in a do
if first then
first = false
else
f.write("->")
end
f.write("n{n.object_id}")
end
f.write("[style=invis];\n")
f.write("\}\n")
f.write("\}\n")
f.close
end
private fun to_dot_visitor(f: Writer, a: Array[NToken])
do
f.write("n{object_id} [label=\"{node_name}\"];\n")
for x in children do
if x == null then continue
f.write("n{x.object_id} -> n{object_id};\n")
x.to_dot_visitor(f,a )
end
end
redef fun to_s do
var pos = position
if pos == null then
return "{node_name}"
else
return "{node_name}@({pos})"
end
end
end
lib/nitcc_runtime/nitcc_runtime.nit:365,1--430,3