Class: Spektr::Exp::Base

Inherits:
Object
  • Object
show all
Includes:
AST::Processor::Mixin
Defined in:
lib/spektr/exp/base.rb

Direct Known Subclasses

Argument, Const, Definition, Ivasign, Lvasign, Send, Xstr

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ast) ⇒ Base

Returns a new instance of Base.



6
7
8
9
10
11
12
13
14
# File 'lib/spektr/exp/base.rb', line 6

def initialize(ast)
  @ast = ast
  @type = ast.type
  @location = ast.location
  @name = ast.children.first
  @options = {}
  @arguments = []
  @body = []
end

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments.



4
5
6
# File 'lib/spektr/exp/base.rb', line 4

def arguments
  @arguments
end

#astObject

Returns the value of attribute ast.



4
5
6
# File 'lib/spektr/exp/base.rb', line 4

def ast
  @ast
end

#bodyObject

Returns the value of attribute body.



4
5
6
# File 'lib/spektr/exp/base.rb', line 4

def body
  @body
end

#locationObject

Returns the value of attribute location.



4
5
6
# File 'lib/spektr/exp/base.rb', line 4

def location
  @location
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/spektr/exp/base.rb', line 4

def name
  @name
end

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/spektr/exp/base.rb', line 4

def options
  @options
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/spektr/exp/base.rb', line 4

def type
  @type
end

Instance Method Details

#handler_missing(node) ⇒ Object



27
28
29
# File 'lib/spektr/exp/base.rb', line 27

def handler_missing(node)
  # puts "handler missing for #{node.type}"
end

#process(ast) ⇒ Object



22
23
24
25
# File 'lib/spektr/exp/base.rb', line 22

def process(ast)
  return unless ast.respond_to?(:to_ast)
  super
end

#send?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/spektr/exp/base.rb', line 16

def send?
  is_a? Send
end