Ignore:
Timestamp:
Feb 13, 2011, 12:25:35 PM (8 years ago)
Author:
lindanl
Message:

Change post_process to check_streams in parabix2_pablo.py. Add postprocess_do_block function. Change tag_macher to TagMatcher? and make the matcher global.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/parabix2_pablo.py

    r904 r911  
    134134        EOF_mask = 0   
    135135
    136 class Post_process():
     136class Check_streams():
    137137        misc_mask = 0
    138138        non_ascii_name_starts = 0
     
    316316        scope1.QMark = w1 &~ v1
    317317
    318 def Parse_CtCDPI(ctCDPI_Callouts, lex, scope1, masks, post_process):
     318def Parse_CtCDPI(ctCDPI_Callouts, lex, scope1, masks, check_streams):
    319319        ctCDPI_Callouts.CD_end = 0
    320320        ctCDPI_Callouts.Ct_starts = 0
     
    387387                ctCDPI_Callouts.error |= ctCDPI_Callouts.CtCDPI_mask &~ masks.EOF_mask
    388388               
    389         post_process.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
     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
    390390
    391391def Parse_tags(lex, scope1, ctCDPI_Callouts, tag_Callouts, masks):
     
    504504                ref_Callouts.error = ref_error1 | ref_error2 | ref_error3
    505505
    506 def Validate_xml_names(ctCDPI_Callouts, ref_Callouts, tag_Callouts, lex, u8, xml_names, post_process):
     506def Validate_xml_names(ctCDPI_Callouts, ref_Callouts, tag_Callouts, lex, u8, xml_names, check_streams):
    507507        PI_names = ctCDPI_Callouts.PI_name_ends - ctCDPI_Callouts.PI_name_starts
    508508        GenRefs = ref_Callouts.GenRef_ends - ref_Callouts.GenRef_starts
     
    522522        xml_names.namespace_error = void_prefix_err | local_part_err | colon2_err | ncname_err
    523523                       
    524         post_process.non_ascii_name_starts = name_start &~lex.ASCII_name_start
    525         post_process.non_ascii_names = (name_stream &~ name_start) & ~lex.ASCII_name_char & ~u8.suffix
    526 
    527 #def main(basis_bits, lex, u8, scope1, ctCDPI_Callouts, masks, post_process, 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, post_process):   
     524        check_streams.non_ascii_name_starts = name_start &~lex.ASCII_name_start
     525        check_streams.non_ascii_names = (name_stream &~ name_start) & ~lex.ASCII_name_char & ~u8.suffix
     526
     527#def main(basis_bits, lex, u8, scope1, ctCDPI_Callouts, masks, check_streams, tag_Callouts, ref_Callouts, xml_names):
     528def Main(basis_bits, lex, u8, xml_char, scope1, ctCDPI_Callouts, ref_Callouts, tag_Callouts, masks, xml_names, check_streams): 
    529529       
    530530        # Classify bytes for UTF-8 processing, whitespace and control
     
    540540   
    541541        # Parse all comments, CDATA sections and processing instructions.
    542         Parse_CtCDPI(ctCDPI_Callouts, lex, scope1, masks, post_process)
     542        Parse_CtCDPI(ctCDPI_Callouts, lex, scope1, masks, check_streams)
    543543               
    544544        # All remaining '<' must be tag start characters; parse tags.
     
    552552       
    553553        # Validate XML namespaces and generate bit streams to post validate non-ascii range XML names
    554         Validate_xml_names(ctCDPI_Callouts, ref_Callouts, tag_Callouts, lex, u8, xml_names, post_process)
     554        Validate_xml_names(ctCDPI_Callouts, ref_Callouts, tag_Callouts, lex, u8, xml_names, check_streams)
    555555               
    556556        # Consolidate and check for errors
    557         post_process.error_mask = lex.error & EOF_mask | u8.error | u8.FFFE_FFFF | ctCDPI_Callouts.error | tag_Callouts.error | CD_end_error | ref_Callouts.error | xml_names.namespace_error
    558 
    559         post_process.tag_marks = tag_Callouts.EmptyTag_marks | tag_Callouts.LAngleFollow | tag_Callouts.AttName_starts
    560         post_process.name_follows = tag_Callouts.ElemName_ends | tag_Callouts.AttName_ends
    561         post_process.att_refs = tag_Callouts.AttVal_spans & scope1.RefStart             
     557        check_streams.error_mask = lex.error & EOF_mask | u8.error | u8.FFFE_FFFF | ctCDPI_Callouts.error | tag_Callouts.error | CD_end_error | ref_Callouts.error | xml_names.namespace_error
     558
     559        check_streams.tag_marks = tag_Callouts.EmptyTag_marks | tag_Callouts.LAngleFollow | tag_Callouts.AttName_starts
     560        check_streams.name_follows = tag_Callouts.ElemName_ends | tag_Callouts.AttName_ends
     561        check_streams.att_refs = tag_Callouts.AttVal_spans & scope1.RefStart           
Note: See TracChangeset for help on using the changeset viewer.