* tool/transcode-tblgen.rb: reject ambiguous mapping.
* enc/trans/single_byte.trans: remove ambiguous maping such as \xD6 -> U+05F2 and \xD6\xC7 -> U+FB1F in Windows-1255 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bce5056cab
commit
fa37ab769f
@ -1,3 +1,10 @@
|
|||||||
|
Sun Mar 14 02:40:38 2010 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* tool/transcode-tblgen.rb: reject ambiguous mapping.
|
||||||
|
|
||||||
|
* enc/trans/single_byte.trans: remove ambiguous maping such as
|
||||||
|
\xD6 -> U+05F2 and \xD6\xC7 -> U+FB1F in Windows-1255
|
||||||
|
|
||||||
Sat Mar 13 23:48:27 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Sat Mar 13 23:48:27 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* file.c (file_expand_path): should not just copy the encoding
|
* file.c (file_expand_path): should not just copy the encoding
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
tbl_to_ucs = control1_if_needed + eval(name.gsub(/-/, '_') + "_TO_UCS_TBL")
|
tbl_to_ucs = control1_if_needed + eval(name.gsub(/-/, '_') + "_TO_UCS_TBL")
|
||||||
set_valid_byte_pattern(name, '1byte')
|
set_valid_byte_pattern(name, '1byte')
|
||||||
code = ''
|
code = ''
|
||||||
code << transcode_tblgen(name, "UTF-8", [["{00-7f}", :nomap], *tbl_to_ucs])
|
code << transcode_tblgen(name, "UTF-8", [["{00-7f}", :nomap], *tbl_to_ucs.reject {|a, b| a.length != 2 }])
|
||||||
code << "\n"
|
code << "\n"
|
||||||
code << transcode_tblgen("UTF-8", name, [["{00-7f}", :nomap], *tbl_to_ucs.map {|a,b| [b,a] }])
|
code << transcode_tblgen("UTF-8", name, [["{00-7f}", :nomap], *tbl_to_ucs.map {|a,b| [b,a] }])
|
||||||
code
|
code
|
||||||
|
@ -133,6 +133,12 @@ class StrSet
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def has_nonempty?
|
||||||
|
@pat.any? {|seq|
|
||||||
|
!seq.empty?
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
def first_bytes
|
def first_bytes
|
||||||
result = {}
|
result = {}
|
||||||
@pat.each {|seq|
|
@pat.each {|seq|
|
||||||
@ -228,6 +234,18 @@ class ActionMap
|
|||||||
@map.keys.map {|k| k.max_length }.max
|
@map.keys.map {|k| k.max_length }.max
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def check_conflict
|
||||||
|
has_empty = false
|
||||||
|
has_nonempty = false
|
||||||
|
@map.each {|ss, action|
|
||||||
|
has_empty = true if ss.emptyable?
|
||||||
|
has_nonempty = true if ss.has_nonempty?
|
||||||
|
}
|
||||||
|
if has_empty && has_nonempty
|
||||||
|
raise "conflict between empty and nonempty sequence"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def empty_action
|
def empty_action
|
||||||
@map.each {|ss, action|
|
@map.each {|ss, action|
|
||||||
return action if ss.emptyable?
|
return action if ss.emptyable?
|
||||||
@ -440,6 +458,7 @@ End
|
|||||||
|
|
||||||
table = Array.new(0x100, :invalid)
|
table = Array.new(0x100, :invalid)
|
||||||
each_firstbyte(valid_encoding) {|byte, rest, rest_valid_encoding|
|
each_firstbyte(valid_encoding) {|byte, rest, rest_valid_encoding|
|
||||||
|
rest.check_conflict
|
||||||
if a = rest.empty_action
|
if a = rest.empty_action
|
||||||
table[byte] = a
|
table[byte] = a
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user