Method: VerilogTools.get_name

Defined in:
lib/HDLRuby/verilog_hruby.rb

.get_name(statement) ⇒ Object

Tool for getting the name of a statement if any.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/HDLRuby/verilog_hruby.rb', line 90

def self.get_name(statement)
  case statement.type
  when :seq_block, :par_block
    name = statement[0]
    name_txt = name ? name.to_HDLRuby(HDLRubyState::DEFAULT) : ""
    return name_txt
  when :statement
    statement.each do |child|
      next unless child.is_a?(AST)
      seq_par = VerilogTools.get_name(child)
      return seq_par if seq_par
    end
  else
    return ""
  end
end