Class: VerilogParser
- Inherits:
-
Object
- Object
- VerilogParser
- Defined in:
- lib/ruby-vpi/verilog_parser.rb
Defined Under Namespace
Classes: Module
Instance Attribute Summary collapse
-
#modules ⇒ Object
readonly
Returns the value of attribute modules.
Instance Method Summary collapse
-
#initialize(aInput) ⇒ VerilogParser
constructor
Parses the given Verilog source code.
Constructor Details
#initialize(aInput) ⇒ VerilogParser
Parses the given Verilog source code.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ruby-vpi/verilog_parser.rb', line 12 def initialize aInput input = aInput.dup # strip comments input.gsub! %r{//.*$}, '' input.gsub! %r{/\*.*?\*/}m, '' @modules = input.scan(%r{(module.*?;)(.*?)endmodule}m).map do |matches| Module.new(*matches) end end |
Instance Attribute Details
#modules ⇒ Object (readonly)
Returns the value of attribute modules.
9 10 11 |
# File 'lib/ruby-vpi/verilog_parser.rb', line 9 def modules @modules end |