From 34533445c8f7ce9359d126d1fa3388a466022207 Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 15 Mar 2010 22:21:24 +0000 Subject: [PATCH] * tool/transcode-tblgen.rb: redundant loop removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ tool/transcode-tblgen.rb | 17 +++++------------ 2 files changed, 9 insertions(+), 12 deletions(-) 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 -