Ignore:
Timestamp:
Feb 13, 2011, 3:30:21 PM (9 years ago)
Author:
cameron
Message:

Make EOF_mask global to avoid masks.EOF_mask hack.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/parabix2_pablo.py

    r911 r913  
    131131        bit_7 = 0
    132132       
    133 class Masks():
    134         EOF_mask = 0   
    135 
    136133class Check_streams():
    137134        misc_mask = 0
     
    316313        scope1.QMark = w1 &~ v1
    317314
    318 def Parse_CtCDPI(ctCDPI_Callouts, lex, scope1, masks, check_streams):
     315def Parse_CtCDPI(ctCDPI_Callouts, lex, scope1, check_streams):
    319316        ctCDPI_Callouts.CD_end = 0
    320317        ctCDPI_Callouts.Ct_starts = 0
     
    342339
    343340        # Scanning streams
    344         CtCDPI_scan = ~CtCDPI_start & masks.EOF_mask
    345         Ct_end_scan = ~DoubleHyphen & masks.EOF_mask
    346         CD_end_scan = ~ctCDPI_Callouts.CD_end & masks.EOF_mask
    347         PI_end_scan = ~PI_end & masks.EOF_mask
     341        CtCDPI_scan = ~CtCDPI_start & EOF_mask
     342        Ct_end_scan = ~DoubleHyphen & EOF_mask
     343        CD_end_scan = ~ctCDPI_Callouts.CD_end & EOF_mask
     344        PI_end_scan = ~PI_end & EOF_mask
    348345        #
    349346        # Initiate the scan
    350347        CtCDPI_Cursor = 1
    351348        CtCDPI_Cursor = bitutil.ScanThru(CtCDPI_Cursor, CtCDPI_scan)
    352         CtCDPI_Cursor &= masks.EOF_mask
     349        CtCDPI_Cursor &= EOF_mask
    353350        while CtCDPI_Cursor:
    354351                CtCDPI_starts |= CtCDPI_Cursor
     
    377374                CtCDPI_Cursor = PI_Cursor | CD_Cursor | Ct_Cursor
    378375                CtCDPI_Cursor = bitutil.ScanThru(CtCDPI_Cursor, CtCDPI_scan)
    379                 CtCDPI_Cursor &= masks.EOF_mask
     376                CtCDPI_Cursor &= EOF_mask
    380377       
    381378                ctCDPI_Callouts.CtCDPI_mask = bitutil.Advance(ctCDPI_Callouts.CD_ends | ctCDPI_Callouts.Ct_ends | ctCDPI_Callouts.PI_ends) - CtCDPI_starts             
     
    385382                ctCDPI_Callouts.error |= ctCDPI_Callouts.PI_name_starts & ctCDPI_Callouts.PI_name_ends
    386383                # If any of the Comment, CDATA or PI markups are unterminated, it is an error.
    387                 ctCDPI_Callouts.error |= ctCDPI_Callouts.CtCDPI_mask &~ masks.EOF_mask
     384                ctCDPI_Callouts.error |= ctCDPI_Callouts.CtCDPI_mask &~ EOF_mask
    388385               
    389         check_streams.misc_mask = (lex.WS | lex.LAngle | (bitutil.Advance(ctCDPI_Callouts.Ct_ends | ctCDPI_Callouts.PI_ends) - (ctCDPI_Callouts.Ct_starts | ctCDPI_Callouts.PI_starts)) | CtCDPI_starts) & masks.EOF_mask
    390 
    391 def Parse_tags(lex, scope1, ctCDPI_Callouts, tag_Callouts, masks):
     386        check_streams.misc_mask = (lex.WS | lex.LAngle | (bitutil.Advance(ctCDPI_Callouts.Ct_ends | ctCDPI_Callouts.PI_ends) - (ctCDPI_Callouts.Ct_starts | ctCDPI_Callouts.PI_starts)) | CtCDPI_starts) & EOF_mask
     387
     388def Parse_tags(lex, scope1, ctCDPI_Callouts, tag_Callouts):
    392389
    393390       
    394391        # Delimiters for scans.
    395         DQuoteScan = ~(lex.DQuote | lex.LAngle) & masks.EOF_mask
    396         SQuoteScan = ~(lex.SQuote | lex.LAngle) & masks.EOF_mask
     392        DQuoteScan = ~(lex.DQuote | lex.LAngle) & EOF_mask
     393        SQuoteScan = ~(lex.SQuote | lex.LAngle) & EOF_mask
    397394        AttListDelim = lex.Slash | lex.RAngle
    398395       
     
    525522        check_streams.non_ascii_names = (name_stream &~ name_start) & ~lex.ASCII_name_char & ~u8.suffix
    526523
    527 #def main(basis_bits, lex, u8, scope1, ctCDPI_Callouts, masks, check_streams, tag_Callouts, ref_Callouts, xml_names):
    528 def Main(basis_bits, lex, u8, xml_char, scope1, ctCDPI_Callouts, ref_Callouts, tag_Callouts, masks, xml_names, check_streams): 
     524def Main(basis_bits, lex, u8, xml_char, scope1, ctCDPI_Callouts, ref_Callouts, tag_Callouts, xml_names, check_streams):
    529525       
    530526        # Classify bytes for UTF-8 processing, whitespace and control
     
    540536   
    541537        # Parse all comments, CDATA sections and processing instructions.
    542         Parse_CtCDPI(ctCDPI_Callouts, lex, scope1, masks, check_streams)
     538        Parse_CtCDPI(ctCDPI_Callouts, lex, scope1, check_streams)
    543539               
    544540        # All remaining '<' must be tag start characters; parse tags.
    545         Parse_tags(lex, scope1, ctCDPI_Callouts, tag_Callouts, masks)
     541        Parse_tags(lex, scope1, ctCDPI_Callouts, tag_Callouts)
    546542
    547543        # All remaining '&' must be reference start characters; parse them.
Note: See TracChangeset for help on using the changeset viewer.