Skip to content

Commit 5af7cda

Browse files
committed
tool/node_name.rb: rewrote without flip-flop
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 164a93c commit 5af7cda

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

tool/node_name.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
#! ./miniruby
1+
#! ./miniruby -n
22

33
# Used when making Ruby to generate node_name.inc.
44
# See common.mk for details.
55

6-
while gets
7-
if ~/enum node_type \{/..~/^\};/
8-
~/(NODE_.+),/ and puts(" case #{$1}:\n\treturn \"#{$1}\";")
9-
end
6+
if (t ||= /^enum node_type \{/ =~ $_) and (t = /^\};/ !~ $_)
7+
/(NODE_.+),/ =~ $_ and puts(" case #{$1}:\n\treturn \"#{$1}\";")
108
end

0 commit comments

Comments
 (0)