1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* tool/transcode-tblgen.rb: redundant loop removed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26946 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-03-15 22:21:24 +00:00
parent 32ea96f682
commit 34533445c8
2 changed files with 9 additions and 12 deletions

View file

@ -1,3 +1,7 @@
Tue Mar 16 07:16:56 2010 Tanaka Akira <akr@fsij.org>
* tool/transcode-tblgen.rb: redundant loop removed.
Tue Mar 16 07:01:43 2010 Tanaka Akira <akr@fsij.org>
* tool/transcode-tblgen.rb: refactored to use tree as memo key.

View file

@ -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