Changeset 438


Ignore:
Timestamp:
Jul 5, 2010, 5:35:21 PM (9 years ago)
Author:
cameron
Message:

Restructure to use _scope variables

Location:
proto/parabix2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/byteclass.py

    r416 r438  
    1010# lex.ASCII_name_start, lex.colon
    1111#
     12import bitutil
    1213
    1314class u8_streams ():
     
    1920  suffix = 0
    2021  badprefix = 0
    21   xE0 = 0
    22   xED = 0
    23   xF0 = 0
    24   xF4 = 0
     22  xE0_scope = 0
     23  xED_scope = 0
     24  xF0_scope = 0
     25  xF4_scope = 0
    2526  xA0_xBF = 0
    2627  x80_x9F = 0
    2728  x90_xBF = 0
    2829  x80_x8F = 0
    29   xEF = 0
     30  xEF_scope = 0
    3031  xBF = 0
    3132  xBE = 0
     
    4344  HT = 0
    4445  SP = 0
     46  CR_scope = 0
    4547  CRLF = 0
    4648 
     
    7476  DoubleHyphen = 0
    7577  PI_end = 0
     78  RefStart_scope = 0
     79  LAngle_scope = 0
     80  Hyphen_scope = 0
     81  QMark_scope = 0
     82  RBracket_scope = 0
    7683
    7784
     
    186193  temp71 = (u8.prefix4 & temp70);
    187194  u8.badprefix = (temp68 | temp71);
    188   u8.xE0 = (u8.prefix3 &~ temp36);
    189   u8.xED = (u8.prefix3 & temp20);
    190   u8.xF0 = (u8.prefix4 &~ temp36);
     195  xE0 = (u8.prefix3 &~ temp36);
     196  xED = (u8.prefix3 & temp20);
     197  xF0 = (u8.prefix4 &~ temp36);
    191198  temp72 = (temp4 &~ temp13);
    192   u8.xF4 = (u8.prefix4 & temp72);
     199  xF4 = (u8.prefix4 & temp72);
    193200  u8.xA0_xBF = (u8.suffix & bit[2]);
    194201  u8.x80_x9F = (u8.suffix &~ bit[2]);
    195202  u8.x90_xBF = (u8.suffix & temp49);
    196203  u8.x80_x8F = (u8.suffix &~ temp49);
    197   u8.xEF = (u8.prefix3 & temp23);
     204  xEF = (u8.prefix3 & temp23);
    198205  temp73 = (u8.suffix & temp7);
    199206  u8.xBF = (temp73 & temp23);
    200207  u8.xBE = (temp73 & temp15);
     208  control.CR_scope = bitutil.Advance(control.CR);
     209  u8.xE0_scope = bitutil.Advance(xE0);
     210  u8.xED_scope = bitutil.Advance(xED);
     211  u8.xF0_scope = bitutil.Advance(xF0);
     212  u8.xF4_scope = bitutil.Advance(xF4);
     213  u8.xEF_scope = bitutil.Advance(xEF);
     214  lex.RefStart_scope = bitutil.Advance(lex.RefStart)
     215  lex.LAngle_scope = bitutil.Advance(lex.LAngle)
     216  lex.Hyphen_scope = bitutil.Advance(lex.Hyphen)
     217  lex.QMark_scope = bitutil.Advance(lex.QMark)
     218  lex.RBracket_scope = bitutil.Advance(lex.RBracket)
    201219
    202220  return (u8, control, lex)
  • proto/parabix2/parabix2.py

    r420 r438  
    3737        illegal XML chars : __________________________1_________1_____________
    3838"""
    39         EF_BF_pending = bitutil.Advance(bitutil.Advance(u8.xEF) & u8.xBF)
     39        EF_BF_pending = bitutil.Advance(u8.xEF_scope & u8.xBF)
    4040        return (EF_BF_pending & (u8.xBE | u8.xBF)) | (control.x00_x1F &~ lex.WS & EOF_mask)
    4141
     
    5959        CRLF              : ____1_____________
    6060"""
    61         control.CRLF = bitutil.Advance(control.CR) & control.LF
     61        control.CRLF = control.CR_scope & control.LF
    6262        # Convert CRs to LFs (flip bits 5, 6 and 7 with xor).
    6363        bit[5] ^= control.CR
     
    9595        """
    9696
    97         LAngleFollow = bitutil.Advance(lex.LAngle)
    98         lex.PI_start = LAngleFollow & lex.QMark
    99         lex.CtCD_start = LAngleFollow & lex.Exclam
    100         lex.EndTag_start = LAngleFollow & lex.Slash
    101         lex.CD_end = bitutil.Advance(bitutil.Advance(lex.RBracket) & lex.RBracket) & lex.RAngle
    102         lex.DoubleHyphen = bitutil.Advance(lex.Hyphen) & lex.Hyphen
    103         lex.PI_end = bitutil.Advance(lex.QMark) & lex.RAngle
     97        lex.PI_start = lex.LAngle_scope & lex.QMark
     98        lex.CtCD_start = lex.LAngle_scope & lex.Exclam
     99        lex.EndTag_start = lex.LAngle_scope & lex.Slash
     100        lex.CD_end = bitutil.Advance(lex.RBracket_scope & lex.RBracket) & lex.RAngle
     101        lex.DoubleHyphen = lex.Hyphen_scope & lex.Hyphen
     102        lex.PI_end = lex.QMark_scope & lex.RAngle
    104103        return lex
    105104
     
    252251"""
    253252        CallOuts = ref_callouts()
    254         Ref2 = bitutil.Advance(lex.RefStart &~ CtCDPI_mask)
     253        Ref2 = lex.RefStart_scope &~ CtCDPI_mask
    255254        NumRef2 = Ref2 & lex.Hash
    256255        GenRef2 = Ref2 &~ lex.Hash
     
    427426        # Start the parallel parsing by inspecting the character
    428427        # after the opening "<" of a tag.
    429         LAngleFollow = bitutil.Advance(lex.LAngle) &~ CtCDPI_mask
     428        LAngleFollow = lex.LAngle_scope &~ CtCDPI_mask
    430429        ElemNamePositions = LAngleFollow & ~lex.Slash
    431430        EndTagSeconds = LAngleFollow & lex.Slash
  • proto/parabix2/parabix2_compilable.py

    r423 r438  
    3737        illegal XML chars : __________________________1_________1_____________
    3838"""
    39         EF_BF_pending = bitutil.Advance(bitutil.Advance(u8.xEF) & u8.xBF)
     39        EF_BF_pending = bitutil.Advance(u8.xEF_scope & u8.xBF)
    4040        ret = (EF_BF_pending & (u8.xBE | u8.xBF)) | (control.x00_x1F &~ lex.WS & EOF_mask)
    4141        return ret
     
    6060        CRLF              : ____1_____________
    6161"""
    62         control.CRLF = bitutil.Advance(control.CR) & control.LF
     62        control.CRLF = control.CR_scope & control.LF
    6363        # Convert CRs to LFs (flip bits 5, 6 and 7 with xor).
    6464        bit[5] ^= control.CR
     
    9696        """
    9797
    98         LAngleFollow = bitutil.Advance(lex.LAngle)
    99         lex.PI_start = LAngleFollow & lex.QMark
    100         lex.CtCD_start = LAngleFollow & lex.Exclam
    101         lex.EndTag_start = LAngleFollow & lex.Slash
    102         lex.CD_end = bitutil.Advance(bitutil.Advance(lex.RBracket) & lex.RBracket) & lex.RAngle
    103         lex.DoubleHyphen = bitutil.Advance(lex.Hyphen) & lex.Hyphen
    104         lex.PI_end = bitutil.Advance(lex.QMark) & lex.RAngle
     98        lex.PI_start = lex.LAngle_scope & lex.QMark
     99        lex.CtCD_start = lex.LAngle_scope & lex.Exclam
     100        lex.EndTag_start = lex.LAngle_scope & lex.Slash
     101        lex.CD_end = bitutil.Advance(lex.RBracket_scope & lex.RBracket) & lex.RAngle
     102        lex.DoubleHyphen = lex.Hyphen_scope & lex.Hyphen
     103        lex.PI_end = lex.QMark_scope & lex.RAngle
    105104        return lex
    106105
     
    253252"""
    254253        CallOuts = ref_callouts()
    255         Ref2 = bitutil.Advance(lex.RefStart &~ CtCDPI_mask)
     254        Ref2 = lex.RefStart_scope &~ CtCDPI_mask
    256255        NumRef2 = Ref2 & lex.Hash
    257256        GenRef2 = Ref2 &~ lex.Hash
     
    428427        # Start the parallel parsing by inspecting the character
    429428        # after the opening "<" of a tag.
    430         LAngleFollow = bitutil.Advance(lex.LAngle) &~ CtCDPI_mask
     429        LAngleFollow = lex.LAngle_scope &~ CtCDPI_mask
    431430        ElemNamePositions = LAngleFollow & ~lex.Slash
    432431        EndTagSeconds = LAngleFollow & lex.Slash
  • proto/parabix2/u8u16.py

    r314 r438  
    3636        error_mask = u8.badprefix
    3737       
    38         error_mask |= bitutil.Advance(u8.xE0) & u8.x80_x9F
    39         error_mask |= bitutil.Advance(u8.xED) & u8.xA0_xBF
    40         error_mask |= bitutil.Advance(u8.xF0) & u8.x80_x8F
    41         error_mask |= bitutil.Advance(u8.xF4) & u8.x90_xBF
     38        error_mask |= u8.xE0_scope & u8.x80_x9F
     39        error_mask |= u8.xED_scope & u8.xA0_xBF
     40        error_mask |= u8.xF0_scope & u8.x80_x8F
     41        error_mask |= u8.xF4_scope & u8.x90_xBF
    4242       
    4343        error_mask |= u8anyscope ^ u8.suffix
Note: See TracChangeset for help on using the changeset viewer.