Changeset 4190 for proto/charsetcompiler


Ignore:
Timestamp:
Sep 23, 2014, 11:13:45 PM (5 years ago)
Author:
cameron
Message:

Parse @missing specs from PropertyValueAliases?.txt

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/charsetcompiler/UCD/UCD_properties.py

    r4188 r4190  
    175175                self.supported_props = []
    176176                self.property_data_headers = []
     177                self.missing_specs = {}
    177178
    178179        def parse_PropertyAlias_txt(self):
     
    211212           cformat.close_header_file(f)
    212213
     214        def process_missing_spec_format_2(self, s):
     215          UCD_property_value_missing_regexp = re.compile("^#\s*@missing:\s*([0-9A-F]{4,6})[.][.]([0-9A-F]{4,6})\s*;\s*([-A-Za-z_0-9.]+)\s*;\s*([-A-Za-z_0-9.<> ]+)\s*([^#]*)")
     216          m = UCD_property_value_missing_regexp.match(s)
     217          if m:
     218            if m.group(1) != '0000' or m.group(2) != '10FFFF': raise Exception("Bad missing spec: " + s)
     219            cname = canonicalize(m.group(3))
     220            if not self.property_lookup_map.has_key(cname): raise Exception("Bad missing property: " + s)
     221            self.missing_specs[self.property_lookup_map[cname]] = m.group(4)
    213222#
    214223#  UCD Property File Format 2: property value aliases
     
    224233#      although this is redundant, because all binary properties have the
    225234#      same value space.
    226 #
     235#  (4) @missing lines provide default value information, primarily for some
     236#      non-enumerated types
    227237
    228238        def parse_PropertyValueAlias_txt(self):
     
    235245            lines = f.readlines()
    236246            for t in lines:
    237                 if UCD_skip.match(t): continue  # skip comment and blank lines
     247                if UCD_skip.match(t):
     248                  self.process_missing_spec_format_2(t)
     249                  continue  # skip comment and blank lines
    238250                m = UCD_property_value_alias_regexp.match(t)
    239251                if not m: raise Exception("Unknown property value alias syntax: %s" % t)
Note: See TracChangeset for help on using the changeset viewer.