Class: OrigenTesters::ATP::AST::Extractor

Inherits:
Object
  • Object
show all
Includes:
AST::Processor::Mixin
Defined in:
lib/origen_testers/atp/ast/extractor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#resultsObject (readonly)

Returns the value of attribute results.


8
9
10
# File 'lib/origen_testers/atp/ast/extractor.rb', line 8

def results
  @results
end

#typesObject (readonly)

Returns the value of attribute types.


7
8
9
# File 'lib/origen_testers/atp/ast/extractor.rb', line 7

def types
  @types
end

Instance Method Details

#handler_missing(node) ⇒ Object


20
21
22
23
# File 'lib/origen_testers/atp/ast/extractor.rb', line 20

def handler_missing(node)
  @results << node if types.include?(node.type)
  process_all(node.children)
end

#process(node, types = nil) ⇒ Object


10
11
12
13
14
15
16
17
18
# File 'lib/origen_testers/atp/ast/extractor.rb', line 10

def process(node, types = nil)
  if types
    @types = types
    @results = []
    # node = AST::Node.new(:wrapper, node) unless node.respond_to?(:to_ast)
  end
  super(node) if node.respond_to?(:to_ast)
  results
end