summaryrefslogtreecommitdiff
path: root/tool/transcode-tblgen.rb
diff options
context:
space:
mode:
authorduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-14 11:12:30 +0000
committerduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-14 11:12:30 +0000
commit82c673d3a1cab4a9f8a1e9ac30b28f108d726606 (patch)
tree13ed8e4ad29b7f6020af72d7a823da3cfa64b7e6 /tool/transcode-tblgen.rb
parentb949be82cfc78993d8cc5ec431e9193a5a07af50 (diff)
* enc/trans/gb18030.trans, gb18030-tbl.rb:
new Chinese GB18030 transcoding (from Yoshihiro Kambayashi) * test/ruby/test_transcode.rb: added tests for the above (from Yoshihiro Kambayashi) * transcode_data.h, transcode.c, tool/transcode_tblgen.rb: added support for GB18030-specific 4-byte sequences (with Yoshihiro Kambayashi) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/transcode-tblgen.rb')
-rw-r--r--tool/transcode-tblgen.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/tool/transcode-tblgen.rb b/tool/transcode-tblgen.rb
index 870d971..170c314 100644
--- a/tool/transcode-tblgen.rb
+++ b/tool/transcode-tblgen.rb
@@ -334,6 +334,8 @@ class ActionMap
"o2(0x#$1,0x#$2)"
when /\A([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])\z/i
"o3(0x#$1,0x#$2,0x#$3)"
+ when /\A([0-9a-f][0-9a-f])(3[0-9])([0-9a-f][0-9a-f])(3[0-9])\z/i
+ "g4(0x#$1,0x#$2,0x#$3,0x#$4)"
when /\A(f[0-7])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])\z/i
"o4(0x#$1,0x#$2,0x#$3,0x#$4)"
when /\A([0-9a-f][0-9a-f]){4,259}\z/i
@@ -605,7 +607,7 @@ end
TRANSCODERS = []
TRANSCODE_GENERATED_TRANSCODER_CODE = ''
-def transcode_tblgen(from, to, map)
+def transcode_tbl_only (from, to, map)
if VERBOSE_MODE
if from.empty? || to.empty?
STDERR.puts "converter for #{from.empty? ? to : from}"
@@ -624,6 +626,11 @@ def transcode_tblgen(from, to, map)
end
map = encode_utf8(map)
real_tree_name, max_input = transcode_compile_tree(tree_name, from, map)
+ return map, tree_name, real_tree_name, max_input
+end
+
+def transcode_tblgen(from, to, map)
+ map, tree_name, real_tree_name, max_input = transcode_tbl_only(from, to, map)
transcoder_name = "rb_#{tree_name}"
TRANSCODERS << transcoder_name
input_unit_length = UnitLength[from]