Ignore:
Timestamp:
Jan 2, 2011, 9:55:38 AM (8 years ago)
Author:
cameron
Message:

Organize call outs from Reference processing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/parabix2_pablo.py

    r860 r861  
    8989        RBracket = 0
    9090
    91 class ctCDPI_Callouts(BitStreamSet):
     91class CtCDPI_Callouts(BitStreamSet):
    9292        Ct_starts = 0
    9393        Ct_ends = 0
     
    101101        error = 0
    102102
    103 
    104 class refs:
    105         GenRefs = 0
    106         DecRefs = 0
    107         HexRefs = 0
    108         delmask = 0
     103class Ref_Callouts(BitStreamSet):
     104        GenRef_starts = 0
     105        GenRef_ends = 0
     106        DecRef_starts = 0
     107        DecRef_ends = 0
     108        HexRef_starts = 0
     109        HexRef_ends = 0
    109110        error = 0
    110111
     
    461462
    462463        # All remaining "&" must be reference start characters; parse them.
    463         # INLINED: refs = parse_refs(lex, ctCDPI_Callouts.CtCDPI_mask)
    464         refs.GenRefs = 0
    465         refs.error = 0
    466         Ref2 = 0
    467         GenRef2 = 0
    468         DecRef3 = 0
    469         HexRef4 = 0
     464
     465        ref_Callouts.GenRef_starts = 0
     466        ref_Callouts.GenRef_ends = 0
     467        ref_Callouts.DecRef_starts = 0
     468        ref_Callouts.DecRef_ends = 0
     469        ref_Callouts.HexRef_starts = 0
     470        ref_Callouts.HexRef_ends = 0
     471        ref_Callouts.error = 0
     472
    470473        Ref1 = lex.RefStart &~ ctCDPI_Callouts.CtCDPI_mask
    471474        if Ref1:
    472475                scope1.RefStart = bitutil.Advance(Ref1)
    473476                NumRef2 = scope1.RefStart & lex.Hash
    474                 GenRef2 = scope1.RefStart &~ lex.Hash
     477                ref_Callouts.GenRef_starts = scope1.RefStart &~ lex.Hash
    475478                NumRef3 = bitutil.Advance(NumRef2)
    476479                HexRef3 = NumRef3 & lex.x
    477                 DecRef3 = NumRef3 &~ lex.x
    478                 HexRef4 = bitutil.Advance(HexRef3)
    479                 GenRefEnds = bitutil.ScanThru(GenRef2, lex.NameScan)
    480                 DecRefEnds = bitutil.ScanThru(DecRef3, lex.Digit)
    481                 HexRefEnds = bitutil.ScanThru(HexRef4, lex.Hex)
     480                ref_Callouts.DecRef_starts = NumRef3 &~ lex.x
     481                ref_Callouts.HexRef_starts = bitutil.Advance(HexRef3)
     482                ref_Callouts.GenRef_ends = bitutil.ScanThru(ref_Callouts.GenRef_starts, lex.NameScan)
     483                ref_Callouts.DecRef_ends = bitutil.ScanThru(ref_Callouts.DecRef_starts, lex.Digit)
     484                ref_Callouts.HexRef_ends = bitutil.ScanThru(ref_Callouts.HexRef_starts, lex.Hex)
    482485                # Error checks
    483486                # At least one digit required for DecRef, one hex digit for HexRef.
    484                 error1 = DecRef3 &~ lex.Digit
    485                 error2 = HexRef4 &~ lex.Hex
     487                ref_error1 = ref_Callouts.DecRef_starts &~ lex.Digit
     488                ref_error2 = ref_Callouts.HexRef_starts &~ lex.Hex
    486489                # Semicolon terminator required (also covers unterminated at EOF).
    487                 error3 = (GenRefEnds | DecRefEnds | HexRefEnds) &~ lex.Semicolon
    488                 refs.GenRefs = GenRefEnds - GenRef2
    489                 #refs.DecRefs = DecRefEnds - DecRef3
    490                 #refs.HexRefs = HexRefEnds - HexRef4
    491                 # Mark references for deletion, but leave the trailing semicolon as
    492                 # the point for insertion of the "expansion" text (most often a
    493                 # single character).
    494 
    495                 refs.error = error1 | error2 | error3
     490                ref_ends = ref_Callouts.GenRef_ends | ref_Callouts.DecRef_ends | ref_Callouts.HexRef_ends
     491                ref_error3 = ref_ends &~ lex.Semicolon
     492                ref_Callouts.error = ref_error1 | ref_error2 | ref_error3
    496493
    497494
     
    503500       
    504501        #name and name start checking streams
     502        PI_names = ctCDPI_Callouts.PI_name_ends - ctCDPI_Callouts.PI_name_starts
     503        GenRefs = ref_Callouts.GenRef_ends - ref_Callouts.GenRef_starts
    505504        qname_stream =  callouts.ElemNames | callouts.AttNames
    506         ncname_stream = ctCDPI_Callouts.PI_name_ends - ctCDPI_Callouts.PI_name_starts | refs.GenRefs
     505        ncname_stream = PI_names | GenRefs
    507506        name_stream = qname_stream | ncname_stream
    508507        name_start = name_stream &~ bitutil.Advance(name_stream)
     
    522521       
    523522        # Consolidate and check for errors
    524         error_mask = u8.error | xmlchar_error | ctCDPI_Callouts.error | callouts.error | CD_end_error | refs.error | namespace_error
     523        error_mask = u8.error | xmlchar_error | ctCDPI_Callouts.error | callouts.error | CD_end_error | ref_Callouts.error | namespace_error
    525524
    526525
     
    528527        tag_marks = callouts.EmptyTagMarks | LAngleFollow | Attname_starts
    529528        NameFollows = ElemNameFollows | AttNameFollows
    530         AttRef = callouts.AttVals & Ref2
    531        
     529        AttRef = callouts.AttVals & scope1.RefStart
     530       
Note: See TracChangeset for help on using the changeset viewer.