diff --git a/ChangeLog b/ChangeLog index eeb73e864a..1fb03a1842 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Mar 16 07:16:56 2010 Tanaka Akira + + * tool/transcode-tblgen.rb: redundant loop removed. + Tue Mar 16 07:01:43 2010 Tanaka Akira * tool/transcode-tblgen.rb: refactored to use tree as memo key. diff --git a/tool/transcode-tblgen.rb b/tool/transcode-tblgen.rb index 8b60fe4913..4d7b2dc83f 100755 --- a/tool/transcode-tblgen.rb +++ b/tool/transcode-tblgen.rb @@ -101,17 +101,11 @@ class Branch 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 @@ class ActionMap } 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 @@ if __FILE__ == $0 print result end end -