aboutsummaryrefslogtreecommitdiffstats
path: root/tool/transcode-tblgen.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tool/transcode-tblgen.rb')
-rw-r--r--tool/transcode-tblgen.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/tool/transcode-tblgen.rb b/tool/transcode-tblgen.rb
index 832d9a4762..569f8026d6 100644
--- a/tool/transcode-tblgen.rb
+++ b/tool/transcode-tblgen.rb
@@ -1,3 +1,5 @@
+# -*- frozen_string_literal: true -*-
+
require 'optparse'
require 'erb'
require 'fileutils'
@@ -53,7 +55,7 @@ class ArrayCode
@type = type
@name = name
@len = 0;
- @content = ''
+ @content = ''.dup
end
def length
@@ -517,7 +519,7 @@ class ActionMap
infos = infos.map {|info| generate_info(info) }
maxlen = infos.map {|info| info.length }.max
columns = maxlen <= 16 ? 4 : 2
- code = ""
+ code = "".dup
0.step(infos.length-1, columns) {|i|
code << " "
is = infos[i,columns]
@@ -817,7 +819,7 @@ def transcode_compile_tree(name, from, map, valid_encoding)
end
TRANSCODERS = []
-TRANSCODE_GENERATED_TRANSCODER_CODE = ''
+TRANSCODE_GENERATED_TRANSCODER_CODE = ''.dup
def transcode_tbl_only(from, to, map, valid_encoding=UnspecifiedValidEncoding)
if VERBOSE_MODE
@@ -881,7 +883,7 @@ def transcode_generated_code
end
def transcode_register_code
- code = ''
+ code = ''.dup
TRANSCODERS.each {|transcoder_name|
code << " rb_register_transcoder(&#{transcoder_name});\n"
}
@@ -1006,7 +1008,7 @@ if __FILE__ == $0
this_script = File.read(__FILE__)
this_script.force_encoding("ascii-8bit") if this_script.respond_to? :force_encoding
- base_signature = "/* autogenerated. */\n"
+ base_signature = "/* autogenerated. */\n".dup
base_signature << "/* #{make_signature(File.basename(__FILE__), this_script)} */\n"
base_signature << "/* #{make_signature(File.basename(arg), src)} */\n"
@@ -1044,7 +1046,7 @@ if __FILE__ == $0
libs2 = $".dup
libs = libs2 - libs1
- lib_sigs = ''
+ lib_sigs = ''.dup
libs.each {|lib|
lib = File.basename(lib)
path = File.join($srcdir, lib)
@@ -1053,7 +1055,7 @@ if __FILE__ == $0
end
}
- result = ''
+ result = ''.dup
result << base_signature
result << lib_sigs
result << "\n"