summaryrefslogtreecommitdiff
path: root/template
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-25 07:20:29 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-08-25 07:20:29 +0000
commitbcbc1f722c0ab7e26334c6fdafab502f4f021860 (patch)
tree8d3363d01cb6457a6b909e58e28a75330b2f02c4 /template
parent67e79d1d372879dd9bd185b508aad150de76ff6f (diff)
generic_erb.rb: --vpath option
* tool/generic_erb.rb (vpath.open): move --vpath option from template/id.h.tmpl. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'template')
-rw-r--r--template/id.h.tmpl19
1 files changed, 4 insertions, 15 deletions
diff --git a/template/id.h.tmpl b/template/id.h.tmpl
index 15eb25b..3279064 100644
--- a/template/id.h.tmpl
+++ b/template/id.h.tmpl
@@ -12,24 +12,13 @@
**********************************************************************/
<%
require 'optparse'
-vpath = ["."]
-input = nil
-opt = OptionParser.new do |o|
- o.on('-v', '--vpath=DIR') {|dirs| vpath.concat dirs.split(File::PATH_SEPARATOR)}
- input, = o.order!(ARGV)
-end or abort opt.opt_s
+input = ARGV.shift or abort opt.opt_s
tokens = nil
-vpath.find do |dir|
- begin
- if line = File.read(File.join(dir, input))[/^\s*enum\s+yytokentype\s*\{([^{}]*)\s*\};/m, 1]
- tokens = line.scan(/\b(t(?:LAST_TOKEN|U(?:PLUS|MINUS)|POW|CMP|EQQ?|[NGL]EQ|(?:AND|OR)OP|N?MATCH|DOT\d|AREF|ASET|[LR]SHFT|LAMBDA)|id\w+)\s*=\s*(\d+),?/m)
- end
- rescue Errno::ENOENT
- nil
- else
- true
+vpath.open(input) do |f|
+ if line = f.read[/^\s*enum\s+yytokentype\s*\{([^{}]*)\s*\};/m, 1]
+ tokens = line.scan(/\b(t(?:LAST_TOKEN|U(?:PLUS|MINUS)|POW|CMP|EQQ?|[NGL]EQ|(?:AND|OR)OP|N?MATCH|DOT\d|AREF|ASET|[LR]SHFT|LAMBDA)|id\w+)\s*=\s*(\d+),?/m)
end
end