class Ast
class Ast
lib/compiler/ast/ast.tya:2
Ast provides the compiler/ast/Ast standard library API.
Source
# Ast provides the compiler/ast/Ast standard library API.
class Ast
# Ast.children provides the compiler/ast/Ast standard library operation.
# @param node Any node value.
# @return Any the resulting value.
children: node ->
out = []
Ast().push_children(out, node, "body")
Ast().push_children(out, node, "then")
Ast().push_children(out, node, "else")
Ast().push_children(out, node, "targets")
Ast().push_children(out, node, "values")
Ast().push_children(out, node, "args")
Ast().push_children(out, node, "elements")
Ast().push_child(out, node, "expr")
Ast().push_child(out, node, "cond")
Ast().push_child(out, node, "callee")
Ast().push_child(out, node, "left")
Ast().push_child(out, node, "right")
Ast().push_child(out, node, "target")
Ast().push_child(out, node, "iterable")
out
# Ast.kind provides the compiler/ast/Ast standard library operation.
# @param node Any node value.
# @return Any the resulting value.
kind: node ->
compiler_ast_kind(node)
# Ast.push_child provides the compiler/ast/Ast standard library operation.
# @param out Any out value.
# @param node Any node value.
# @param key String key value.
# @return Any the resulting value.
push_child: out, node, key ->
if node.has(key)
out.push(node[key])
nil
# Ast.push_children provides the compiler/ast/Ast standard library operation.
# @param out Any out value.
# @param node Any node value.
# @param key String key value.
# @return Any the resulting value.
push_children: out, node, key ->
if node.has(key)
ast_children_values = node[key]
i = 0
while i < ast_children_values.len()
out.push(ast_children_values[i])
i = i + 1
nil
# Ast.span provides the compiler/ast/Ast standard library operation.
# @param node Any node value.
# @return Any the resulting value.
span: node ->
compiler_ast_span(node)
# Ast.walk provides the compiler/ast/Ast standard library operation.
# @param node Any node value.
# @param visitor Any visitor value.
# @return Any the resulting value.
walk: node, visitor ->
visitor(node)
ast_walk_children = Ast().children(node)
i = 0
while i < ast_walk_children.len()
Ast().walk(ast_walk_children[i], visitor)
i = i + 1
nil
Methods
children
Ast.children(node)
lib/compiler/ast/ast.tya:6
Ast.children provides the compiler/ast/Ast standard library operation.
Source
# Ast.children provides the compiler/ast/Ast standard library operation.
# @param node Any node value.
# @return Any the resulting value.
children: node ->
out = []
Ast().push_children(out, node, "body")
Ast().push_children(out, node, "then")
Ast().push_children(out, node, "else")
Ast().push_children(out, node, "targets")
Ast().push_children(out, node, "values")
Ast().push_children(out, node, "args")
Ast().push_children(out, node, "elements")
Ast().push_child(out, node, "expr")
Ast().push_child(out, node, "cond")
Ast().push_child(out, node, "callee")
Ast().push_child(out, node, "left")
Ast().push_child(out, node, "right")
Ast().push_child(out, node, "target")
Ast().push_child(out, node, "iterable")
out
kind
Ast.kind(node)
lib/compiler/ast/ast.tya:27
Ast.kind provides the compiler/ast/Ast standard library operation.
Source
# Ast.kind provides the compiler/ast/Ast standard library operation.
# @param node Any node value.
# @return Any the resulting value.
kind: node ->
compiler_ast_kind(node)
push_child
Ast.push_child(out, node, key)
lib/compiler/ast/ast.tya:35
Ast.push_child provides the compiler/ast/Ast standard library operation.
Source
# Ast.push_child provides the compiler/ast/Ast standard library operation.
# @param out Any out value.
# @param node Any node value.
# @param key String key value.
# @return Any the resulting value.
push_child: out, node, key ->
if node.has(key)
out.push(node[key])
nil
push_children
Ast.push_children(out, node, key)
lib/compiler/ast/ast.tya:45
Ast.push_children provides the compiler/ast/Ast standard library operation.
Source
# Ast.push_children provides the compiler/ast/Ast standard library operation.
# @param out Any out value.
# @param node Any node value.
# @param key String key value.
# @return Any the resulting value.
push_children: out, node, key ->
if node.has(key)
ast_children_values = node[key]
i = 0
while i < ast_children_values.len()
out.push(ast_children_values[i])
i = i + 1
nil
span
Ast.span(node)
lib/compiler/ast/ast.tya:57
Ast.span provides the compiler/ast/Ast standard library operation.
Source
# Ast.span provides the compiler/ast/Ast standard library operation.
# @param node Any node value.
# @return Any the resulting value.
span: node ->
compiler_ast_span(node)
walk
Ast.walk(node, visitor)
lib/compiler/ast/ast.tya:64
Ast.walk provides the compiler/ast/Ast standard library operation.
Source
# Ast.walk provides the compiler/ast/Ast standard library operation.
# @param node Any node value.
# @param visitor Any visitor value.
# @return Any the resulting value.
walk: node, visitor ->
visitor(node)
ast_walk_children = Ast().children(node)
i = 0
while i < ast_walk_children.len()
Ast().walk(ast_walk_children[i], visitor)
i = i + 1
nil