Sha256: 47776f47ce239acfba028f33de1e09dcb1659b47214e83d3bdf45597b109e080
Contents?: true
Size: 933 Bytes
Versions: 8
Compression:
Stored size: 933 Bytes
Contents
module OrigenVerilog module Preprocessor # Invokes the Verilog parser on all text_block nodes, transforming the # given pre-processor output AST into a Verilog AST class VerilogParser < OrigenVerilog::Processor def run(node, options = {}) @nodes = [] @file = options[:file] @options = options process_all(node.children) Verilog::Node.new(:verilog_source, @nodes, file: @file) end def on_text_block(node) node = Verilog::Parser.parse(node.to_a[0], @options.merge(file: @file)) @nodes += node.children nil end def on_file(node) file, *nodes = *node node = VerilogParser.new.run(node.updated(nil, nodes), @options.merge(file: file)) @nodes += node.children nil end def handler_missing(node) fail "No handler defined for node type: #{node.type}" end end end end
Version data entries
8 entries across 8 versions & 1 rubygems