Changeset 1492 for proto/SymbolTable


Ignore:
Timestamp:
Sep 23, 2011, 5:23:26 PM (8 years ago)
Author:
vla24
Message:

SymbolTable?: Edited python code for parallel bitstream technique using advance32

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/SymbolTable/parabix2_symtab_pbs_adv.py

    r1232 r1492  
    272272                u8.badprefix = (temp68 | temp71);
    273273                u8_error = u8.badprefix
    274                 u8.scope22 = bitutil.Advance(u8.prefix2)
     274                u8.scope22 = pablo.Advance(u8.prefix2)
    275275                u8anyscope = u8.scope22
    276276                if u8.prefix3 | u8.prefix4:
     
    288288                        u8.xBF = (temp73 & temp23);
    289289                        u8.xBE = (temp73 & temp15);
    290                         u8.xE0_scope = bitutil.Advance(xE0);
    291                         u8.xED_scope = bitutil.Advance(xED);
    292                         u8.xF0_scope = bitutil.Advance(xF0);
    293                         u8.xF4_scope = bitutil.Advance(xF4);
    294                         u8.xEF_scope = bitutil.Advance(xEF);
    295                         u8.scope32 = bitutil.Advance(u8.prefix3)
    296                         u8.scope33 = bitutil.Advance(u8.scope32)
    297                         u8.scope42 = bitutil.Advance(u8.prefix4)
    298                         u8.scope43 = bitutil.Advance(u8.scope42)
    299                         u8.scope44 = bitutil.Advance(u8.scope43)
     290                        u8.xE0_scope = pablo.Advance(xE0);
     291                        u8.xED_scope = pablo.Advance(xED);
     292                        u8.xF0_scope = pablo.Advance(xF0);
     293                        u8.xF4_scope = pablo.Advance(xF4);
     294                        u8.xEF_scope = pablo.Advance(xEF);
     295                        u8.scope32 = pablo.Advance(u8.prefix3)
     296                        u8.scope33 = pablo.Advance(u8.scope32)
     297                        u8.scope42 = pablo.Advance(u8.prefix4)
     298                        u8.scope43 = pablo.Advance(u8.scope42)
     299                        u8.scope44 = pablo.Advance(u8.scope43)
    300300
    301301                        u8lastscope = u8.scope22 | u8.scope33 | u8.scope44
     
    309309                        u8_error |= u8error1 | u8error2 | u8error3 | u8error4
    310310
    311                         EF_BF_pending = bitutil.Advance(u8.xEF_scope & u8.xBF)
     311                        EF_BF_pending = pablo.Advance(u8.xEF_scope & u8.xBF)
    312312
    313313                        u8_FFFE_FFFF = (EF_BF_pending & (u8.xBE | u8.xBF))
     
    319319
    320320def Add_scope_streams(lex, scope1):
    321         #scope1.LAngle = bitutil.Advance(lex.LAngle)
    322         #scope1.Hyphen = bitutil.Advance(lex.Hyphen)
    323         #scope1.QMark = bitutil.Advance(lex.QMark)
     321        #scope1.LAngle = pablo.Advance(lex.LAngle)
     322        #scope1.Hyphen = pablo.Advance(lex.Hyphen)
     323        #scope1.QMark = pablo.Advance(lex.QMark)
    324324        v = lex.LAngle | lex.Hyphen
    325325        w = lex.Hyphen | lex.QMark
    326         v1 = bitutil.Advance(v)
    327         w1 = bitutil.Advance(w)
     326        v1 = pablo.Advance(v)
     327        w1 = pablo.Advance(w)
    328328        scope1.LAngle = v1 &~ w1
    329329        scope1.Hyphen = v1 & w1
     
    347347
    348348        if lex.RBracket:
    349                 scope1.RBracket = bitutil.Advance(lex.RBracket)
    350                 ctCDPI_Callouts.CD_end = bitutil.Advance(scope1.RBracket & lex.RBracket) & lex.RAngle
     349                scope1.RBracket = pablo.Advance(lex.RBracket)
     350                ctCDPI_Callouts.CD_end = pablo.Advance(scope1.RBracket & lex.RBracket) & lex.RAngle
    351351        PI_start = scope1.LAngle & lex.QMark
    352352        CtCD_start = scope1.LAngle & lex.Exclam
     
    359359        #
    360360        # Initiate the scan
    361         CtCDPI_Cursor = bitutil.ScanToFirst(CtCDPI_start)
     361        CtCDPI_Cursor = pablo.ScanToFirst(CtCDPI_start)
    362362        while CtCDPI_Cursor:
    363363                CtCDPI_starts |= CtCDPI_Cursor
    364364                PI_Cursor = CtCDPI_Cursor & PI_start
    365                 CD_Ct_Cursor = bitutil.Advance(CtCDPI_Cursor & ~PI_Cursor)
     365                CD_Ct_Cursor = pablo.Advance(CtCDPI_Cursor & ~PI_Cursor)
    366366                CD_Cursor = CD_Ct_Cursor & lex.LBracket
    367367                Ct_Cursor = CD_Ct_Cursor & lex.Hyphen
     
    369369                ctCDPI_Callouts.CD_starts |= CD_Cursor
    370370                ctCDPI_Callouts.Ct_starts |= Ct_Cursor
    371                 Ct_Cursor = bitutil.Advance(Ct_Cursor)
     371                Ct_Cursor = pablo.Advance(Ct_Cursor)
    372372                Ct_errors |= Ct_Cursor & ~ lex.Hyphen
    373373                # Advance twice past <!--, so that we don't treat <!---
    374374                # as being a terminated comment.
    375                 Ct_Cursor = bitutil.Advance(bitutil.Advance(Ct_Cursor))
    376                 PI_Cursor = bitutil.Advance(PI_Cursor)
     375                Ct_Cursor = pablo.Advance(pablo.Advance(Ct_Cursor))
     376                PI_Cursor = pablo.Advance(PI_Cursor)
    377377                ctCDPI_Callouts.PI_name_starts |= PI_Cursor
    378                 PI_name_end = bitutil.ScanThru(PI_Cursor, lex.NameScan)
     378                PI_name_end = pablo.ScanThru(PI_Cursor, lex.NameScan)
    379379                ctCDPI_Callouts.PI_name_ends |= PI_name_end
    380                 PI_Cursor = bitutil.ScanTo(PI_name_end, PI_end)
    381                 CD_Cursor = bitutil.ScanTo(CD_Cursor, ctCDPI_Callouts.CD_end)
    382                 Ct_Cursor = bitutil.Advance(bitutil.ScanTo(Ct_Cursor, DoubleHyphen))
     380                PI_Cursor = pablo.ScanTo(PI_name_end, PI_end)
     381                CD_Cursor = pablo.ScanTo(CD_Cursor, ctCDPI_Callouts.CD_end)
     382                Ct_Cursor = pablo.Advance(pablo.ScanTo(Ct_Cursor, DoubleHyphen))
    383383                ctCDPI_Callouts.PI_ends |= PI_Cursor
    384384                ctCDPI_Callouts.CD_ends |= CD_Cursor
    385385                ctCDPI_Callouts.Ct_ends |= Ct_Cursor
    386386                CtCDPI_Cursor = PI_Cursor | CD_Cursor | Ct_Cursor
    387                 CtCDPI_Cursor = bitutil.ScanTo(CtCDPI_Cursor, CtCDPI_start)
    388 
    389                 ctCDPI_Callouts.CtCDPI_mask = bitutil.Advance(ctCDPI_Callouts.CD_ends | ctCDPI_Callouts.Ct_ends | ctCDPI_Callouts.PI_ends) - CtCDPI_starts
     387                CtCDPI_Cursor = pablo.ScanTo(CtCDPI_Cursor, CtCDPI_start)
     388
     389                ctCDPI_Callouts.CtCDPI_mask = pablo.Advance(ctCDPI_Callouts.CD_ends | ctCDPI_Callouts.Ct_ends | ctCDPI_Callouts.PI_ends) - CtCDPI_starts
    390390                #ctCDPI_Callouts.error = Ct_ends & ~lex.RAngle | Ct_starts & ~ lex.Hyphen
    391391                ctCDPI_error = Ct_errors | ctCDPI_Callouts.Ct_ends & ~lex.RAngle
    392                 ctCDPI_error |= bitutil.Advance(ctCDPI_Callouts.PI_name_ends & ~ lex.WS) & ~ PI_end
     392                ctCDPI_error |= pablo.Advance(ctCDPI_Callouts.PI_name_ends & ~ lex.WS) & ~ PI_end
    393393                ctCDPI_error |= ctCDPI_Callouts.PI_name_starts & ctCDPI_Callouts.PI_name_ends
    394394                # If any of the Comment, CDATA or PI markups are unterminated, it is an error.
     
    398398                error_tracker.NoteError("Error in comment, CDATA or processing instruction syntax", ctCDPI_error)
    399399
    400         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
     400        check_streams.misc_mask = (lex.WS | lex.LAngle | (pablo.Advance(ctCDPI_Callouts.Ct_ends | ctCDPI_Callouts.PI_ends) - (ctCDPI_Callouts.Ct_starts | ctCDPI_Callouts.PI_starts)) | CtCDPI_starts) & EOF_mask
    401401
    402402def Parse_tags(lex, scope1, ctCDPI_Callouts, tag_Callouts):
     
    417417
    418418        # Advance all cursors by scanning through the tag name.
    419         tag_Callouts.ElemName_ends = bitutil.ScanThru(tag_Callouts.ElemName_starts, lex.NameScan)
     419        tag_Callouts.ElemName_ends = pablo.ScanThru(tag_Callouts.ElemName_starts, lex.NameScan)
    420420        # Must have at least one name character for a legal start tag.
    421421        # Mark any occurrences of null names as errors.
     
    431431
    432432        # After the element name, there may or may not be an attlist.
    433         AfterWS = bitutil.ScanThru(tag_Callouts.ElemName_ends, lex.WS)
     433        AfterWS = pablo.ScanThru(tag_Callouts.ElemName_ends, lex.WS)
    434434        AttListEnd = AfterWS & AttListDelim
    435435        AttNameStart = AfterWS & ~AttListDelim
     
    444444        while AttNameStart:
    445445                tag_Callouts.AttName_starts |= AttNameStart
    446                 AttNameFollow = bitutil.ScanThru(AttNameStart, lex.NameScan)
     446                AttNameFollow = pablo.ScanThru(AttNameStart, lex.NameScan)
    447447                tag_Callouts.AttName_ends |= AttNameFollow
    448448                # Scan through WS to the expected '=' delimiter.
    449                 # EqExpected = bitutil.ScanThru(AttNameFollow, lex.WS)
     449                # EqExpected = pablo.ScanThru(AttNameFollow, lex.WS)
    450450                # But use if test to optimize.
    451451                if AttNameFollow & lex.WS:
    452                         EqExpected = bitutil.ScanThru(AttNameFollow, lex.WS)
     452                        EqExpected = pablo.ScanThru(AttNameFollow, lex.WS)
    453453                else: EqExpected = AttNameFollow
    454454                EqToCheck |= EqExpected
    455                 AttValPos = bitutil.ScanThru(EqExpected, EqExpected | lex.WS)
     455                AttValPos = pablo.ScanThru(EqExpected, EqExpected | lex.WS)
    456456                tag_Callouts.AttVal_starts |= AttValPos
    457457                DQuoteAttVal = AttValPos & lex.DQuote
    458458                SQuoteAttVal = AttValPos & lex.SQuote
    459                 DQuoteAttEnd = bitutil.ScanTo(DQuoteAttVal, DQuoteDelim &~ DQuoteAttVal)
    460                 SQuoteAttEnd = bitutil.ScanTo(SQuoteAttVal, SQuoteDelim &~ SQuoteAttVal)
     459                DQuoteAttEnd = pablo.ScanTo(DQuoteAttVal, DQuoteDelim &~ DQuoteAttVal)
     460                SQuoteAttEnd = pablo.ScanTo(SQuoteAttVal, SQuoteDelim &~ SQuoteAttVal)
    461461                AttValEnd = DQuoteAttEnd | SQuoteAttEnd
    462462                AttValEnds |= AttValEnd
    463                 AttValFollow = bitutil.Advance(AttValEnd)
     463                AttValFollow = pablo.Advance(AttValEnd)
    464464                tag_Callouts.AttVal_ends |= AttValFollow
    465                 #  AfterWS = bitutil.ScanThru(AttValFollow, lex.WS)
     465                #  AfterWS = pablo.ScanThru(AttValFollow, lex.WS)
    466466                if AttValFollow & lex.WS:
    467                         AfterWS = bitutil.ScanThru(AttValFollow, lex.WS)
     467                        AfterWS = pablo.ScanThru(AttValFollow, lex.WS)
    468468                else: AfterWS = AttValFollow
    469                 AfterWS = bitutil.ScanThru(AttValFollow, lex.WS)
     469                AfterWS = pablo.ScanThru(AttValFollow, lex.WS)
    470470                AttListEnd |= AfterWS & AttListDelim
    471471                AttNameStart = AfterWS & ~AttListDelim
     
    474474        STagEnds = AttListEnd & lex.RAngle
    475475        # Mark any "/" characters found as the ends of empty element tags.
    476         tag_Callouts.EmptyTag_marks = bitutil.Advance(AttListEnd & lex.Slash)
     476        tag_Callouts.EmptyTag_marks = pablo.Advance(AttListEnd & lex.Slash)
    477477
    478478        # Check for errors.
     
    486486        # End Tag Parsing
    487487
    488         EndTagEnds = bitutil.ScanThru(tag_Callouts.EndTag_marks, tag_Callouts.EndTag_marks | lex.NameScan)
     488        EndTagEnds = pablo.ScanThru(tag_Callouts.EndTag_marks, tag_Callouts.EndTag_marks | lex.NameScan)
    489489        if EndTagEnds & lex.WS:
    490                 EndTagEnds = bitutil.ScanThru(EndTagEnds, lex.WS)
     490                EndTagEnds = pablo.ScanThru(EndTagEnds, lex.WS)
    491491        ParseError |= EndTagEnds & ~lex.RAngle
    492492        if ParseError:
     
    509509        # All remaining "&" must be reference start characters; parse them.
    510510        if Ref1:
    511                 scope1.RefStart = bitutil.Advance(Ref1)
     511                scope1.RefStart = pablo.Advance(Ref1)
    512512                NumRef2 = scope1.RefStart & lex.Hash
    513513                ref_Callouts.GenRef_starts = scope1.RefStart &~ lex.Hash
    514                 NumRef3 = bitutil.Advance(NumRef2)
     514                NumRef3 = pablo.Advance(NumRef2)
    515515                HexRef3 = NumRef3 & lex.x
    516516                ref_Callouts.DecRef_starts = NumRef3 &~ lex.x
    517                 ref_Callouts.HexRef_starts = bitutil.Advance(HexRef3)
    518                 ref_Callouts.GenRef_ends = bitutil.ScanThru(ref_Callouts.GenRef_starts, lex.NameScan)
    519                 ref_Callouts.DecRef_ends = bitutil.ScanThru(ref_Callouts.DecRef_starts, lex.Digit)
    520                 ref_Callouts.HexRef_ends = bitutil.ScanThru(ref_Callouts.HexRef_starts, lex.Hex)
     517                ref_Callouts.HexRef_starts = pablo.Advance(HexRef3)
     518                ref_Callouts.GenRef_ends = pablo.ScanThru(ref_Callouts.GenRef_starts, lex.NameScan)
     519                ref_Callouts.DecRef_ends = pablo.ScanThru(ref_Callouts.DecRef_starts, lex.Digit)
     520                ref_Callouts.HexRef_ends = pablo.ScanThru(ref_Callouts.HexRef_starts, lex.Hex)
    521521                # Error checks
    522522                # At least one digit required for DecRef, one hex digit for HexRef.
     
    540540        ncname_stream = PI_names | GenRefs
    541541        name_stream = qname_stream | ncname_stream
    542         name_start = name_stream &~ bitutil.Advance(name_stream)
    543         name_cursor = name_stream & ~bitutil.Advance(name_stream)
     542        name_start = name_stream &~ pablo.Advance(name_stream)
     543        name_cursor = name_stream & ~pablo.Advance(name_stream)
    544544        void_prefix_err = name_cursor & lex.Colon
    545         namespace_sep = bitutil.ScanThru(name_cursor, lex.NameScan &~ lex.Colon) & lex.Colon
    546         local_part_start = bitutil.Advance(namespace_sep)
     545        namespace_sep = pablo.ScanThru(name_cursor, lex.NameScan &~ lex.Colon) & lex.Colon
     546        local_part_start = pablo.Advance(namespace_sep)
    547547        local_part_err = local_part_start &~ lex.NameScan
    548         colon2_err = bitutil.ScanThru(local_part_start, lex.NameScan &~ lex.Colon) & lex.Colon
     548        colon2_err = pablo.ScanThru(local_part_start, lex.NameScan &~ lex.Colon) & lex.Colon
    549549        ncname_err = ncname_stream & lex.Colon
    550550        namespace_error = void_prefix_err | local_part_err | colon2_err | ncname_err
     
    574574    remaining_ends = tag_Callouts.ElemName_ends
    575575    temp = tag_Callouts.ElemName_starts
    576     temp32 = bitutil.Advance32(temp)
     576    temp32 = pablo.Advance32(temp)
    577577
    578578    # Group symbols of length 1
     
    638638
    639639    # Group symbols of length 16
    640     temp = bitutil.Advance(temp15)
     640    temp = pablo.Advance(temp15)
    641641    tag_Callouts.ElemName_ends_16 = temp & remaining_ends
    642642    remaining_ends = remaining_ends & ~tag_Callouts.ElemName_ends_16
Note: See TracChangeset for help on using the changeset viewer.