mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
d22ac50ad4
* tool/generic_erb.rb, tool/id2token.rb: add --path-separator option for mingw where make and built ruby live in different world. * tool/vpath.rb: extract from tool/instruction.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
24 lines
595 B
Ruby
Executable file
24 lines
595 B
Ruby
Executable file
#! /usr/bin/ruby -p
|
|
# -*- coding: us-ascii -*-
|
|
BEGIN {
|
|
require 'optparse'
|
|
$:.unshift(File.dirname(__FILE__))
|
|
require 'vpath'
|
|
vpath = VPath.new
|
|
header = nil
|
|
|
|
opt = OptionParser.new do |o|
|
|
vpath.def_options(o)
|
|
header = o.order!(ARGV).shift
|
|
end or abort opt.opt_s
|
|
|
|
TOKENS = {}
|
|
h = vpath.read(header) rescue abort("#{header} not found in #{vpath.inspect}")
|
|
h.scan(/^#define\s+RUBY_TOKEN_(\w+)\s+(\d+)/) do |token, id|
|
|
TOKENS[token] = id
|
|
end
|
|
|
|
TOKENS_RE = /\bRUBY_TOKEN\((#{TOKENS.keys.join('|')})\)\s*(?=\s)/
|
|
}
|
|
|
|
$_.gsub!(TOKENS_RE) {TOKENS[$1]} if /^%token/ =~ $_
|