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 moved

Legend:

Unmodified
Added
Removed
  • proto/SymbolTable/parabix2_symtab_id.py

    r1441 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():
     
    116123        EndTag_marks = 0
    117124
    118 class Basis_bits():
    119         bit_0 = 0
    120         bit_1 = 0
    121         bit_2 = 0
    122         bit_3 = 0
    123         bit_4 = 0
    124         bit_5 = 0
    125         bit_6 = 0
    126         bit_7 = 0
    127 
    128125class Check_streams():
    129126        misc_mask = 0
     
    133130        name_follows = 0
    134131        att_refs = 0
    135 
    136 class Xml_names():
    137         namespace_error = 0
    138132
    139133def Classify_bytes_Validate_utf8(basis_bits, lex, u8):
     
    231225        lex.Hex = (temp62 | temp65);
    232226        lex_error = x00_x1F &~ lex.WS
    233         if lex_error & EOF_mask:
     227        if pablo.inFile(lex_error):
    234228                error_tracker.NoteError("Error: illegal character", lex_error)
    235229
     
    255249                u8.badprefix = (temp68 | temp71);
    256250                u8_error = u8.badprefix
    257                 u8.scope22 = bitutil.Advance(u8.prefix2)
     251                u8.scope22 = pablo.Advance(u8.prefix2)
    258252                u8anyscope = u8.scope22
    259253                if u8.prefix3 | u8.prefix4:
     
    271265                        u8.xBF = (temp73 & temp23);
    272266                        u8.xBE = (temp73 & temp15);
    273                         u8.xE0_scope = bitutil.Advance(xE0);
    274                         u8.xED_scope = bitutil.Advance(xED);
    275                         u8.xF0_scope = bitutil.Advance(xF0);
    276                         u8.xF4_scope = bitutil.Advance(xF4);
    277                         u8.xEF_scope = bitutil.Advance(xEF);
    278                         u8.scope32 = bitutil.Advance(u8.prefix3)
    279                         u8.scope33 = bitutil.Advance(u8.scope32)
    280                         u8.scope42 = bitutil.Advance(u8.prefix4)
    281                         u8.scope43 = bitutil.Advance(u8.scope42)
    282                         u8.scope44 = bitutil.Advance(u8.scope43)
     267#
     268#
     269#                       scope3_32 = pablo.Advance32(u8.prefix3)
     270#                       scope4_32 = pablo.Advance32(u8.prefix4)
     271#                       u8.scope32 = interpose32(u8.prefix3, scope3_32, 1)
     272#                       u8.scope33 = interpose32(u8.prefix3, scope3_32, 2)
     273#                       u8.scope42 = interpose32(u8.prefix4, scope4_32, 1)
     274#                       u8.scope43 = interpose32(u8.prefix4, scope4_32, 2)
     275#                       u8.scope44 = interpose32(u8.prefix4, scope4_32, 3)
     276#
     277                        u8.scope32 = pablo.Advance(u8.prefix3)
     278                        u8.scope33 = pablo.Advance(u8.scope32)
     279                        u8.scope42 = pablo.Advance(u8.prefix4)
     280                        u8.scope43 = pablo.Advance(u8.scope42)
     281                        u8.scope44 = pablo.Advance(u8.scope43)
     282#
     283#                       u8.xE0_scope = pablo.Advance(xE0);
     284#                       u8.xED_scope = pablo.Advance(xED);
     285#                       u8.xF0_scope = pablo.Advance(xF0);
     286#                       u8.xF4_scope = pablo.Advance(xF4);
     287                        E0_F0_scope = pablo.Advance(xE0 | xF0)
     288                        ED_F4_scope = pablo.Advance(xED | xF4)
     289                        u8.xE0_scope = u8.scope32 & E0_F0_scope
     290                        u8.xED_scope = u8.scope32 & ED_F4_scope
     291                        u8.xF0_scope = u8.scope42 & E0_F0_scope
     292                        u8.xF4_scope = u8.scope42 & ED_F4_scope
     293                        u8.xEF_scope = pablo.Advance(xEF);
    283294
    284295                        u8lastscope = u8.scope22 | u8.scope33 | u8.scope44
     
    292303                        u8_error |= u8error1 | u8error2 | u8error3 | u8error4
    293304
    294                         EF_BF_pending = bitutil.Advance(u8.xEF_scope & u8.xBF)
     305                        EF_BF_pending = pablo.Advance(u8.xEF_scope & u8.xBF)
    295306
    296307                        u8_FFFE_FFFF = (EF_BF_pending & (u8.xBE | u8.xBF))
     
    301312
    302313
    303 def Add_scope_streams(lex, scope1):
    304         #scope1.LAngle = bitutil.Advance(lex.LAngle)
    305         #scope1.Hyphen = bitutil.Advance(lex.Hyphen)
    306         #scope1.QMark = bitutil.Advance(lex.QMark)
    307         v = lex.LAngle | lex.Hyphen
    308         w = lex.Hyphen | lex.QMark
    309         v1 = bitutil.Advance(v)
    310         w1 = bitutil.Advance(w)
    311         scope1.LAngle = v1 &~ w1
    312         scope1.Hyphen = v1 & w1
    313         scope1.QMark = w1 &~ v1
    314         scope1.RefStart = 0 # default
    315 
    316 def Parse_CtCDPI(ctCDPI_Callouts, lex, scope1, check_streams):
    317         ctCDPI_Callouts.CD_end = 0
     314def Parse_CtCDPI(lex, marker, ctCDPI_Callouts, check_streams):
    318315        ctCDPI_Callouts.Ct_starts = 0
    319316        ctCDPI_Callouts.Ct_ends = 0
     
    324321        ctCDPI_Callouts.PI_name_ends = 0
    325322        ctCDPI_Callouts.PI_ends = 0
    326         ctCDPI_Callouts.CtCDPI_mask = 0
    327         ctCDPI_error = 0
    328323        CtCDPI_starts = 0
    329         Ct_errors = 0
    330 
     324        CtCDPI_ends = 0
     325        ctCDPI_mask = 0
     326
     327        v = lex.LAngle | lex.Hyphen
     328        w = lex.Hyphen | lex.QMark
     329        v1 = pablo.Advance(v)
     330        w1 = pablo.Advance(w)
     331
     332        LAngle_scope = v1 &~ w1  #pablo.Advance(lex.LAngle)
     333        PI_opener = LAngle_scope & lex.QMark
     334        CtCD_opener= LAngle_scope & lex.Exclam
     335        CtCDPI_opener = PI_opener | CtCD_opener
     336
     337        #DoubleHyphen = 0
     338        CD_closer = 0
     339        #PI_closer = 0
     340
     341        #if lex.Hyphen: DoubleHyphen = pablo.Advance(lex.Hyphen) & lex.Hyphen
     342        DoubleHyphen = v1 & w1 & lex.Hyphen
    331343        if lex.RBracket:
    332                 scope1.RBracket = bitutil.Advance(lex.RBracket)
    333                 ctCDPI_Callouts.CD_end = bitutil.Advance(scope1.RBracket & lex.RBracket) & lex.RAngle
    334         PI_start = scope1.LAngle & lex.QMark
    335         CtCD_start = scope1.LAngle & lex.Exclam
    336         CtCDPI_start = PI_start | CtCD_start
    337 
    338         DoubleHyphen = scope1.Hyphen & lex.Hyphen
    339         PI_end = scope1.QMark & lex.RAngle
    340 
     344                DoubleRBracket = pablo.Advance(lex.RBracket) & lex.RBracket
     345                CD_closer = pablo.Advance(DoubleRBracket) & lex.RAngle
     346        #if lex.QMark: PI_closer = pablo.Advance(lex.QMark) & lex.RAngle
     347        PI_closer = w1 & ~v1 & lex.RAngle
    341348
    342349        #
    343350        # Initiate the scan
    344         CtCDPI_Cursor = bitutil.ScanToFirst(CtCDPI_start)
     351        CtCDPI_Cursor = pablo.ScanToFirst(CtCDPI_opener)
    345352        while CtCDPI_Cursor:
    346353                CtCDPI_starts |= CtCDPI_Cursor
    347                 PI_Cursor = CtCDPI_Cursor & PI_start
    348                 CD_Ct_Cursor = bitutil.Advance(CtCDPI_Cursor & ~PI_Cursor)
     354                PI_Cursor = CtCDPI_Cursor & PI_opener
     355                CD_Ct_Cursor = pablo.Advance(CtCDPI_Cursor & ~PI_Cursor)
    349356                CD_Cursor = CD_Ct_Cursor & lex.LBracket
    350357                Ct_Cursor = CD_Ct_Cursor & lex.Hyphen
    351                 ctCDPI_Callouts.PI_starts |= PI_Cursor
    352                 ctCDPI_Callouts.CD_starts |= CD_Cursor
    353                 ctCDPI_Callouts.Ct_starts |= Ct_Cursor
    354                 Ct_Cursor = bitutil.Advance(Ct_Cursor)
    355                 Ct_errors |= Ct_Cursor & ~ lex.Hyphen
    356                 # Advance twice past <!--, so that we don't treat <!---
    357                 # as being a terminated comment.
    358                 Ct_Cursor = bitutil.Advance(bitutil.Advance(Ct_Cursor))
    359                 PI_Cursor = bitutil.Advance(PI_Cursor)
    360                 ctCDPI_Callouts.PI_name_starts |= PI_Cursor
    361                 PI_name_end = bitutil.ScanThru(PI_Cursor, lex.NameScan)
    362                 ctCDPI_Callouts.PI_name_ends |= PI_name_end
    363                 PI_Cursor = bitutil.ScanTo(PI_name_end, PI_end)
    364                 CD_Cursor = bitutil.ScanTo(CD_Cursor, ctCDPI_Callouts.CD_end)
    365                 Ct_Cursor = bitutil.Advance(bitutil.ScanTo(Ct_Cursor, DoubleHyphen))
    366                 ctCDPI_Callouts.PI_ends |= PI_Cursor
    367                 ctCDPI_Callouts.CD_ends |= CD_Cursor
    368                 ctCDPI_Callouts.Ct_ends |= Ct_Cursor
     358                # PI processing
     359                if PI_Cursor:
     360                        ctCDPI_Callouts.PI_starts |= PI_Cursor
     361                        PI_Cursor = pablo.Advance(PI_Cursor)
     362                        ctCDPI_Callouts.PI_name_starts |= PI_Cursor
     363                        PI_name_end = pablo.ScanThru(PI_Cursor, lex.NameScan)
     364                        PI_error = PI_Cursor & PI_name_end
     365                        PI_error |= pablo.Advance(PI_name_end & ~ lex.WS) & ~ PI_closer
     366                        if PI_error:
     367                                error_tracker.NoteError("Error in PI syntax", PI_name_end)
     368                        ctCDPI_Callouts.PI_name_ends |= PI_name_end
     369                        PI_Cursor = pablo.ScanTo(PI_name_end, PI_closer)
     370                        ctCDPI_Callouts.PI_ends |= PI_Cursor
     371                        CtCDPI_ends |= PI_Cursor
     372
     373                # CDATA section processing
     374                if CD_Cursor:
     375                        ctCDPI_Callouts.CD_starts |= CD_Cursor
     376                        CD_Cursor = pablo.ScanTo(CD_Cursor, CD_closer)
     377                        ctCDPI_Callouts.CD_ends |= CD_Cursor
     378                        CtCDPI_ends |= CD_Cursor
     379
     380                # Comment processing
     381                if Ct_Cursor:
     382                        ctCDPI_Callouts.Ct_starts |= Ct_Cursor
     383                        Ct_Cursor = pablo.Advance(Ct_Cursor)
     384                        Ct_error = Ct_Cursor & ~ lex.Hyphen
     385                        # Advance twice past <!--, so that we don't treat <!---
     386                        # as being a terminated comment.
     387                        Ct_Cursor = pablo.Advance(pablo.Advance(Ct_Cursor))
     388                        Ct_Cursor = pablo.Advance(pablo.ScanTo(Ct_Cursor, DoubleHyphen))
     389                        Ct_error |= Ct_Cursor & ~ lex.RAngle
     390                        ctCDPI_Callouts.Ct_ends |= Ct_Cursor
     391                        CtCDPI_ends |= Ct_Cursor
     392                        if Ct_error:
     393                                error_tracker.NoteError("Error in comment syntax", Ct_error)
     394
     395                # Common processing
    369396                CtCDPI_Cursor = PI_Cursor | CD_Cursor | Ct_Cursor
    370                 CtCDPI_Cursor = bitutil.ScanTo(CtCDPI_Cursor, CtCDPI_start)
    371 
    372                 ctCDPI_Callouts.CtCDPI_mask = bitutil.Advance(ctCDPI_Callouts.CD_ends | ctCDPI_Callouts.Ct_ends | ctCDPI_Callouts.PI_ends) - CtCDPI_starts
    373                 #ctCDPI_Callouts.error = Ct_ends & ~lex.RAngle | Ct_starts & ~ lex.Hyphen
    374                 ctCDPI_error = Ct_errors | ctCDPI_Callouts.Ct_ends & ~lex.RAngle
    375                 ctCDPI_error |= bitutil.Advance(ctCDPI_Callouts.PI_name_ends & ~ lex.WS) & ~ PI_end
    376                 ctCDPI_error |= ctCDPI_Callouts.PI_name_starts & ctCDPI_Callouts.PI_name_ends
     397                CtCDPI_Cursor = pablo.ScanTo(CtCDPI_Cursor, CtCDPI_opener)
     398                ctCDPI_mask |= (CtCDPI_ends - CtCDPI_starts) | CtCDPI_ends
    377399                # If any of the Comment, CDATA or PI markups are unterminated, it is an error.
    378                 ctCDPI_error |= ctCDPI_Callouts.CtCDPI_mask &~ EOF_mask
    379 
    380         if ctCDPI_error:
    381                 error_tracker.NoteError("Error in comment, CDATA or processing instruction syntax", ctCDPI_error)
    382 
    383         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
    384 
    385 def Parse_tags(lex, scope1, ctCDPI_Callouts, tag_Callouts):
    386 
     400                ctCDPI_error = pablo.atEOF(ctCDPI_mask)
     401
     402                if ctCDPI_error:
     403                        error_tracker.NoteError("Error in comment, CDATA or processing instruction syntax", ctCDPI_error)
     404
     405        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
     406
     407
     408        # Identify the remaining significant markers for XML processing.
     409        marker.LAngle_scope = LAngle_scope &~ ctCDPI_mask
     410        marker.Ref_opener = lex.RefStart &~ ctCDPI_mask
     411        marker.CD_closer = CD_closer &~ ctCDPI_mask
     412
     413def Parse_tags(lex, marker, tag_Callouts):
    387414
    388415        # Delimiters for scans.
     
    393420        # Start the parallel parsing by inspecting the character
    394421        # after the opening "<" of a tag.
    395         LAngleFollow = scope1.LAngle &~ ctCDPI_Callouts.CtCDPI_mask
    396         tag_Callouts.ElemName_starts = LAngleFollow & ~lex.Slash
    397         tag_Callouts.EndTag_marks = LAngleFollow & lex.Slash
     422        tag_Callouts.ElemName_starts = marker.LAngle_scope & ~lex.Slash
     423        tag_Callouts.EndTag_marks = marker.LAngle_scope & lex.Slash
    398424
    399425        # Start Tag/Empty Element Tag Parsing
    400426
    401427        # Advance all cursors by scanning through the tag name.
    402         tag_Callouts.ElemName_ends = bitutil.ScanThru(tag_Callouts.ElemName_starts, lex.NameScan)
     428        tag_Callouts.ElemName_ends = pablo.ScanThru(tag_Callouts.ElemName_starts, lex.NameScan)
    403429        # Must have at least one name character for a legal start tag.
    404430        # Mark any occurrences of null names as errors.
     
    408434        tag_Callouts.AttName_starts = 0
    409435        tag_Callouts.AttName_ends = 0
    410         EqToCheck = 0
    411436        tag_Callouts.AttVal_starts = 0
    412         AttValEnds = 0
    413437        tag_Callouts.AttVal_ends = 0
    414438
    415439        # After the element name, there may or may not be an attlist.
    416         AfterWS = bitutil.ScanThru(tag_Callouts.ElemName_ends, lex.WS)
    417         AttListEnd = AfterWS & AttListDelim
    418         AttNameStart = AfterWS & ~AttListDelim
    419         # At least one WS character is required between ElemNames and AttNames.
    420         ParseError |= tag_Callouts.ElemName_ends & AttNameStart
    421 
    422         #
    423         # The following loop iterates through attributes within a start tag.
    424         # Because all start tags are processed in parallel, the number of
    425         # iterations is the maximum number of attributes found in any one
    426         # start tag, plus one.
    427         while AttNameStart:
    428                 tag_Callouts.AttName_starts |= AttNameStart
    429                 AttNameFollow = bitutil.ScanThru(AttNameStart, lex.NameScan)
    430                 tag_Callouts.AttName_ends |= AttNameFollow
    431                 # Scan through WS to the expected '=' delimiter.
    432                 # EqExpected = bitutil.ScanThru(AttNameFollow, lex.WS)
    433                 # But use if test to optimize.
    434                 if AttNameFollow & lex.WS:
    435                         EqExpected = bitutil.ScanThru(AttNameFollow, lex.WS)
    436                 else: EqExpected = AttNameFollow
    437                 EqToCheck |= EqExpected
    438                 AttValPos = bitutil.ScanThru(EqExpected, EqExpected | lex.WS)
    439                 tag_Callouts.AttVal_starts |= AttValPos
    440                 DQuoteAttVal = AttValPos & lex.DQuote
    441                 SQuoteAttVal = AttValPos & lex.SQuote
    442                 DQuoteAttEnd = bitutil.ScanTo(DQuoteAttVal, DQuoteDelim &~ DQuoteAttVal)
    443                 SQuoteAttEnd = bitutil.ScanTo(SQuoteAttVal, SQuoteDelim &~ SQuoteAttVal)
    444                 AttValEnd = DQuoteAttEnd | SQuoteAttEnd
    445                 AttValEnds |= AttValEnd
    446                 AttValFollow = bitutil.Advance(AttValEnd)
    447                 tag_Callouts.AttVal_ends |= AttValFollow
    448                 #  AfterWS = bitutil.ScanThru(AttValFollow, lex.WS)
    449                 if AttValFollow & lex.WS:
    450                         AfterWS = bitutil.ScanThru(AttValFollow, lex.WS)
    451                 else: AfterWS = AttValFollow
    452                 AfterWS = bitutil.ScanThru(AttValFollow, lex.WS)
    453                 AttListEnd |= AfterWS & AttListDelim
     440        if tag_Callouts.ElemName_ends & lex.WS:
     441                AfterWS = pablo.ScanThru(tag_Callouts.ElemName_ends, lex.WS)
     442                AttListEnd = AfterWS & AttListDelim
    454443                AttNameStart = AfterWS & ~AttListDelim
    455 
    456         # No more attribute values to process when AttNameStart == 0.
     444                #
     445                # The following loop iterates through attributes within a start tag.
     446                # Because all start tags are processed in parallel, the number of
     447                # iterations is the maximum number of attributes found in any one
     448                # start tag, plus one.
     449                while AttNameStart:
     450                        ParseError |= AttNameStart &~ lex.NameScan
     451                        tag_Callouts.AttName_starts |= AttNameStart
     452                        AttNameFollow = pablo.ScanThru(AttNameStart, lex.NameScan)
     453                        tag_Callouts.AttName_ends |= AttNameFollow
     454                        # Scan through WS to the expected '=' delimiter.
     455                        # EqExpected = pablo.ScanThru(AttNameFollow, lex.WS)
     456                        # But use if test to optimize.
     457                        if AttNameFollow & lex.WS:
     458                                EqExpected = pablo.ScanThru(AttNameFollow, lex.WS)
     459                        else: EqExpected = AttNameFollow
     460                        ParseError |= EqExpected &~ lex.Equals
     461                        AttValPos = pablo.ScanThru(EqExpected, EqExpected | lex.WS)
     462                        tag_Callouts.AttVal_starts |= AttValPos
     463                        DQuoteAttVal = AttValPos & lex.DQuote
     464                        SQuoteAttVal = AttValPos & lex.SQuote
     465                        DQuoteAttEnd = pablo.ScanTo(DQuoteAttVal, DQuoteDelim &~ DQuoteAttVal)
     466                        SQuoteAttEnd = pablo.ScanTo(SQuoteAttVal, SQuoteDelim &~ SQuoteAttVal)
     467                        AttValEnd = DQuoteAttEnd | SQuoteAttEnd
     468                        ParseError |= (AttValPos | AttValEnd) &~ (lex.DQuote | lex.SQuote)
     469                        AttValFollow = pablo.Advance(AttValEnd)
     470                        tag_Callouts.AttVal_ends |= AttValFollow
     471                        #  AfterWS = pablo.ScanThru(AttValFollow, lex.WS)
     472                        if AttValFollow & lex.WS:
     473                                AfterWS = pablo.ScanThru(AttValFollow, lex.WS)
     474                                AttListEnd |= AfterWS & AttListDelim
     475                                AttNameStart = AfterWS & ~AttListDelim
     476                        else:
     477                                AttListEnd |= AttValFollow & AttListDelim
     478                                AttNameStart = 0
     479                                ParseError |= AttValFollow & ~AttListDelim
     480        else:
     481                # No WS character after ElemName; must be at the end
     482                AttListEnd = tag_Callouts.ElemName_ends & AttListDelim
     483                ParseError |= tag_Callouts.ElemName_ends & ~AttListDelim
     484
    457485        STagEnds = AttListEnd & lex.RAngle
    458486        # Mark any "/" characters found as the ends of empty element tags.
    459         tag_Callouts.EmptyTag_marks = bitutil.Advance(AttListEnd & lex.Slash)
    460 
    461         # Check for errors.
    462         ParseError |= tag_Callouts.AttVal_ends & tag_Callouts.AttName_starts # No intervening WS.
    463         ParseError |= tag_Callouts.AttName_starts & tag_Callouts.AttName_ends # Null AttName
    464         ParseError |= EqToCheck & ~lex.Equals # = not found where expected.
    465         ParseError |= tag_Callouts.AttVal_starts & ~ (lex.DQuote | lex.SQuote)
    466         ParseError |= AttValEnds & ~ (lex.DQuote | lex.SQuote)
     487        tag_Callouts.EmptyTag_marks = pablo.Advance(AttListEnd & lex.Slash)
     488
    467489        ParseError |= tag_Callouts.EmptyTag_marks & ~lex.RAngle
    468490
    469491        # End Tag Parsing
    470492
    471         EndTagEnds = bitutil.ScanThru(tag_Callouts.EndTag_marks, tag_Callouts.EndTag_marks | lex.NameScan)
     493        EndTagEnds = pablo.ScanThru(tag_Callouts.EndTag_marks, tag_Callouts.EndTag_marks | lex.NameScan)
    472494        if EndTagEnds & lex.WS:
    473                 EndTagEnds = bitutil.ScanThru(EndTagEnds, lex.WS)
     495                EndTagEnds = pablo.ScanThru(EndTagEnds, lex.WS)
    474496        ParseError |= EndTagEnds & ~lex.RAngle
    475497        if ParseError:
     
    480502        tag_Callouts.AttVal_spans = tag_Callouts.AttVal_ends - tag_Callouts.AttVal_starts
    481503
    482 def Parse_refs(lex, scope1, ctCDPI_Callouts, ref_Callouts):
     504def Parse_refs(lex, marker, ref_Callouts):
    483505        ref_Callouts.GenRef_starts = 0
    484506        ref_Callouts.GenRef_ends = 0
     
    489511        ref_error = 0
    490512
    491         Ref1 = lex.RefStart &~ ctCDPI_Callouts.CtCDPI_mask
    492513        # All remaining "&" must be reference start characters; parse them.
    493         if Ref1:
    494                 scope1.RefStart = bitutil.Advance(Ref1)
    495                 NumRef2 = scope1.RefStart & lex.Hash
    496                 ref_Callouts.GenRef_starts = scope1.RefStart &~ lex.Hash
    497                 NumRef3 = bitutil.Advance(NumRef2)
     514        if marker.Ref_opener:
     515                Ref_scope = pablo.Advance(marker.Ref_opener)
     516                NumRef2 = Ref_scope & lex.Hash
     517                ref_Callouts.GenRef_starts = Ref_scope &~ lex.Hash
     518                NumRef3 = pablo.Advance(NumRef2)
    498519                HexRef3 = NumRef3 & lex.x
    499520                ref_Callouts.DecRef_starts = NumRef3 &~ lex.x
    500                 ref_Callouts.HexRef_starts = bitutil.Advance(HexRef3)
    501                 ref_Callouts.GenRef_ends = bitutil.ScanThru(ref_Callouts.GenRef_starts, lex.NameScan)
    502                 ref_Callouts.DecRef_ends = bitutil.ScanThru(ref_Callouts.DecRef_starts, lex.Digit)
    503                 ref_Callouts.HexRef_ends = bitutil.ScanThru(ref_Callouts.HexRef_starts, lex.Hex)
     521                ref_Callouts.HexRef_starts = pablo.Advance(HexRef3)
     522                ref_Callouts.GenRef_ends = pablo.ScanThru(ref_Callouts.GenRef_starts, lex.NameScan)
     523                ref_Callouts.DecRef_ends = pablo.ScanThru(ref_Callouts.DecRef_starts, lex.Digit)
     524                ref_Callouts.HexRef_ends = pablo.ScanThru(ref_Callouts.HexRef_starts, lex.Hex)
    504525                # Error checks
    505526                # At least one digit required for DecRef, one hex digit for HexRef.
     
    515536
    516537
    517 def Validate_xml_names(ctCDPI_Callouts, ref_Callouts, tag_Callouts, lex, u8, xml_names, check_streams):
     538def Validate_xml_names(ctCDPI_Callouts, ref_Callouts, tag_Callouts, lex, u8, check_streams):
    518539        PI_names = ctCDPI_Callouts.PI_name_ends - ctCDPI_Callouts.PI_name_starts
    519540        GenRefs = ref_Callouts.GenRef_ends - ref_Callouts.GenRef_starts
     
    523544        ncname_stream = PI_names | GenRefs
    524545        name_stream = qname_stream | ncname_stream
    525         name_start = name_stream &~ bitutil.Advance(name_stream)
    526         name_cursor = name_stream & ~bitutil.Advance(name_stream)
     546        name_start = name_stream &~ pablo.Advance(name_stream)
     547        name_cursor = name_stream & ~pablo.Advance(name_stream)
    527548        void_prefix_err = name_cursor & lex.Colon
    528         namespace_sep = bitutil.ScanThru(name_cursor, lex.NameScan &~ lex.Colon) & lex.Colon
    529         local_part_start = bitutil.Advance(namespace_sep)
     549        namespace_sep = pablo.ScanThru(name_cursor, lex.NameScan &~ lex.Colon) & lex.Colon
     550        local_part_start = pablo.Advance(namespace_sep)
    530551        local_part_err = local_part_start &~ lex.NameScan
    531         colon2_err = bitutil.ScanThru(local_part_start, lex.NameScan &~ lex.Colon) & lex.Colon
     552        colon2_err = pablo.ScanThru(local_part_start, lex.NameScan &~ lex.Colon) & lex.Colon
    532553        ncname_err = ncname_stream & lex.Colon
    533554        namespace_error = void_prefix_err | local_part_err | colon2_err | ncname_err
     
    539560        check_streams.non_ascii_names = (name_stream &~ name_start) & ~lex.ASCII_name_char & ~u8.suffix
    540561
    541 def Do_check_streams(ctCDPI_Callouts, tag_Callouts, lex, u8, scope1, ref_Callouts, xml_names, check_streams):
    542     # Ensure that no occurrence of ]]> occurs outside of markup.
    543     CD_end_error = ctCDPI_Callouts.CD_end & ~(ctCDPI_Callouts.CtCDPI_mask | tag_Callouts.AttVal_spans)
    544 
    545     # Consolidate and check for errors
    546     if CD_end_error:
     562def Do_check_streams(marker, tag_Callouts, check_streams):
     563        CD_end_error = marker.CD_closer & ~tag_Callouts.AttVal_spans
     564        if CD_end_error:
    547565                error_tracker.NoteError("Error: ]]> in text", CD_end_error)
    548 
    549 
    550     check_streams.tag_marks = tag_Callouts.EmptyTag_marks | tag_Callouts.ElemName_starts | tag_Callouts.EndTag_marks | tag_Callouts.AttName_starts
    551     check_streams.name_follows = tag_Callouts.ElemName_ends | tag_Callouts.AttName_ends
    552     check_streams.att_refs = tag_Callouts.AttVal_spans & scope1.RefStart
     566        check_streams.tag_marks = tag_Callouts.EmptyTag_marks | tag_Callouts.ElemName_starts | tag_Callouts.EndTag_marks | tag_Callouts.AttName_starts
     567        check_streams.name_follows = tag_Callouts.ElemName_ends | tag_Callouts.AttName_ends
     568        check_streams.att_refs = tag_Callouts.AttVal_spans & marker.Ref_opener
    553569
    554570def Compute_Hash_Value_Bitstream(hash_data, basis_bits):
     
    564580        # Validate UTF-8 multibyte sequences and determine the UTF-8 scope streams
    565581        # Validate_utf8(basis_bits, u8)
    566                                
     582
    567583        Classify_bytes_Validate_utf8(basis_bits, lex, u8)
    568584
    569         Add_scope_streams(lex, scope1)
    570    
    571585        # Parse all comments, CDATA sections and processing instructions.
    572         Parse_CtCDPI(ctCDPI_Callouts, lex, scope1, check_streams)
    573                
     586        Parse_CtCDPI(lex, marker, ctCDPI_Callouts, check_streams)
     587
    574588        # All remaining '<' must be tag start characters; parse tags.
    575         Parse_tags(lex, scope1, ctCDPI_Callouts, tag_Callouts)
     589        Parse_tags(lex, marker, tag_Callouts)
    576590
    577591        # All remaining '&' must be reference start characters; parse them.
    578         Parse_refs(lex, scope1, ctCDPI_Callouts, ref_Callouts)
    579        
     592        Parse_refs(lex, marker, ref_Callouts)
     593
    580594        # Validate XML namespaces and generate bit streams to post validate non-ascii range XML names
    581         Validate_xml_names(ctCDPI_Callouts, ref_Callouts, tag_Callouts, lex, u8, xml_names, check_streams)
    582    
    583    
    584         Do_check_streams(ctCDPI_Callouts, tag_Callouts, lex, u8, scope1, ref_Callouts, xml_names, check_streams)
     595        Validate_xml_names(ctCDPI_Callouts, ref_Callouts, tag_Callouts, lex, u8, check_streams)
     596
     597        Do_check_streams(marker, tag_Callouts, check_streams)
    585598
    586599        Compute_Hash_Value_Bitstream(hash_data, basis_bits);
Note: See TracChangeset for help on using the changeset viewer.