Changeset 19238

Show
Ignore:
Timestamp:
12/21/07 23:35:09 (13 months ago)
Author:
rhr
Message:

[Unicode.pm] declarations for most raw UCD data
Utable value fixes

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • misc/pX/Common/Unicode/Unicode.pm

    r19237 r19238  
    1313    <Pc Pd Ps Pe Pi Pf Po P>, <Sm Sc Sk So S>, 
    1414    <Zs Zl Zp Z>, <Cc Cf Cs Co Cn C>, 
     15    # Proplist.txt 
     16    <ASCII_Hex_Digit Bidi_Control Dash Deprecated Diacritic Extender Grapheme_Link>, 
     17    <Hex_Digit Hyphen Ideographic IDS_Binary_Operator IDS_Trinary_Operator Join_Control>, 
     18    <Logical_Order_Exception Noncharacter_Code_Point Other_Alphabetic>, 
     19    <Other_Default_Ignorable_Code_Point Other_Grapheme_Extend Other_ID_Continue>, 
     20    <Other_ID_Start Other_Lowercase Other_Math Other_Uppercase Pattern_Syntax>, 
     21    <Pattern_White_Space Quotation_Mark Radical Soft_Dotted STerm Terminal_Punctuation>, 
     22    <Unified_Ideograph Variation_Selector White_Space>, 
     23    # Perlish stuff 
    1524    <alnum alpha ascii blank cntrl digit graph lower print>, 
    1625    <punct space title upper xdigit word vspace hspace> 
     
    4655 
    4756# ArabicShaping.txt 
     57#     post-6.0? 
     58 
    4859# BidiMirroring.txt 
     60# 0 code 
     61# 1 mirrored code 
     62our Str %bidi_mirror; 
     63 
    4964# Blocks.txt 
     65# 0 code range 
     66# 1 block name 
     67our Utable $blockname; 
     68 
    5069# CompositionExclusions.txt 
     70# 0 code 
     71our Bool %compex; 
     72 
    5173# CaseFolding.txt 
     74# 0 code 
     75# 1 status 
     76# 2 mapping 
     77our Str %casefold_stat; 
     78our Str %casefold_map; 
     79 
    5280# DerivedAge.txt 
     81#     post-6.0? 
     82 
    5383# EastAsianWidth.txt 
     84#     post-6.0? 
     85 
    5486# HangulSyllableType.txt 
     87#     post-6.0? 
     88 
    5589# Jamo.txt 
     90#     post-6.0? 
     91 
    5692# LineBreak.txt 
     93#     post-6.0? 
     94 
    5795# NameAliases.txt 
     96# 0 code 
     97# 1 name 
     98#     see note about names in UnicodeData.txt 
     99 
    58100# NormalizationCorrections.txt 
     101# 0 code 
     102# 1 Original (erroneous) decomposition 
     103# 2 Corrected decomposition 
     104# 3 version corrected 
     105 
    59106# PropertyAliases.txt 
     107# 0 abbrev 
     108# 1 full name 
     109# 2... more aliases 
     110our Str %propalias; 
     111 
    60112# PropertyValueAliases.txt 
     113# 0 prop 
     114# 1 abbrev 
     115# 2 full name 
     116# -- for ccc --- 
     117# 0 ccc 
     118# 1 ccc num 
     119# 2 abbrev 
     120# 3 full name 
     121our Hash of Str %pva; 
     122...; 
     123 
    61124# Scripts.txt 
     125# 0 code range 
     126# 1 script name 
     127our Utable $script; 
     128 
    62129# SpecialCasing.txt 
     130# 0 code 
     131# 1 lower 
     132# 2 title 
     133# 3 upper 
     134# 4 conditionals 
     135our Str %upper_cond; 
     136our Str %lower_cond; 
     137our Str %title_cond; 
     138our Str %case_cond; 
     139 
    63140# Unihan.txt 
     141#     post-6.0? 
     142 
    64143# DerivedCoreProperties.txt 
    65144# DerivedNormalizationProps.txt 
     145 
    66146# Proplist.txt 
     147# 0 code range 
     148# 1 prop name 
     149 
    67150# GraphemeBreakProperty.txt 
     151#     post-6.0? 
     152 
    68153# SentenceBreakProperty.txt 
     154#     post-6.0? 
     155 
    69156# WordBreakProperty.txt 
     157#     post-6.0? 
     158 
    70159 
    71160class Utable { 
     
    82171        @@.table = @@r; 
    83172        @.val = @val; 
    84         $.preen if defined @val; 
     173        $.preen; 
    85174    } 
    86175    multi submethod BUILD(Str $str) { 
     
    133222    } 
    134223 
    135     method lookup(Int $x --> Any) { 
     224    method get(Int $x --> Any) { 
    136225        return undef if !+@@.table; 
    137226        return undef if $x < @@.table[0].min; 
     
    225314            if ( $r.max >= $m.min and $r.min <= $m.min ) or ( $r.max >= $m.max and $r.min <= $m.max ) { 
    226315                # $r and $m overlap 
    227                 die "Utable::add: can't add overlapping ranges with a values" if defined $val; 
     316                die "Utable::add: can't add overlapping ranges with different values" 
     317                    if $val !eqv @.val[$mid]; 
    228318                $m = min($r.min, $m.min) .. max($r.max, $m.max); 
    229319                $.preen if $preen; 
     
    247337            } 
    248338            last if $i == @@.table.elems-1; 
    249             # don't coalesce if we're storing values 
    250             if !+@.val and @@.table[$i].max >= @@.table[$i+1].min { 
     339            if @@.table[$i].max >= @@.table[$i+1].min and @.val[$i] eqv @.val[$i+1]  { 
    251340                @@.table.=splice: $i, 2, @@.table[$i].min .. @@.table[$i+1].max; 
    252341            }