ref/ruby/classes/String.src/M000031.html in ruby-vpi-8.1.0 vs ref/ruby/classes/String.src/M000031.html in ruby-vpi-8.2.0

- old
+ new

@@ -3,16 +3,39 @@ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> - <title>to_ruby_const_name (String)</title> + <title>verilog_to_ruby (String)</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> </head> <body class="standalone-code"> - <pre> <span class="ruby-comment cmt"># File lib/ruby-vpi/verilog_parser.rb, line 133</span> -133: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_ruby_const_name</span> -134: <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span>, <span class="ruby-value">1</span>].<span class="ruby-identifier">upcase</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] -135: <span class="ruby-keyword kw">end</span></pre> + <pre> <span class="ruby-comment cmt"># File lib/ruby-vpi/verilog_parser.rb, line 105</span> +105: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">verilog_to_ruby</span> +106: <span class="ruby-identifier">content</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span> +107: +108: <span class="ruby-comment cmt"># single-line comments</span> +109: <span class="ruby-identifier">content</span>.<span class="ruby-identifier">gsub!</span> <span class="ruby-regexp re">%r{//(.*)$}</span>, <span class="ruby-value str">'#\1'</span> +110: +111: <span class="ruby-comment cmt"># multi-line comments</span> +112: <span class="ruby-identifier">content</span>.<span class="ruby-identifier">gsub!</span> <span class="ruby-regexp re">%r{/\*.*?\*/}</span><span class="ruby-identifier">m</span>, <span class="ruby-value str">&quot;\n=begin\n\\0\n=end\n&quot;</span> +113: +114: <span class="ruby-comment cmt"># preprocessor directives</span> +115: <span class="ruby-identifier">content</span>.<span class="ruby-identifier">gsub!</span> <span class="ruby-regexp re">%r{`include}</span>, <span class="ruby-value str">'#\0'</span> +116: +117: <span class="ruby-identifier">content</span>.<span class="ruby-identifier">gsub!</span> <span class="ruby-regexp re">%r{`define\s+(\w+)\s+(.+)}</span> <span class="ruby-keyword kw">do</span> +118: <span class="ruby-node">&quot;#{$1.to_ruby_const_name} = #{$2}&quot;</span> +119: <span class="ruby-keyword kw">end</span> +120: +121: <span class="ruby-identifier">content</span>.<span class="ruby-identifier">gsub!</span> <span class="ruby-regexp re">%r{`+}</span>, <span class="ruby-value str">''</span> +122: +123: <span class="ruby-comment cmt"># numbers</span> +124: <span class="ruby-identifier">content</span>.<span class="ruby-identifier">gsub!</span> <span class="ruby-regexp re">%r{\d*\'([dohb]\w+)}</span>, <span class="ruby-value str">'0\1'</span> +125: +126: <span class="ruby-comment cmt"># ranges</span> +127: <span class="ruby-identifier">content</span>.<span class="ruby-identifier">gsub!</span> <span class="ruby-regexp re">%r{(\S)\s*:\s*(\S)}</span>, <span class="ruby-value str">'\1..\2'</span> +128: +129: <span class="ruby-identifier">content</span> +130: <span class="ruby-keyword kw">end</span></pre> </body> </html> \ No newline at end of file