Changeset 5669


Ignore:
Timestamp:
Oct 5, 2017, 12:14:57 PM (20 months ago)
Author:
cameron
Message:

Full casing properties

Location:
icGREP/icgrep-devel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • icGREP/icgrep-devel/UCD-scripts/UCD_parser.py

    r5668 r5669  
    388388    property_object_map['stc'].finalizeProperty()
    389389
     390def parse_SpecialCasing_txt(property_object_map):
     391    data_records = []
     392    f = open(UCD_config.UCD_src_dir + "/SpecialCasing.txt")
     393    lines = f.readlines()
     394    for t in lines:
     395        if UCD_skip.match(t):
     396            continue  # skip comment and blank lines
     397        (cp, cp_hi, fields) = parse_data_record(t)
     398        if len(fields) != 4: continue   #  Ignore context-dependent casing
     399        if fields[3] != '': continue
     400        (lc, uc, tc) = (fields[0], fields[1], fields[2])
     401        if not uc == '':
     402            property_object_map['uc'].addDataRecord(cp, cp, uc)
     403        if not lc == '':
     404            property_object_map['lc'].addDataRecord(cp, cp, lc)
     405        if not tc == '':
     406            property_object_map['tc'].addDataRecord(cp, cp, tc)
     407    property_object_map['lc'].finalizeProperty()
     408    property_object_map['uc'].finalizeProperty()
     409    property_object_map['tc'].finalizeProperty()
     410
  • icGREP/icgrep-devel/UCD-scripts/UCD_properties.py

    r5668 r5669  
    244244            self.emit_property(f, p)
    245245            property_object = self.property_object_map[p]
    246             if isinstance(property_object, BinaryPropertyObject) or isinstance(property_object, EnumeratedPropertyObject): self.supported_props.append(p)
    247246        f.write("}\n\n")
    248247        cformat.close_header_file(f)
     
    259258            self.emit_property(f, p)
    260259            property_object = self.property_object_map[p]
    261             self.supported_props.append(p)
     260        f.write("}\n\n")
     261        cformat.close_header_file(f)
     262        self.property_data_headers.append(basename)
     263
     264    def generate_SpecialCasing_h(self):
     265        basename = 'SpecialCasing'
     266        parse_SpecialCasing_txt(self.property_object_map)
     267        f = cformat.open_header_file_for_write(basename)
     268        cformat.write_imports(f, ['"PropertyAliases.h"', '"PropertyObjects.h"', '"PropertyValueAliases.h"', '"unicode_set.h"'])
     269        f.write("\nnamespace UCD {\n")
     270        for p in ['lc', 'uc', 'tc']:
     271            self.emit_property(f, p)
     272            property_object = self.property_object_map[p]
    262273        f.write("}\n\n")
    263274        cformat.close_header_file(f)
     
    335346
    336347    ucd.generate_UnicodeData_h()
     348   
     349    ucd.generate_SpecialCasing_h()
     350   
    337351    #
    338352    # The Age property
  • icGREP/icgrep-devel/icgrep/UCD/PropertyObjectTable.h

    r5668 r5669  
    3838#include "Scripts.h"
    3939#include "SentenceBreakProperty.h"
     40#include "SpecialCasing.h"
    4041#include "UnicodeData.h"
    4142#include "WordBreakProperty.h"
     
    5253    &DM_ns::property_object,
    5354    &FC_NFKC_ns::property_object,
    54     new UnsupportedPropertyObject(lc, PropertyObject::ClassTypeId::StringProperty),
     55    &LC_ns::property_object,
    5556    &NFKC_CF_ns::property_object,
    5657    new UnsupportedPropertyObject(scf, PropertyObject::ClassTypeId::StringProperty),
     
    5859    &STC_ns::property_object,
    5960    &SUC_ns::property_object,
    60     new UnsupportedPropertyObject(tc, PropertyObject::ClassTypeId::StringProperty),
    61     new UnsupportedPropertyObject(uc, PropertyObject::ClassTypeId::StringProperty),
     61    &TC_ns::property_object,
     62    &UC_ns::property_object,
    6263    &BMG_ns::property_object,
    6364    &BPB_ns::property_object,
Note: See TracChangeset for help on using the changeset viewer.