summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-07 13:43:01 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-07 13:43:01 (GMT)
commit5af7cda5a5ffe0380b6e7bbc8b9cdd452bcfd26d (patch)
tree40c5ce3638b7b5cb9c3b9cb59f798850922d26bb /tool
parent164a93c8b745ae86f11a2a13524ab3cdc5367706 (diff)
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
Diffstat (limited to 'tool')
-rwxr-xr-xtool/node_name.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/tool/node_name.rb b/tool/node_name.rb
index 5c67d7c..dc0584e 100755
--- a/tool/node_name.rb
+++ b/tool/node_name.rb
@@ -1,10 +1,8 @@
-#! ./miniruby
+#! ./miniruby -n
# Used when making Ruby to generate node_name.inc.
# See common.mk for details.
-while gets
- if ~/enum node_type \{/..~/^\};/
- ~/(NODE_.+),/ and puts(" case #{$1}:\n\treturn \"#{$1}\";")
- end
+if (t ||= /^enum node_type \{/ =~ $_) and (t = /^\};/ !~ $_)
+ /(NODE_.+),/ =~ $_ and puts(" case #{$1}:\n\treturn \"#{$1}\";")
end