diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-07 13:43:01 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-07 13:43:01 +0000 |
commit | 5af7cda5a5ffe0380b6e7bbc8b9cdd452bcfd26d (patch) | |
tree | 40c5ce3638b7b5cb9c3b9cb59f798850922d26bb | |
parent | 164a93c8b745ae86f11a2a13524ab3cdc5367706 (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
-rwxr-xr-x | tool/node_name.rb | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/tool/node_name.rb b/tool/node_name.rb index 5c67d7ccd5..dc0584e821 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 |