Ignore:
Timestamp:
Jul 22, 2010, 11:50:11 AM (9 years ago)
Author:
lindanl
Message:

PI target name extraction; error check

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/parabix2.py

    r441 r528  
    120120        Ct_span = 0
    121121        PI_mask = 0
     122        PI_name = 0
    122123        CtCDPI_mask = 0
    123124        error = 0
     
    147148        error      : __________________1___________
    148149
     150        >>> demo_CtCDPI("<?PI_target??>")
     151        input data : <?PI_target??>
     152        CD_span    : ______________
     153        Ct_span    : ______________
     154        PI_span    : _111111111111_
     155        CtCDPI_mask: _1111111111111
     156        error      : ____________1__
    149157
    150158
     
    158166        CD_ends = 0
    159167        CtCDPI_starts = 0
     168        PI_name_ends = 0
    160169        # Scanning streams
    161170        CtCDPI_scan = ~(lex.CtCD_start | lex.PI_start) & EOF_mask
     
    179188                Ct_Cursor = bitutil.Advance(Ct_Cursor)
    180189                Ct_end_scan |= Ct_Cursor
    181                 PI_Cursor = bitutil.ScanThru(PI_Cursor, PI_end_scan)
     190                #PI_Cursor = bitutil.ScanThru(PI_Cursor, PI_end_scan)
     191                PI_name_end = bitutil.ScanThru( bitutil.Advance(PI_Cursor), lex.NameScan)
     192                PI_name_ends |= PI_name_end
     193                callouts.PI_name |= PI_name_end - PI_Cursor
     194                PI_Cursor = bitutil.ScanThru(PI_name_end, PI_end_scan)
    182195                CD_Cursor = bitutil.ScanThru(CD_Cursor, CD_end_scan)
    183196                Ct_Cursor = bitutil.Advance(bitutil.ScanThru(Ct_Cursor, Ct_end_scan))
     
    195208        callouts.CtCDPI_mask |= bitutil.Advance(CD_ends | Ct_ends | PI_ends) - CtCDPI_starts
    196209        callouts.error = Ct_ends & ~lex.RAngle | Ct_starts & ~ lex.Hyphen
     210        callouts.error |= bitutil.Advance(PI_name_ends & ~ lex.WS) & ~ lex.PI_end
    197211        # If any of the Comment, CDATA or PI markups are unterminated, it is an error.
    198212        callouts.error |= callouts.CtCDPI_mask &~ EOF_mask
Note: See TracChangeset for help on using the changeset viewer.