Class: OrigenSTIL::Processor::Pattern

Inherits:
Base
  • Object
show all
Defined in:
lib/origen_stil/processor/pattern.rb

Instance Method Summary collapse

Methods inherited from Base

#handler_missing, #process

Instance Method Details

#on_pat_list_item(node) ⇒ Object



30
31
32
33
34
# File 'lib/origen_stil/processor/pattern.rb', line 30

def on_pat_list_item(node)
  name = node.to_a[0]
  name = name.value if name.try(:type) == :name
  @current_burst << name
end

#on_pattern_burst(node) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/origen_stil/processor/pattern.rb', line 20

def on_pattern_burst(node)
  name, pat_list = *node
  name = name.value if name.try(:type) == :name
  if pat_list
    @bursts[name] = []
    @current_burst = @bursts[name]
    process(pat_list)
  end
end

#run(node, options = {}) ⇒ Object

Yields back the names of pattern blocks to be run as defined in the PatternExec and PatternBurst blocks within the given node



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/origen_stil/processor/pattern.rb', line 6

def run(node, options = {})
  @bursts = {}
  process(node)
  if e = node.find(:pattern_exec)
    e.find_all(:pattern_burst).each do |pb|
      @bursts[pb.to_a[0]].each do |pattern|
        yield pattern
      end
    end
  else
    fail 'No PatternExec block in the given AST!'
  end
end