summaryrefslogtreecommitdiff
path: root/tool/transcode-tblgen.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-01 05:54:36 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-01 05:54:36 +0000
commit7ae5e9c96010baa16a194e2ce1a9f7f70fb8431e (patch)
tree19a7abbab2e6849d5ffd64f70d09f5fa9330c0c0 /tool/transcode-tblgen.rb
parentd7cffe9768dd89bef46c3cd7d89bd9abc0f71971 (diff)
* tool/transcode-tblgen.rb (transcode_compile_tree): use the first
mapping when some mappings are given for a character. [ruby-dev:36068] * tool/transcode-tblgen.rb: expandtab. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/transcode-tblgen.rb')
-rw-r--r--tool/transcode-tblgen.rb44
1 files changed, 22 insertions, 22 deletions
diff --git a/tool/transcode-tblgen.rb b/tool/transcode-tblgen.rb
index aaf33be..fe84703 100644
--- a/tool/transcode-tblgen.rb
+++ b/tool/transcode-tblgen.rb
@@ -479,29 +479,29 @@ def citrus_decode_mapsrc(ces, csid, mapsrcs)
STDERR.puts 'load mapsrc %s' % path if VERBOSE_MODE
open(path) do |f|
f.each_line do |l|
- break if /^BEGIN_MAP/ =~ l
+ break if /^BEGIN_MAP/ =~ l
end
f.each_line do |l|
- next if /^\s*(?:#|$)/ =~ l
- break if /^END_MAP/ =~ l
- case mode
- when :from_ucs
- case l
- when /0x(\w+)\s*-\s*0x(\w+)\s*=\s*INVALID/
- # table.push << ["{#$1-#$2}", :invalid]
- when /(0x\w+)\s*=\s*(0x\w+)/
- table.push << [$1.hex, citrus_cstomb(ces, csid, $2.hex)]
- else
- raise "unknown notation '%s'"% l
- end
- when :to_ucs
- case l
- when /(0x\w+)\s*=\s*(0x\w+)/
- table.push << [citrus_cstomb(ces, csid, $1.hex), $2.hex]
- else
- raise "unknown notation '%s'"% l
- end
- end
+ next if /^\s*(?:#|$)/ =~ l
+ break if /^END_MAP/ =~ l
+ case mode
+ when :from_ucs
+ case l
+ when /0x(\w+)\s*-\s*0x(\w+)\s*=\s*INVALID/
+ # Citrus OOB_MODE
+ when /(0x\w+)\s*=\s*(0x\w+)/
+ table.push << [$1.hex, citrus_cstomb(ces, csid, $2.hex)]
+ else
+ raise "unknown notation '%s'"% l
+ end
+ when :to_ucs
+ case l
+ when /(0x\w+)\s*=\s*(0x\w+)/
+ table.push << [citrus_cstomb(ces, csid, $1.hex), $2.hex]
+ else
+ raise "unknown notation '%s'"% l
+ end
+ end
end
end
end
@@ -523,7 +523,7 @@ def transcode_compile_tree(name, from, map)
map = encode_utf8(map)
h = {}
map.each {|k, v|
- h[k] = v
+ h[k] = v unless h[k] # use first mapping
}
am = ActionMap.parse(h)