ruby-changes:15070
From: akr <ko1@a...>
Date: Tue, 16 Mar 2010 07:21:42 +0900 (JST)
Subject: [ruby-changes:15070] Ruby:r26946 (trunk): * tool/transcode-tblgen.rb: redundant loop removed.
akr 2010-03-16 07:21:24 +0900 (Tue, 16 Mar 2010) New Revision: 26946 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26946 Log: * tool/transcode-tblgen.rb: redundant loop removed. Modified files: trunk/ChangeLog trunk/tool/transcode-tblgen.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 26945) +++ ChangeLog (revision 26946) @@ -1,3 +1,7 @@ +Tue Mar 16 07:16:56 2010 Tanaka Akira <akr@f...> + + * tool/transcode-tblgen.rb: redundant loop removed. + Tue Mar 16 07:01:43 2010 Tanaka Akira <akr@f...> * tool/transcode-tblgen.rb: refactored to use tree as memo key. Index: tool/transcode-tblgen.rb =================================================================== --- tool/transcode-tblgen.rb (revision 26945) +++ tool/transcode-tblgen.rb (revision 26946) @@ -101,17 +101,11 @@ end class ActionMap - def self.parse_to_rects(hash) - h = {} - hash.each {|pat, action| - pat = pat.to_s - h[pat] = action - } - hash = h - + def self.parse_to_rects(mapping) rects = [] n = 0 - hash.each {|pat, action| + mapping.each {|pat, action| + pat = pat.to_s if /\A\s*\(empset\)\s*\z/ =~ pat next elsif /\A\s*\(empstr\)\s*\z/ =~ pat @@ -189,8 +183,8 @@ } end - def self.parse(hash) - rects = parse_to_rects(hash) + def self.parse(mapping) + rects = parse_to_rects(mapping) tree = build_tree(rects) self.new(tree) end @@ -925,4 +919,3 @@ print result end end - -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/