зеркало из https://github.com/github/ruby.git
Remove flip-flop usages from build scripts
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
bf7a32d220
Коммит
301fa452f7
|
@ -41,6 +41,7 @@ end
|
|||
|
||||
def prelude(f, out)
|
||||
@exprs = {}
|
||||
lex_state_def = false
|
||||
while line = f.gets
|
||||
case line
|
||||
when /\A%%/
|
||||
|
@ -50,8 +51,16 @@ def prelude(f, out)
|
|||
out << line.sub(/<\w+>/, '<val>')
|
||||
when /\A%type/
|
||||
out << line.sub(/<\w+>/, '<val>')
|
||||
when /^enum lex_state_(?:bits|e) \{/
|
||||
lex_state_def = true
|
||||
out << line
|
||||
when /^\}/
|
||||
lex_state_def = false
|
||||
out << line
|
||||
else
|
||||
if (/^enum lex_state_(?:bits|e) \{/ =~ line)..(/^\}/ =~ line)
|
||||
out << line
|
||||
end
|
||||
if lex_state_def
|
||||
case line
|
||||
when /^\s*(EXPR_\w+),\s+\/\*(.+)\*\//
|
||||
@exprs[$1.chomp("_bit")] = $2.strip
|
||||
|
@ -61,8 +70,6 @@ def prelude(f, out)
|
|||
@exprs[name] = "equals to " + (val.start_with?("(") ? "<tt>#{val}</tt>" : "+#{val}+")
|
||||
end
|
||||
end
|
||||
out << line
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -40,10 +40,19 @@ encdirs.each do |encdir|
|
|||
files[fn] = true
|
||||
open(File.join(encdir,fn)) do |f|
|
||||
name = nil
|
||||
skip_ifndef_ruby = false
|
||||
encoding_def = false
|
||||
f.each_line do |line|
|
||||
if (/^#ifndef RUBY/ =~ line)..(/^#endif/ =~ line)
|
||||
elsif (/^OnigEncodingDefine/ =~ line)..(/"(.*?)"/ =~ line)
|
||||
if $1
|
||||
case line
|
||||
when /^#ifndef RUBY/
|
||||
skip_ifndef_ruby = true
|
||||
when /^#endif/
|
||||
skip_ifndef_ruby = false
|
||||
end
|
||||
next if skip_ifndef_ruby
|
||||
encoding_def = true if /^OnigEncodingDefine/ =~ line
|
||||
if encoding_def && /"(.*?)"/ =~ line
|
||||
encoding_def = false
|
||||
if name
|
||||
lines << %[ENC_SET_BASE("#$1", "#{name}");]
|
||||
else
|
||||
|
@ -53,7 +62,6 @@ encdirs.each do |encdir|
|
|||
next if BUILTIN_ENCODINGS[name]
|
||||
encodings << $1
|
||||
count += 1
|
||||
end
|
||||
else
|
||||
case line
|
||||
when /^\s*rb_enc_register\(\s*"([^"]+)"/
|
||||
|
|
|
@ -36,9 +36,11 @@ transdirs.each do |transdir|
|
|||
files[fn] = true
|
||||
path = File.join(transdir,fn)
|
||||
open(path) do |f|
|
||||
transcoder_def = false
|
||||
f.each_line do |line|
|
||||
if (/^static const rb_transcoder/ =~ line)..(/"(.*?)"\s*,\s*"(.*?)"/ =~ line)
|
||||
if $1 && $2
|
||||
transcoder_def = true if /^static const rb_transcoder/ =~ line
|
||||
if transcoder_def && /"(.*?)"\s*,\s*"(.*?)"/ =~ line
|
||||
transcoder_def = false
|
||||
from_to = "%s to %s" % [$1, $2]
|
||||
if converters[from_to]
|
||||
raise ArgumentError, '%s:%d: transcode "%s" is already registered at %s:%d' %
|
||||
|
@ -52,7 +54,6 @@ transdirs.each do |transdir|
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
converter_list.each do |from_to|
|
||||
from, to, fn = *converters[from_to]
|
||||
%>rb_declare_transcoder("<%=from%>", "<%=to%>", "<%=fn%>");
|
||||
|
|
Загрузка…
Ссылка в новой задаче