Class: OrigenVerilog::Preprocessor::Concatenator
Overview
Concatenates all text_block nodes
Instance Method Summary
collapse
#inline, #process, #process_all
Instance Method Details
#handler_missing(node) ⇒ Object
33
34
35
|
# File 'lib/origen_verilog/preprocessor/contatenator.rb', line 33
def handler_missing(node)
fail "No handler defined for node type: #{node.type}"
end
|
#on_file(node) ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/origen_verilog/preprocessor/contatenator.rb', line 22
def on_file(node)
node = Concatenator.new.run(node)
if @text_block
tb = @text_block
@text_block = nil
inline [tb, node]
else
node
end
end
|
#on_text_block(node) ⇒ Object
Also known as:
12
13
14
15
16
17
18
19
|
# File 'lib/origen_verilog/preprocessor/contatenator.rb', line 12
def on_text_block(node)
if @text_block
@text_block = @text_block.updated(:text_block, [@text_block.to_a[0] + node.to_a[0]])
else
@text_block = node
end
nil
end
|
#run(node) ⇒ Object
5
6
7
8
9
10
|
# File 'lib/origen_verilog/preprocessor/contatenator.rb', line 5
def run(node)
@text_block = nil
nodes = process_all(node.children)
nodes << @text_block if @text_block
node.updated(nil, nodes)
end
|