Changeset 278 for proto


Ignore:
Timestamp:
Aug 20, 2009, 10:21:34 AM (10 years ago)
Author:
cameron
Message:

Add u8u16 version consistent with parabix2

Location:
proto/parabix2
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/parabix2.py

    r277 r278  
    2222import byteclass
    2323
    24 def validate_utf8(bit):
    25         u8.scope22 = bitutil.Advance(u8.prefix2)
    26         u8.scope32 = bitutil.Advance(u8.prefix3)
    27         u8.scope33 = bitutil.Advance(u8.scope32)
    28         u8.scope42 = bitutil.Advance(u8.prefix4)
    29         u8.scope43 = bitutil.Advance(u8.scope42)
    30         u8.scope44 = bitutil.Advance(u8.scope43)
    31         u8lastscope = u8.scope22 | u8.scope33 | u8.scope44
    32         u8anyscope = u8lastscope | u8.scope32 | u8.scope42 | u8.scope43
    33        
    34         # C0-C1 and F5-FF are illegal
    35         error_mask = u8.badprefix
    36        
    37         error_mask |= bitutil.Advance(u8.xE0) & u8.x80_x9F
    38         error_mask |= bitutil.Advance(xED) & u8.xA0_xBF
    39         error_mask |= bitutil.Advance(xF0) & u8.x80_x8F
    40         error_mask |= bitutil.Advance(xF4) & u8.x90_xBF
    41        
    42         error_mask |= u8anyscope ^ u8.suffix
    43         u8.error = error_mask
    44         return u8
     24import u8u16
    4525
    4626def validate_xmlchar(u8, control, lex):
Note: See TracChangeset for help on using the changeset viewer.