Class: StarlarkCompiler::AST

Inherits:
Object
  • Object
show all
Defined in:
lib/starlark_compiler/ast.rb

Defined Under Namespace

Classes: Array, BinaryOperator, Dictionary, False, FunctionCall, FunctionDeclaration, MethodCall, Node, None, Number, PlusOperator, String, True, VariableAssignment, VariableReference

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(toplevel:) ⇒ AST

Returns a new instance of AST.



7
8
9
# File 'lib/starlark_compiler/ast.rb', line 7

def initialize(toplevel:)
  @toplevel = toplevel
end

Instance Attribute Details

#toplevelObject (readonly)

Returns the value of attribute toplevel.



5
6
7
# File 'lib/starlark_compiler/ast.rb', line 5

def toplevel
  @toplevel
end

Class Method Details

.build(&blk) ⇒ Object



44
45
46
# File 'lib/starlark_compiler/ast.rb', line 44

def self.build(&blk)
  Builder.new.instance_exec(&blk)
end

Instance Method Details

#<<(node) ⇒ Object



11
12
13
# File 'lib/starlark_compiler/ast.rb', line 11

def <<(node)
  @toplevel << node
end