Ignore:
Timestamp:
Sep 14, 2011, 5:43:40 PM (8 years ago)
Author:
vla24
Message:

SymbolTable?: Fixed integration with IDISA, it does not work well for pbgs_log and pbgs_id_adv. Changed bitutil.* to pablo.* for compiler generated files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/SymbolTable/parabix2_symtab_pbs_div.py

    r1387 r1442  
    1414
    1515#import bitutil
     16
     17class Basis_bits():
     18        bit_0 = 0
     19        bit_1 = 0
     20        bit_2 = 0
     21        bit_3 = 0
     22        bit_4 = 0
     23        bit_5 = 0
     24        bit_6 = 0
     25        bit_7 = 0
     26
    1627
    1728class u8 ():
     
    7586        WS = 0
    7687
    77 class Scope1 ():
    78         RefStart = 0
    79         LAngle = 0
    80         Hyphen = 0
    81         QMark = 0
    82         RBracket = 0
     88class Marker ():
     89        LAngle_scope = 0
     90        Ref_opener = 0
     91        CD_closer = 0
    8392
    8493class CtCDPI_Callouts():
    85         CD_end = 0
    8694        Ct_starts = 0
    8795        Ct_ends = 0
     
    92100        PI_name_ends = 0
    93101        PI_ends = 0
    94         CtCDPI_mask = 0
    95102
    96103class Ref_Callouts():
     
    125132        EndTag_marks = 0
    126133
    127 class Basis_bits():
    128         bit_0 = 0
    129         bit_1 = 0
    130         bit_2 = 0
    131         bit_3 = 0
    132         bit_4 = 0
    133         bit_5 = 0
    134         bit_6 = 0
    135         bit_7 = 0
    136 
    137134class Check_streams():
    138135        misc_mask = 0
     
    142139        name_follows = 0
    143140        att_refs = 0
    144 
    145 class Xml_names():
    146         namespace_error = 0
    147141
    148142def Classify_bytes_Validate_utf8(basis_bits, lex, u8):
     
    240234        lex.Hex = (temp62 | temp65);
    241235        lex_error = x00_x1F &~ lex.WS
    242         if lex_error & EOF_mask:
     236        if pablo.inFile(lex_error):
    243237                error_tracker.NoteError("Error: illegal character", lex_error)
    244238
     
    264258                u8.badprefix = (temp68 | temp71);
    265259                u8_error = u8.badprefix
    266                 u8.scope22 = bitutil.Advance(u8.prefix2)
     260                u8.scope22 = pablo.Advance(u8.prefix2)
    267261                u8anyscope = u8.scope22
    268262                if u8.prefix3 | u8.prefix4:
     
    280274                        u8.xBF = (temp73 & temp23);
    281275                        u8.xBE = (temp73 & temp15);
    282                         u8.xE0_scope = bitutil.Advance(xE0);
    283                         u8.xED_scope = bitutil.Advance(xED);
    284                         u8.xF0_scope = bitutil.Advance(xF0);
    285                         u8.xF4_scope = bitutil.Advance(xF4);
    286                         u8.xEF_scope = bitutil.Advance(xEF);
    287                         u8.scope32 = bitutil.Advance(u8.prefix3)
    288                         u8.scope33 = bitutil.Advance(u8.scope32)
    289                         u8.scope42 = bitutil.Advance(u8.prefix4)
    290                         u8.scope43 = bitutil.Advance(u8.scope42)
    291                         u8.scope44 = bitutil.Advance(u8.scope43)
     276#
     277#
     278#                       scope3_32 = pablo.Advance32(u8.prefix3)
     279#                       scope4_32 = pablo.Advance32(u8.prefix4)
     280#                       u8.scope32 = interpose32(u8.prefix3, scope3_32, 1)
     281#                       u8.scope33 = interpose32(u8.prefix3, scope3_32, 2)
     282#                       u8.scope42 = interpose32(u8.prefix4, scope4_32, 1)
     283#                       u8.scope43 = interpose32(u8.prefix4, scope4_32, 2)
     284#                       u8.scope44 = interpose32(u8.prefix4, scope4_32, 3)
     285#
     286                        u8.scope32 = pablo.Advance(u8.prefix3)
     287                        u8.scope33 = pablo.Advance(u8.scope32)
     288                        u8.scope42 = pablo.Advance(u8.prefix4)
     289                        u8.scope43 = pablo.Advance(u8.scope42)
     290                        u8.scope44 = pablo.Advance(u8.scope43)
     291#
     292#                       u8.xE0_scope = pablo.Advance(xE0);
     293#                       u8.xED_scope = pablo.Advance(xED);
     294#                       u8.xF0_scope = pablo.Advance(xF0);
     295#                       u8.xF4_scope = pablo.Advance(xF4);
     296                        E0_F0_scope = pablo.Advance(xE0 | xF0)
     297                        ED_F4_scope = pablo.Advance(xED | xF4)
     298                        u8.xE0_scope = u8.scope32 & E0_F0_scope
     299                        u8.xED_scope = u8.scope32 & ED_F4_scope
     300                        u8.xF0_scope = u8.scope42 & E0_F0_scope
     301                        u8.xF4_scope = u8.scope42 & ED_F4_scope
     302                        u8.xEF_scope = pablo.Advance(xEF);
    292303
    293304                        u8lastscope = u8.scope22 | u8.scope33 | u8.scope44
     
    301312                        u8_error |= u8error1 | u8error2 | u8error3 | u8error4
    302313
    303                         EF_BF_pending = bitutil.Advance(u8.xEF_scope & u8.xBF)
     314                        EF_BF_pending = pablo.Advance(u8.xEF_scope & u8.xBF)
    304315
    305316                        u8_FFFE_FFFF = (EF_BF_pending & (u8.xBE | u8.xBF))
     
    310321
    311322
    312 def Add_scope_streams(lex, scope1):
    313         #scope1.LAngle = bitutil.Advance(lex.LAngle)
    314         #scope1.Hyphen = bitutil.Advance(lex.Hyphen)
    315         #scope1.QMark = bitutil.Advance(lex.QMark)
    316         v = lex.LAngle | lex.Hyphen
    317         w = lex.Hyphen | lex.QMark
    318         v1 = bitutil.Advance(v)
    319         w1 = bitutil.Advance(w)
    320         scope1.LAngle = v1 &~ w1
    321         scope1.Hyphen = v1 & w1
    322         scope1.QMark = w1 &~ v1
    323         scope1.RefStart = 0 # default
    324 
    325 def Parse_CtCDPI(ctCDPI_Callouts, lex, scope1, check_streams):
    326         ctCDPI_Callouts.CD_end = 0
     323def Parse_CtCDPI(lex, marker, ctCDPI_Callouts, check_streams):
    327324        ctCDPI_Callouts.Ct_starts = 0
    328325        ctCDPI_Callouts.Ct_ends = 0
     
    333330        ctCDPI_Callouts.PI_name_ends = 0
    334331        ctCDPI_Callouts.PI_ends = 0
    335         ctCDPI_Callouts.CtCDPI_mask = 0
    336         ctCDPI_error = 0
    337332        CtCDPI_starts = 0
    338         Ct_errors = 0
    339 
     333        CtCDPI_ends = 0
     334        ctCDPI_mask = 0
     335
     336        v = lex.LAngle | lex.Hyphen
     337        w = lex.Hyphen | lex.QMark
     338        v1 = pablo.Advance(v)
     339        w1 = pablo.Advance(w)
     340
     341        LAngle_scope = v1 &~ w1  #pablo.Advance(lex.LAngle)
     342        PI_opener = LAngle_scope & lex.QMark
     343        CtCD_opener= LAngle_scope & lex.Exclam
     344        CtCDPI_opener = PI_opener | CtCD_opener
     345
     346        #DoubleHyphen = 0
     347        CD_closer = 0
     348        #PI_closer = 0
     349
     350        #if lex.Hyphen: DoubleHyphen = pablo.Advance(lex.Hyphen) & lex.Hyphen
     351        DoubleHyphen = v1 & w1 & lex.Hyphen
    340352        if lex.RBracket:
    341                 scope1.RBracket = bitutil.Advance(lex.RBracket)
    342                 ctCDPI_Callouts.CD_end = bitutil.Advance(scope1.RBracket & lex.RBracket) & lex.RAngle
    343         PI_start = scope1.LAngle & lex.QMark
    344         CtCD_start = scope1.LAngle & lex.Exclam
    345         CtCDPI_start = PI_start | CtCD_start
    346 
    347         DoubleHyphen = scope1.Hyphen & lex.Hyphen
    348         PI_end = scope1.QMark & lex.RAngle
    349 
     353                DoubleRBracket = pablo.Advance(lex.RBracket) & lex.RBracket
     354                CD_closer = pablo.Advance(DoubleRBracket) & lex.RAngle
     355        #if lex.QMark: PI_closer = pablo.Advance(lex.QMark) & lex.RAngle
     356        PI_closer = w1 & ~v1 & lex.RAngle
    350357
    351358        #
    352359        # Initiate the scan
    353         CtCDPI_Cursor = bitutil.ScanToFirst(CtCDPI_start)
     360        CtCDPI_Cursor = pablo.ScanToFirst(CtCDPI_opener)
    354361        while CtCDPI_Cursor:
    355362                CtCDPI_starts |= CtCDPI_Cursor
    356                 PI_Cursor = CtCDPI_Cursor & PI_start
    357                 CD_Ct_Cursor = bitutil.Advance(CtCDPI_Cursor & ~PI_Cursor)
     363                PI_Cursor = CtCDPI_Cursor & PI_opener
     364                CD_Ct_Cursor = pablo.Advance(CtCDPI_Cursor & ~PI_Cursor)
    358365                CD_Cursor = CD_Ct_Cursor & lex.LBracket
    359366                Ct_Cursor = CD_Ct_Cursor & lex.Hyphen
    360                 ctCDPI_Callouts.PI_starts |= PI_Cursor
    361                 ctCDPI_Callouts.CD_starts |= CD_Cursor
    362                 ctCDPI_Callouts.Ct_starts |= Ct_Cursor
    363                 Ct_Cursor = bitutil.Advance(Ct_Cursor)
    364                 Ct_errors |= Ct_Cursor & ~ lex.Hyphen
    365                 # Advance twice past <!--, so that we don't treat <!---
    366                 # as being a terminated comment.
    367                 Ct_Cursor = bitutil.Advance(bitutil.Advance(Ct_Cursor))
    368                 PI_Cursor = bitutil.Advance(PI_Cursor)
    369                 ctCDPI_Callouts.PI_name_starts |= PI_Cursor
    370                 PI_name_end = bitutil.ScanThru(PI_Cursor, lex.NameScan)
    371                 ctCDPI_Callouts.PI_name_ends |= PI_name_end
    372                 PI_Cursor = bitutil.ScanTo(PI_name_end, PI_end)
    373                 CD_Cursor = bitutil.ScanTo(CD_Cursor, ctCDPI_Callouts.CD_end)
    374                 Ct_Cursor = bitutil.Advance(bitutil.ScanTo(Ct_Cursor, DoubleHyphen))
    375                 ctCDPI_Callouts.PI_ends |= PI_Cursor
    376                 ctCDPI_Callouts.CD_ends |= CD_Cursor
    377                 ctCDPI_Callouts.Ct_ends |= Ct_Cursor
     367                # PI processing
     368                if PI_Cursor:
     369                        ctCDPI_Callouts.PI_starts |= PI_Cursor
     370                        PI_Cursor = pablo.Advance(PI_Cursor)
     371                        ctCDPI_Callouts.PI_name_starts |= PI_Cursor
     372                        PI_name_end = pablo.ScanThru(PI_Cursor, lex.NameScan)
     373                        PI_error = PI_Cursor & PI_name_end
     374                        PI_error |= pablo.Advance(PI_name_end & ~ lex.WS) & ~ PI_closer
     375                        if PI_error:
     376                                error_tracker.NoteError("Error in PI syntax", PI_name_end)
     377                        ctCDPI_Callouts.PI_name_ends |= PI_name_end
     378                        PI_Cursor = pablo.ScanTo(PI_name_end, PI_closer)
     379                        ctCDPI_Callouts.PI_ends |= PI_Cursor
     380                        CtCDPI_ends |= PI_Cursor
     381
     382                # CDATA section processing
     383                if CD_Cursor:
     384                        ctCDPI_Callouts.CD_starts |= CD_Cursor
     385                        CD_Cursor = pablo.ScanTo(CD_Cursor, CD_closer)
     386                        ctCDPI_Callouts.CD_ends |= CD_Cursor
     387                        CtCDPI_ends |= CD_Cursor
     388
     389                # Comment processing
     390                if Ct_Cursor:
     391                        ctCDPI_Callouts.Ct_starts |= Ct_Cursor
     392                        Ct_Cursor = pablo.Advance(Ct_Cursor)
     393                        Ct_error = Ct_Cursor & ~ lex.Hyphen
     394                        # Advance twice past <!--, so that we don't treat <!---
     395                        # as being a terminated comment.
     396                        Ct_Cursor = pablo.Advance(pablo.Advance(Ct_Cursor))
     397                        Ct_Cursor = pablo.Advance(pablo.ScanTo(Ct_Cursor, DoubleHyphen))
     398                        Ct_error |= Ct_Cursor & ~ lex.RAngle
     399                        ctCDPI_Callouts.Ct_ends |= Ct_Cursor
     400                        CtCDPI_ends |= Ct_Cursor
     401                        if Ct_error:
     402                                error_tracker.NoteError("Error in comment syntax", Ct_error)
     403
     404                # Common processing
    378405                CtCDPI_Cursor = PI_Cursor | CD_Cursor | Ct_Cursor
    379                 CtCDPI_Cursor = bitutil.ScanTo(CtCDPI_Cursor, CtCDPI_start)
    380 
    381                 ctCDPI_Callouts.CtCDPI_mask = bitutil.Advance(ctCDPI_Callouts.CD_ends | ctCDPI_Callouts.Ct_ends | ctCDPI_Callouts.PI_ends) - CtCDPI_starts
    382                 #ctCDPI_Callouts.error = Ct_ends & ~lex.RAngle | Ct_starts & ~ lex.Hyphen
    383                 ctCDPI_error = Ct_errors | ctCDPI_Callouts.Ct_ends & ~lex.RAngle
    384                 ctCDPI_error |= bitutil.Advance(ctCDPI_Callouts.PI_name_ends & ~ lex.WS) & ~ PI_end
    385                 ctCDPI_error |= ctCDPI_Callouts.PI_name_starts & ctCDPI_Callouts.PI_name_ends
     406                CtCDPI_Cursor = pablo.ScanTo(CtCDPI_Cursor, CtCDPI_opener)
     407                ctCDPI_mask |= (CtCDPI_ends - CtCDPI_starts) | CtCDPI_ends
    386408                # If any of the Comment, CDATA or PI markups are unterminated, it is an error.
    387                 ctCDPI_error |= ctCDPI_Callouts.CtCDPI_mask &~ EOF_mask
    388 
    389         if ctCDPI_error:
    390                 error_tracker.NoteError("Error in comment, CDATA or processing instruction syntax", ctCDPI_error)
    391 
    392         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
    393 
    394 def Parse_tags(lex, scope1, ctCDPI_Callouts, tag_Callouts):
    395 
     409                ctCDPI_error = pablo.atEOF(ctCDPI_mask)
     410
     411                if ctCDPI_error:
     412                        error_tracker.NoteError("Error in comment, CDATA or processing instruction syntax", ctCDPI_error)
     413
     414        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
     415
     416
     417        # Identify the remaining significant markers for XML processing.
     418        marker.LAngle_scope = LAngle_scope &~ ctCDPI_mask
     419        marker.Ref_opener = lex.RefStart &~ ctCDPI_mask
     420        marker.CD_closer = CD_closer &~ ctCDPI_mask
     421
     422def Parse_tags(lex, marker, tag_Callouts):
    396423
    397424        # Delimiters for scans.
     
    402429        # Start the parallel parsing by inspecting the character
    403430        # after the opening "<" of a tag.
    404         LAngleFollow = scope1.LAngle &~ ctCDPI_Callouts.CtCDPI_mask
    405         tag_Callouts.ElemName_starts = LAngleFollow & ~lex.Slash
    406         tag_Callouts.EndTag_marks = LAngleFollow & lex.Slash
     431        tag_Callouts.ElemName_starts = marker.LAngle_scope & ~lex.Slash
     432        tag_Callouts.EndTag_marks = marker.LAngle_scope & lex.Slash
    407433
    408434        # Start Tag/Empty Element Tag Parsing
    409435
    410436        # Advance all cursors by scanning through the tag name.
    411         tag_Callouts.ElemName_ends = bitutil.ScanThru(tag_Callouts.ElemName_starts, lex.NameScan)
     437        tag_Callouts.ElemName_ends = pablo.ScanThru(tag_Callouts.ElemName_starts, lex.NameScan)
    412438        # Must have at least one name character for a legal start tag.
    413439        # Mark any occurrences of null names as errors.
     
    417443        tag_Callouts.AttName_starts = 0
    418444        tag_Callouts.AttName_ends = 0
    419         EqToCheck = 0
    420445        tag_Callouts.AttVal_starts = 0
    421         AttValEnds = 0
    422446        tag_Callouts.AttVal_ends = 0
    423447
    424448        # After the element name, there may or may not be an attlist.
    425         AfterWS = bitutil.ScanThru(tag_Callouts.ElemName_ends, lex.WS)
    426         AttListEnd = AfterWS & AttListDelim
    427         AttNameStart = AfterWS & ~AttListDelim
    428         # At least one WS character is required between ElemNames and AttNames.
    429         ParseError |= tag_Callouts.ElemName_ends & AttNameStart
    430 
    431         #
    432         # The following loop iterates through attributes within a start tag.
    433         # Because all start tags are processed in parallel, the number of
    434         # iterations is the maximum number of attributes found in any one
    435         # start tag, plus one.
    436         while AttNameStart:
    437                 tag_Callouts.AttName_starts |= AttNameStart
    438                 AttNameFollow = bitutil.ScanThru(AttNameStart, lex.NameScan)
    439                 tag_Callouts.AttName_ends |= AttNameFollow
    440                 # Scan through WS to the expected '=' delimiter.
    441                 # EqExpected = bitutil.ScanThru(AttNameFollow, lex.WS)
    442                 # But use if test to optimize.
    443                 if AttNameFollow & lex.WS:
    444                         EqExpected = bitutil.ScanThru(AttNameFollow, lex.WS)
    445                 else: EqExpected = AttNameFollow
    446                 EqToCheck |= EqExpected
    447                 AttValPos = bitutil.ScanThru(EqExpected, EqExpected | lex.WS)
    448                 tag_Callouts.AttVal_starts |= AttValPos
    449                 DQuoteAttVal = AttValPos & lex.DQuote
    450                 SQuoteAttVal = AttValPos & lex.SQuote
    451                 DQuoteAttEnd = bitutil.ScanTo(DQuoteAttVal, DQuoteDelim &~ DQuoteAttVal)
    452                 SQuoteAttEnd = bitutil.ScanTo(SQuoteAttVal, SQuoteDelim &~ SQuoteAttVal)
    453                 AttValEnd = DQuoteAttEnd | SQuoteAttEnd
    454                 AttValEnds |= AttValEnd
    455                 AttValFollow = bitutil.Advance(AttValEnd)
    456                 tag_Callouts.AttVal_ends |= AttValFollow
    457                 #  AfterWS = bitutil.ScanThru(AttValFollow, lex.WS)
    458                 if AttValFollow & lex.WS:
    459                         AfterWS = bitutil.ScanThru(AttValFollow, lex.WS)
    460                 else: AfterWS = AttValFollow
    461                 AfterWS = bitutil.ScanThru(AttValFollow, lex.WS)
    462                 AttListEnd |= AfterWS & AttListDelim
     449        if tag_Callouts.ElemName_ends & lex.WS:
     450                AfterWS = pablo.ScanThru(tag_Callouts.ElemName_ends, lex.WS)
     451                AttListEnd = AfterWS & AttListDelim
    463452                AttNameStart = AfterWS & ~AttListDelim
    464 
    465         # No more attribute values to process when AttNameStart == 0.
     453                #
     454                # The following loop iterates through attributes within a start tag.
     455                # Because all start tags are processed in parallel, the number of
     456                # iterations is the maximum number of attributes found in any one
     457                # start tag, plus one.
     458                while AttNameStart:
     459                        ParseError |= AttNameStart &~ lex.NameScan
     460                        tag_Callouts.AttName_starts |= AttNameStart
     461                        AttNameFollow = pablo.ScanThru(AttNameStart, lex.NameScan)
     462                        tag_Callouts.AttName_ends |= AttNameFollow
     463                        # Scan through WS to the expected '=' delimiter.
     464                        # EqExpected = pablo.ScanThru(AttNameFollow, lex.WS)
     465                        # But use if test to optimize.
     466                        if AttNameFollow & lex.WS:
     467                                EqExpected = pablo.ScanThru(AttNameFollow, lex.WS)
     468                        else: EqExpected = AttNameFollow
     469                        ParseError |= EqExpected &~ lex.Equals
     470                        AttValPos = pablo.ScanThru(EqExpected, EqExpected | lex.WS)
     471                        tag_Callouts.AttVal_starts |= AttValPos
     472                        DQuoteAttVal = AttValPos & lex.DQuote
     473                        SQuoteAttVal = AttValPos & lex.SQuote
     474                        DQuoteAttEnd = pablo.ScanTo(DQuoteAttVal, DQuoteDelim &~ DQuoteAttVal)
     475                        SQuoteAttEnd = pablo.ScanTo(SQuoteAttVal, SQuoteDelim &~ SQuoteAttVal)
     476                        AttValEnd = DQuoteAttEnd | SQuoteAttEnd
     477                        ParseError |= (AttValPos | AttValEnd) &~ (lex.DQuote | lex.SQuote)
     478                        AttValFollow = pablo.Advance(AttValEnd)
     479                        tag_Callouts.AttVal_ends |= AttValFollow
     480                        #  AfterWS = pablo.ScanThru(AttValFollow, lex.WS)
     481                        if AttValFollow & lex.WS:
     482                                AfterWS = pablo.ScanThru(AttValFollow, lex.WS)
     483                                AttListEnd |= AfterWS & AttListDelim
     484                                AttNameStart = AfterWS & ~AttListDelim
     485                        else:
     486                                AttListEnd |= AttValFollow & AttListDelim
     487                                AttNameStart = 0
     488                                ParseError |= AttValFollow & ~AttListDelim
     489        else:
     490                # No WS character after ElemName; must be at the end
     491                AttListEnd = tag_Callouts.ElemName_ends & AttListDelim
     492                ParseError |= tag_Callouts.ElemName_ends & ~AttListDelim
     493
    466494        STagEnds = AttListEnd & lex.RAngle
    467495        # Mark any "/" characters found as the ends of empty element tags.
    468         tag_Callouts.EmptyTag_marks = bitutil.Advance(AttListEnd & lex.Slash)
    469 
    470         # Check for errors.
    471         ParseError |= tag_Callouts.AttVal_ends & tag_Callouts.AttName_starts # No intervening WS.
    472         ParseError |= tag_Callouts.AttName_starts & tag_Callouts.AttName_ends # Null AttName
    473         ParseError |= EqToCheck & ~lex.Equals # = not found where expected.
    474         ParseError |= tag_Callouts.AttVal_starts & ~ (lex.DQuote | lex.SQuote)
    475         ParseError |= AttValEnds & ~ (lex.DQuote | lex.SQuote)
     496        tag_Callouts.EmptyTag_marks = pablo.Advance(AttListEnd & lex.Slash)
     497
    476498        ParseError |= tag_Callouts.EmptyTag_marks & ~lex.RAngle
    477499
    478500        # End Tag Parsing
    479501
    480         EndTagEnds = bitutil.ScanThru(tag_Callouts.EndTag_marks, tag_Callouts.EndTag_marks | lex.NameScan)
     502        EndTagEnds = pablo.ScanThru(tag_Callouts.EndTag_marks, tag_Callouts.EndTag_marks | lex.NameScan)
    481503        if EndTagEnds & lex.WS:
    482                 EndTagEnds = bitutil.ScanThru(EndTagEnds, lex.WS)
     504                EndTagEnds = pablo.ScanThru(EndTagEnds, lex.WS)
    483505        ParseError |= EndTagEnds & ~lex.RAngle
    484506        if ParseError:
     
    489511        tag_Callouts.AttVal_spans = tag_Callouts.AttVal_ends - tag_Callouts.AttVal_starts
    490512
    491 def Parse_refs(lex, scope1, ctCDPI_Callouts, ref_Callouts):
     513def Parse_refs(lex, marker, ref_Callouts):
    492514        ref_Callouts.GenRef_starts = 0
    493515        ref_Callouts.GenRef_ends = 0
     
    498520        ref_error = 0
    499521
    500         Ref1 = lex.RefStart &~ ctCDPI_Callouts.CtCDPI_mask
    501522        # All remaining "&" must be reference start characters; parse them.
    502         if Ref1:
    503                 scope1.RefStart = bitutil.Advance(Ref1)
    504                 NumRef2 = scope1.RefStart & lex.Hash
    505                 ref_Callouts.GenRef_starts = scope1.RefStart &~ lex.Hash
    506                 NumRef3 = bitutil.Advance(NumRef2)
     523        if marker.Ref_opener:
     524                Ref_scope = pablo.Advance(marker.Ref_opener)
     525                NumRef2 = Ref_scope & lex.Hash
     526                ref_Callouts.GenRef_starts = Ref_scope &~ lex.Hash
     527                NumRef3 = pablo.Advance(NumRef2)
    507528                HexRef3 = NumRef3 & lex.x
    508529                ref_Callouts.DecRef_starts = NumRef3 &~ lex.x
    509                 ref_Callouts.HexRef_starts = bitutil.Advance(HexRef3)
    510                 ref_Callouts.GenRef_ends = bitutil.ScanThru(ref_Callouts.GenRef_starts, lex.NameScan)
    511                 ref_Callouts.DecRef_ends = bitutil.ScanThru(ref_Callouts.DecRef_starts, lex.Digit)
    512                 ref_Callouts.HexRef_ends = bitutil.ScanThru(ref_Callouts.HexRef_starts, lex.Hex)
     530                ref_Callouts.HexRef_starts = pablo.Advance(HexRef3)
     531                ref_Callouts.GenRef_ends = pablo.ScanThru(ref_Callouts.GenRef_starts, lex.NameScan)
     532                ref_Callouts.DecRef_ends = pablo.ScanThru(ref_Callouts.DecRef_starts, lex.Digit)
     533                ref_Callouts.HexRef_ends = pablo.ScanThru(ref_Callouts.HexRef_starts, lex.Hex)
    513534                # Error checks
    514535                # At least one digit required for DecRef, one hex digit for HexRef.
     
    524545
    525546
    526 def Validate_xml_names(ctCDPI_Callouts, ref_Callouts, tag_Callouts, lex, u8, xml_names, check_streams):
     547def Validate_xml_names(ctCDPI_Callouts, ref_Callouts, tag_Callouts, lex, u8, check_streams):
    527548        PI_names = ctCDPI_Callouts.PI_name_ends - ctCDPI_Callouts.PI_name_starts
    528549        GenRefs = ref_Callouts.GenRef_ends - ref_Callouts.GenRef_starts
     
    532553        ncname_stream = PI_names | GenRefs
    533554        name_stream = qname_stream | ncname_stream
    534         name_start = name_stream &~ bitutil.Advance(name_stream)
    535         name_cursor = name_stream & ~bitutil.Advance(name_stream)
     555        name_start = name_stream &~ pablo.Advance(name_stream)
     556        name_cursor = name_stream & ~pablo.Advance(name_stream)
    536557        void_prefix_err = name_cursor & lex.Colon
    537         namespace_sep = bitutil.ScanThru(name_cursor, lex.NameScan &~ lex.Colon) & lex.Colon
    538         local_part_start = bitutil.Advance(namespace_sep)
     558        namespace_sep = pablo.ScanThru(name_cursor, lex.NameScan &~ lex.Colon) & lex.Colon
     559        local_part_start = pablo.Advance(namespace_sep)
    539560        local_part_err = local_part_start &~ lex.NameScan
    540         colon2_err = bitutil.ScanThru(local_part_start, lex.NameScan &~ lex.Colon) & lex.Colon
     561        colon2_err = pablo.ScanThru(local_part_start, lex.NameScan &~ lex.Colon) & lex.Colon
    541562        ncname_err = ncname_stream & lex.Colon
    542563        namespace_error = void_prefix_err | local_part_err | colon2_err | ncname_err
     
    548569        check_streams.non_ascii_names = (name_stream &~ name_start) & ~lex.ASCII_name_char & ~u8.suffix
    549570
    550 def Do_check_streams(ctCDPI_Callouts, tag_Callouts, lex, u8, scope1, ref_Callouts, xml_names, check_streams):
    551     # Ensure that no occurrence of ]]> occurs outside of markup.
    552     CD_end_error = ctCDPI_Callouts.CD_end & ~(ctCDPI_Callouts.CtCDPI_mask | tag_Callouts.AttVal_spans)
    553 
    554     # Consolidate and check for errors
    555     if CD_end_error:
     571def Do_check_streams(marker, tag_Callouts, check_streams):
     572        CD_end_error = marker.CD_closer & ~tag_Callouts.AttVal_spans
     573        if CD_end_error:
    556574                error_tracker.NoteError("Error: ]]> in text", CD_end_error)
    557 
    558 
    559     check_streams.tag_marks = tag_Callouts.EmptyTag_marks | tag_Callouts.ElemName_starts | tag_Callouts.EndTag_marks | 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
     575        check_streams.tag_marks = tag_Callouts.EmptyTag_marks | tag_Callouts.ElemName_starts | tag_Callouts.EndTag_marks | tag_Callouts.AttName_starts
     576        check_streams.name_follows = tag_Callouts.ElemName_ends | tag_Callouts.AttName_ends
     577        check_streams.att_refs = tag_Callouts.AttVal_spans & marker.Ref_opener
    562578
    563579def Form_Length_Group_Bitstreams(tag_Callouts):
     
    566582    ends = tag_Callouts.ElemName_ends
    567583
    568     temp = ends | bitutil.Advance(ends)
     584    temp = ends | pablo.Advance(ends)
    569585
    570586    # Group symbols of length 1 and 2
    571     start_2 = bitutil.Advance(bitutil.Advance(starts))
     587    start_2 = pablo.Advance(pablo.Advance(starts))
    572588    tag_Callouts.ElemName_ends_1_to_2 =  start_2 & temp
    573589
    574590    # Group symbols of length 3 and 4
    575     start_4 = bitutil.Advance(bitutil.Advance(start_2 & ~temp))
     591    start_4 = pablo.Advance(pablo.Advance(start_2 & ~temp))
    576592    tag_Callouts.ElemName_ends_3_to_4 =  start_4 & temp
    577593
    578594    # Group symbols of length 5 and 6
    579     start_6 = bitutil.Advance(bitutil.Advance(start_4 & ~temp))
     595    start_6 = pablo.Advance(pablo.Advance(start_4 & ~temp))
    580596    tag_Callouts.ElemName_ends_5_to_6 =  start_6 & temp
    581597
    582598    # Group symbols of length 7 and 8
    583     start_8 = bitutil.Advance(bitutil.Advance(start_6 & ~temp))
     599    start_8 = pablo.Advance(pablo.Advance(start_6 & ~temp))
    584600    tag_Callouts.ElemName_ends_7_to_8 =  start_8 & temp
    585601
    586602    # Group symbols of length 9 and 10
    587     start_10 = bitutil.Advance(bitutil.Advance(start_8 & ~temp))
     603    start_10 = pablo.Advance(pablo.Advance(start_8 & ~temp))
    588604    tag_Callouts.ElemName_ends_9_to_10 =  start_10 & temp
    589605
    590606    # Group symbols of length 11 and 12
    591     start_12 = bitutil.Advance(bitutil.Advance(start_10 & ~temp))
     607    start_12 = pablo.Advance(pablo.Advance(start_10 & ~temp))
    592608    tag_Callouts.ElemName_ends_11_to_12 =  start_12 & temp
    593609
    594610    # Group symbols of length 13 and 14
    595     start_14 = bitutil.Advance(bitutil.Advance(start_12 & ~temp))
     611    start_14 = pablo.Advance(pablo.Advance(start_12 & ~temp))
    596612    tag_Callouts.ElemName_ends_13_to_14 =  start_14 & temp
    597613
    598614    # Group symbols of length 15 and 16
    599     start_16 = bitutil.Advance(bitutil.Advance(start_14 & ~temp))
     615    start_16 = pablo.Advance(pablo.Advance(start_14 & ~temp))
    600616    tag_Callouts.ElemName_ends_15_to_16 =  start_16 & temp
    601617
     
    619635        Classify_bytes_Validate_utf8(basis_bits, lex, u8)
    620636
    621         Add_scope_streams(lex, scope1)
    622 
    623637        # Parse all comments, CDATA sections and processing instructions.
    624         Parse_CtCDPI(ctCDPI_Callouts, lex, scope1, check_streams)
     638        Parse_CtCDPI(lex, marker, ctCDPI_Callouts, check_streams)
    625639
    626640        # All remaining '<' must be tag start characters; parse tags.
    627         Parse_tags(lex, scope1, ctCDPI_Callouts, tag_Callouts)
     641        Parse_tags(lex, marker, tag_Callouts)
    628642
    629643        # All remaining '&' must be reference start characters; parse them.
    630         Parse_refs(lex, scope1, ctCDPI_Callouts, ref_Callouts)
     644        Parse_refs(lex, marker, ref_Callouts)
    631645
    632646        # Validate XML namespaces and generate bit streams to post validate non-ascii range XML names
    633         Validate_xml_names(ctCDPI_Callouts, ref_Callouts, tag_Callouts, lex, u8, xml_names, check_streams)
    634 
    635 
    636         Do_check_streams(ctCDPI_Callouts, tag_Callouts, lex, u8, scope1, ref_Callouts, xml_names, check_streams)
     647        Validate_xml_names(ctCDPI_Callouts, ref_Callouts, tag_Callouts, lex, u8, check_streams)
     648
     649        Do_check_streams(marker, tag_Callouts, check_streams)
    637650
    638651        # These methods are needed to do Paralel Bitstream Based Length Sorting
Note: See TracChangeset for help on using the changeset viewer.