Changeset 3220 for proto/xmlschema


Ignore:
Timestamp:
May 29, 2013, 12:50:51 PM (6 years ago)
Author:
shiyangy
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/xmlschema/parabix2_validation.py

    r2219 r3220  
    8181        QMark = 0
    8282        RBracket = 0
     83       
     84class Marker ():
     85        LAngle_scope = 0
     86        Ref_opener = 0
     87        CD_closer = 0
    8388
    8489class CtCDPI_Callouts():
     
    350355        scope1.RefStart = 0 # default
    351356
    352 def Parse_CtCDPI(ctCDPI_Callouts, lex, scope1, check_streams):
    353         ctCDPI_Callouts.CD_end = 0
     357def Parse_CtCDPI(lex, marker, ctCDPI_Callouts, check_streams):
    354358        ctCDPI_Callouts.Ct_starts = 0
    355359        ctCDPI_Callouts.Ct_ends = 0
     
    360364        ctCDPI_Callouts.PI_name_ends = 0
    361365        ctCDPI_Callouts.PI_ends = 0
    362         ctCDPI_Callouts.CtCDPI_mask = 0
    363         ctCDPI_error = 0
    364366        CtCDPI_starts = 0
    365         Ct_errors = 0
    366 
     367        CtCDPI_ends = 0
     368        ctCDPI_mask = 0
     369
     370        v = lex.LAngle | lex.Hyphen
     371        w = lex.Hyphen | lex.QMark
     372        v1 = pablo.Advance(v,1)
     373        w1 = pablo.Advance(w,1)
     374       
     375        LAngle_scope = v1 &~ w1  #pablo.Advance(lex.LAngle)
     376        PI_opener = LAngle_scope & lex.QMark
     377        CtCD_opener= LAngle_scope & lex.Exclam
     378        CtCDPI_opener = PI_opener | CtCD_opener
     379
     380        #DoubleHyphen = 0
     381        CD_closer = 0
     382        #PI_closer = 0
     383       
     384        #if lex.Hyphen: DoubleHyphen = pablo.Advance(lex.Hyphen) & lex.Hyphen
     385        DoubleHyphen = v1 & w1 & lex.Hyphen
    367386        if lex.RBracket:
    368                 scope1.RBracket = pablo.Advance(lex.RBracket)
    369                 ctCDPI_Callouts.CD_end = pablo.Advance(scope1.RBracket & lex.RBracket) & lex.RAngle
    370         PI_start = scope1.LAngle & lex.QMark
    371         CtCD_start = scope1.LAngle & lex.Exclam
    372         CtCDPI_start = PI_start | CtCD_start
    373 
    374         DoubleHyphen = scope1.Hyphen & lex.Hyphen
    375         PI_end = scope1.QMark & lex.RAngle
    376 
     387                DoubleRBracket = pablo.Advance(lex.RBracket) & lex.RBracket
     388                CD_closer = pablo.Advance(DoubleRBracket) & lex.RAngle
     389        #if lex.QMark: PI_closer = pablo.Advance(lex.QMark) & lex.RAngle
     390        PI_closer = w1 & ~v1 & lex.RAngle
    377391
    378392        #
    379393        # Initiate the scan
    380         CtCDPI_Cursor = pablo.ScanToFirst(CtCDPI_start)
     394        CtCDPI_Cursor = pablo.ScanToFirst(CtCDPI_opener)
    381395        while CtCDPI_Cursor:
    382396                CtCDPI_starts |= CtCDPI_Cursor
    383                 PI_Cursor = CtCDPI_Cursor & PI_start
     397                PI_Cursor = CtCDPI_Cursor & PI_opener
    384398                CD_Ct_Cursor = pablo.Advance(CtCDPI_Cursor & ~PI_Cursor)
    385399                CD_Cursor = CD_Ct_Cursor & lex.LBracket
    386                 Ct_Cursor = CD_Ct_Cursor & lex.Hyphen
    387                 ctCDPI_Callouts.PI_starts |= PI_Cursor
    388                 ctCDPI_Callouts.CD_starts |= CD_Cursor
    389                 ctCDPI_Callouts.Ct_starts |= Ct_Cursor
    390                 Ct_Cursor = pablo.Advance(Ct_Cursor)
    391                 Ct_errors |= Ct_Cursor & ~ lex.Hyphen
    392                 # Advance twice past <!--, so that we don't treat <!---
    393                 # as being a terminated comment.
    394                 Ct_Cursor = pablo.Advance(pablo.Advance(Ct_Cursor))
    395                 PI_Cursor = pablo.Advance(PI_Cursor)
    396                 ctCDPI_Callouts.PI_name_starts |= PI_Cursor
    397                 PI_name_end = pablo.ScanThru(PI_Cursor, lex.NameScan)
    398                 ctCDPI_Callouts.PI_name_ends |= PI_name_end
    399                 PI_Cursor = pablo.ScanTo(PI_name_end, PI_end)
    400                 CD_Cursor = pablo.ScanTo(CD_Cursor, ctCDPI_Callouts.CD_end)
    401                 Ct_Cursor = pablo.Advance(pablo.ScanTo(Ct_Cursor, DoubleHyphen))
    402                 ctCDPI_Callouts.PI_ends |= PI_Cursor
    403                 ctCDPI_Callouts.CD_ends |= CD_Cursor
    404                 ctCDPI_Callouts.Ct_ends |= Ct_Cursor
     400                Ct_Cursor = CD_Ct_Cursor & lex.Hyphen
     401                # PI processing
     402                if PI_Cursor:
     403                        ctCDPI_Callouts.PI_starts |= PI_Cursor
     404                        PI_Cursor = pablo.Advance(PI_Cursor)
     405                        ctCDPI_Callouts.PI_name_starts |= PI_Cursor
     406                        PI_name_end = pablo.ScanThru(PI_Cursor, lex.NameScan)
     407                        PI_error = PI_Cursor & PI_name_end
     408                        PI_noWS = PI_name_end & ~ lex.WS
     409                        PI_error |= PI_noWS &~ lex.QMark | pablo.Advance(PI_noWS) &~ PI_closer
     410                        pablo.assert_0(PI_error, "Error in PI syntax")
     411                        ctCDPI_Callouts.PI_name_ends |= PI_name_end
     412                        PI_Cursor = pablo.ScanTo(PI_name_end, PI_closer)
     413                        ctCDPI_Callouts.PI_ends |= PI_Cursor
     414                        CtCDPI_ends |= PI_Cursor
     415
     416                # CDATA section processing
     417                if CD_Cursor:
     418                        ctCDPI_Callouts.CD_starts |= CD_Cursor
     419                        CD_Cursor = pablo.ScanTo(CD_Cursor, CD_closer)
     420                        ctCDPI_Callouts.CD_ends |= CD_Cursor
     421                        CtCDPI_ends |= CD_Cursor
     422
     423                # Comment processing
     424                if Ct_Cursor:
     425                        ctCDPI_Callouts.Ct_starts |= Ct_Cursor
     426                        Ct_Cursor = pablo.Advance(Ct_Cursor) 
     427                        Ct_error = Ct_Cursor & ~ lex.Hyphen
     428                        # Advance twice past <!--, so that we don't treat <!---
     429                        # as being a terminated comment.
     430                        Ct_Cursor = pablo.Advance(pablo.Advance(Ct_Cursor))
     431                        Ct_Cursor = pablo.Advance(pablo.ScanTo(Ct_Cursor, DoubleHyphen))
     432                        pablo.assert_0(Ct_error | Ct_Cursor & ~ lex.RAngle, "Error in comment syntax")
     433                        ctCDPI_Callouts.Ct_ends |= Ct_Cursor
     434                        CtCDPI_ends |= Ct_Cursor
     435
     436                # Common processing
    405437                CtCDPI_Cursor = PI_Cursor | CD_Cursor | Ct_Cursor
    406                 CtCDPI_Cursor = pablo.ScanTo(CtCDPI_Cursor, CtCDPI_start)
    407 
    408                 ctCDPI_Callouts.CtCDPI_mask = pablo.Advance(ctCDPI_Callouts.CD_ends | ctCDPI_Callouts.Ct_ends | ctCDPI_Callouts.PI_ends) - CtCDPI_starts
    409                 #ctCDPI_Callouts.error = Ct_ends & ~lex.RAngle | Ct_starts & ~ lex.Hyphen
    410                 ctCDPI_error = Ct_errors | ctCDPI_Callouts.Ct_ends & ~lex.RAngle
    411                 ctCDPI_error |= pablo.Advance(ctCDPI_Callouts.PI_name_ends & ~ lex.WS) & ~ PI_end
    412                 ctCDPI_error |= ctCDPI_Callouts.PI_name_starts & ctCDPI_Callouts.PI_name_ends
     438                ctCDPI_mask = pablo.InclusiveSpan(CtCDPI_starts, CtCDPI_ends)
     439#               ctCDPI_mask |= (CtCDPI_ends - CtCDPI_starts) | CtCDPI_ends
    413440                # If any of the Comment, CDATA or PI markups are unterminated, it is an error.
    414                 ctCDPI_error |= ctCDPI_Callouts.CtCDPI_mask &~ EOF_mask
    415 
    416         if ctCDPI_error:
    417                 error_tracker.NoteError("Error in comment, CDATA or processing instruction syntax", ctCDPI_error)
    418 
    419         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
    420 
    421 def Parse_tags(lex, scope1, ctCDPI_Callouts, tag_Callouts):
    422 
    423 
     441                pablo.assert_0(pablo.atEOF(ctCDPI_mask), "Error in comment, CDATA or processing instruction syntax")
     442                CtCDPI_Cursor = pablo.ScanTo(CtCDPI_Cursor, CtCDPI_opener)     
     443               
     444#       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
     445#  Following is slow
     446        check_streams.misc_mask = (lex.WS | lex.LAngle | pablo.InclusiveSpan(ctCDPI_Callouts.Ct_starts | ctCDPI_Callouts.PI_starts, ctCDPI_Callouts.Ct_ends | ctCDPI_Callouts.PI_ends) | CtCDPI_starts) & EOF_mask
     447
     448
     449        # Identify the remaining significant markers for XML processing.
     450        marker.LAngle_scope = LAngle_scope &~ ctCDPI_mask
     451        marker.Ref_opener = lex.RefStart &~ ctCDPI_mask
     452        marker.CD_closer = CD_closer &~ ctCDPI_mask
     453
     454def Parse_tags(lex, marker, tag_Callouts):
     455       
     456        EqExpected = 0
     457        AttListEnd = 0
     458       
    424459        # Delimiters for scans.
    425460        DQuoteDelim = lex.DQuote | lex.LAngle
    426461        SQuoteDelim = lex.SQuote | lex.LAngle
    427462        AttListDelim = lex.Slash | lex.RAngle
    428 
     463       
    429464        # Start the parallel parsing by inspecting the character
    430465        # after the opening "<" of a tag.
    431         LAngleFollow = scope1.LAngle &~ ctCDPI_Callouts.CtCDPI_mask
    432         tag_Callouts.ElemName_starts = LAngleFollow & ~lex.Slash
    433         tag_Callouts.EndTag_marks = LAngleFollow & lex.Slash
    434 
     466        tag_Callouts.ElemName_starts = marker.LAngle_scope & ~lex.Slash
     467        tag_Callouts.EndTag_marks = marker.LAngle_scope & lex.Slash
     468       
    435469        # Start Tag/Empty Element Tag Parsing
    436470
     
    440474        # Mark any occurrences of null names as errors.
    441475        ParseError = tag_Callouts.ElemName_starts & tag_Callouts.ElemName_ends
    442 
     476       
    443477        # Initialize the accumulators for attribute name and value positions.
    444         tag_Callouts.AttName_starts = 0
     478        tag_Callouts.AttName_starts = 0 
    445479        tag_Callouts.AttName_ends = 0
    446         EqToCheck = 0
    447480        tag_Callouts.AttVal_starts = 0
    448         AttValEnds = 0
    449481        tag_Callouts.AttVal_ends = 0
    450 
    451482        # After the element name, there may or may not be an attlist.
    452         AfterWS = pablo.ScanThru(tag_Callouts.ElemName_ends, lex.WS)
    453         AttListEnd = AfterWS & AttListDelim
    454         AttNameStart = AfterWS & ~AttListDelim
    455         # At least one WS character is required between ElemNames and AttNames.
    456         ParseError |= tag_Callouts.ElemName_ends & AttNameStart
    457 
    458         #
    459         # The following loop iterates through attributes within a start tag.
    460         # Because all start tags are processed in parallel, the number of
    461         # iterations is the maximum number of attributes found in any one
    462         # start tag, plus one.
    463         while AttNameStart:
    464                 tag_Callouts.AttName_starts |= AttNameStart
    465                 AttNameFollow = pablo.ScanThru(AttNameStart, lex.NameScan)
    466                 tag_Callouts.AttName_ends |= AttNameFollow
    467                 # Scan through WS to the expected '=' delimiter.
    468                 # EqExpected = pablo.ScanThru(AttNameFollow, lex.WS)
    469                 # But use if test to optimize.
    470                 if AttNameFollow & lex.WS:
    471                         EqExpected = pablo.ScanThru(AttNameFollow, lex.WS)
    472                 else: EqExpected = AttNameFollow
    473                 EqToCheck |= EqExpected
    474                 AttValPos = pablo.ScanThru(EqExpected, EqExpected | lex.WS)
    475                 tag_Callouts.AttVal_starts |= AttValPos
    476                 DQuoteAttVal = AttValPos & lex.DQuote
    477                 SQuoteAttVal = AttValPos & lex.SQuote
    478                 DQuoteAttEnd = pablo.ScanTo(DQuoteAttVal, DQuoteDelim &~ DQuoteAttVal)
    479                 SQuoteAttEnd = pablo.ScanTo(SQuoteAttVal, SQuoteDelim &~ SQuoteAttVal)
    480                 AttValEnd = DQuoteAttEnd | SQuoteAttEnd
    481                 AttValEnds |= AttValEnd
    482                 AttValFollow = pablo.Advance(AttValEnd)
    483                 tag_Callouts.AttVal_ends |= AttValFollow
    484                 #  AfterWS = pablo.ScanThru(AttValFollow, lex.WS)
    485                 if AttValFollow & lex.WS:
    486                         AfterWS = pablo.ScanThru(AttValFollow, lex.WS)
    487                 else: AfterWS = AttValFollow
    488                 AfterWS = pablo.ScanThru(AttValFollow, lex.WS)
    489                 AttListEnd |= AfterWS & AttListDelim
     483        if tag_Callouts.ElemName_ends & lex.WS:
     484                AfterWS = pablo.ScanThru(tag_Callouts.ElemName_ends, lex.WS)
     485                AttListEnd = AfterWS & AttListDelim
    490486                AttNameStart = AfterWS & ~AttListDelim
    491 
    492         # No more attribute values to process when AttNameStart == 0.
     487                #
     488                # The following loop iterates through attributes within a start tag.
     489                # Because all start tags are processed in parallel, the number of
     490                # iterations is the maximum number of attributes found in any one
     491                # start tag, plus one.
     492                while AttNameStart:
     493                        ParseError |= AttNameStart &~ lex.NameScan
     494                        tag_Callouts.AttName_starts |= AttNameStart
     495                        AttNameFollow = pablo.ScanThru(AttNameStart, lex.NameScan)
     496                        tag_Callouts.AttName_ends |= AttNameFollow
     497                        # Scan through WS to the expected '=' delimiter.
     498                        # EqExpected = pablo.ScanThru(AttNameFollow, lex.WS)
     499                        # But use if test to optimize.
     500                        if AttNameFollow & lex.WS:
     501                                EqExpected = pablo.ScanThru(AttNameFollow, lex.WS)
     502                        else: EqExpected = AttNameFollow
     503                        ParseError |= EqExpected &~ lex.Equals
     504                        AttValPos = pablo.AdvanceThenScanThru(EqExpected, lex.WS)
     505#                       AttValPos = pablo.ScanThru(EqExpected, EqExpected | lex.WS)
     506                        tag_Callouts.AttVal_starts |= AttValPos
     507                        DQuoteAttVal = AttValPos & lex.DQuote
     508                        SQuoteAttVal = AttValPos & lex.SQuote
     509#                       DQuoteAttEnd = pablo.ScanTo(DQuoteAttVal, DQuoteDelim &~ DQuoteAttVal)
     510#                       SQuoteAttEnd = pablo.ScanTo(SQuoteAttVal, SQuoteDelim &~ SQuoteAttVal)
     511                        DQuoteAttEnd = pablo.AdvanceThenScanTo(DQuoteAttVal, DQuoteDelim)
     512                        SQuoteAttEnd = pablo.AdvanceThenScanTo(SQuoteAttVal, SQuoteDelim)
     513                        AttValEnd = DQuoteAttEnd | SQuoteAttEnd
     514                        ParseError |= (AttValPos | AttValEnd) &~ (lex.DQuote | lex.SQuote)
     515                        AttValFollow = pablo.Advance(AttValEnd)
     516                        tag_Callouts.AttVal_ends |= AttValFollow
     517                        #  AfterWS = pablo.ScanThru(AttValFollow, lex.WS)
     518                        if AttValFollow & lex.WS:
     519                                AfterWS = pablo.ScanThru(AttValFollow, lex.WS)
     520                                AttListEnd |= AfterWS & AttListDelim
     521                                AttNameStart = AfterWS & ~AttListDelim
     522                        else:
     523                                AttListEnd |= AttValFollow & AttListDelim       
     524                                AttNameStart = AttValFollow & ~AttListDelim
     525                        ParseError |= AttValFollow & AttNameStart
     526        else:
     527                # No WS character after ElemName; must be at the end
     528                AttListEnd = tag_Callouts.ElemName_ends & AttListDelim
     529                ParseError |= tag_Callouts.ElemName_ends & ~AttListDelim
     530
    493531        STagEnds = AttListEnd & lex.RAngle
    494532        # Mark any "/" characters found as the ends of empty element tags.
    495533        tag_Callouts.EmptyTag_marks = pablo.Advance(AttListEnd & lex.Slash)
    496534       
    497         tag_Callouts.Tag_closing = tag_Callouts.EmptyTag_marks | tag_Callouts.EndTag_marks
    498 
    499         # Check for errors.
    500         ParseError |= tag_Callouts.AttVal_ends & tag_Callouts.AttName_starts # No intervening WS.
    501         ParseError |= tag_Callouts.AttName_starts & tag_Callouts.AttName_ends # Null AttName
    502         ParseError |= EqToCheck & ~lex.Equals # = not found where expected.
    503         ParseError |= tag_Callouts.AttVal_starts & ~ (lex.DQuote | lex.SQuote)
    504         ParseError |= AttValEnds & ~ (lex.DQuote | lex.SQuote)
    505535        ParseError |= tag_Callouts.EmptyTag_marks & ~lex.RAngle
    506536
    507537        # End Tag Parsing
    508538
    509         EndTagEnds = pablo.ScanThru(tag_Callouts.EndTag_marks, tag_Callouts.EndTag_marks | lex.NameScan)
     539        EndTagEnds = pablo.AdvanceThenScanThru(tag_Callouts.EndTag_marks, lex.NameScan)
    510540        if EndTagEnds & lex.WS:
    511541                EndTagEnds = pablo.ScanThru(EndTagEnds, lex.WS)
    512542        ParseError |= EndTagEnds & ~lex.RAngle
    513         if ParseError:
    514                 error_tracker.NoteError("Tag parsing error found", (ParseError))
    515 
    516 
     543        pablo.assert_0(ParseError, "Tag parsing error found")
     544               
     545               
    517546        # Attribute value spans
    518         tag_Callouts.AttVal_spans = tag_Callouts.AttVal_ends - tag_Callouts.AttVal_starts
    519 
    520 def Parse_refs(lex, scope1, ctCDPI_Callouts, ref_Callouts):
     547#       tag_Callouts.AttVal_spans = tag_Callouts.AttVal_ends - tag_Callouts.AttVal_starts
     548        tag_Callouts.AttVal_spans = pablo.SpanUpTo(tag_Callouts.AttVal_starts, tag_Callouts.AttVal_ends)
     549       
     550        tag_Callouts.Tag_closing = tag_Callouts.EmptyTag_marks | tag_Callouts.EndTag_marks
     551
     552def Parse_refs(lex, marker, ref_Callouts):
    521553        ref_Callouts.GenRef_starts = 0
    522554        ref_Callouts.GenRef_ends = 0
     
    527559        ref_error = 0
    528560
    529         Ref1 = lex.RefStart &~ ctCDPI_Callouts.CtCDPI_mask
    530561        # All remaining "&" must be reference start characters; parse them.
    531         if Ref1:
    532                 scope1.RefStart = pablo.Advance(Ref1)
    533                 NumRef2 = scope1.RefStart & lex.Hash
    534                 ref_Callouts.GenRef_starts = scope1.RefStart &~ lex.Hash
     562        if marker.Ref_opener:
     563                Ref_scope = pablo.Advance(marker.Ref_opener)
     564                NumRef2 = Ref_scope & lex.Hash
     565                ref_Callouts.GenRef_starts = Ref_scope &~ lex.Hash
    535566                NumRef3 = pablo.Advance(NumRef2)
    536567                HexRef3 = NumRef3 & lex.x
    537568                ref_Callouts.DecRef_starts = NumRef3 &~ lex.x
    538                 ref_Callouts.HexRef_starts = pablo.Advance(HexRef3)
     569                ref_Callouts.HexRef_starts = pablo.Advance(HexRef3) 
    539570                ref_Callouts.GenRef_ends = pablo.ScanThru(ref_Callouts.GenRef_starts, lex.NameScan)
    540571                ref_Callouts.DecRef_ends = pablo.ScanThru(ref_Callouts.DecRef_starts, lex.Digit)
     
    547578                ref_ends = ref_Callouts.GenRef_ends | ref_Callouts.DecRef_ends | ref_Callouts.HexRef_ends
    548579                ref_error3 = ref_ends &~ lex.Semicolon
    549                 ref_error = ref_error1 | ref_error2 | ref_error3
    550                 if ref_error:
    551                         error_tracker.NoteError("Reference error found", (ref_error))
    552 
    553 
    554 
    555 def Validate_xml_names(ctCDPI_Callouts, ref_Callouts, tag_Callouts, lex, u8, xml_names, check_streams):
    556         PI_names = ctCDPI_Callouts.PI_name_ends - ctCDPI_Callouts.PI_name_starts
    557         GenRefs = ref_Callouts.GenRef_ends - ref_Callouts.GenRef_starts
    558         ElemNames = tag_Callouts.ElemName_ends - tag_Callouts.ElemName_starts
    559         AttNames = tag_Callouts.AttName_ends - tag_Callouts.AttName_starts
     580                pablo.assert_0(ref_error1 | ref_error2 | ref_error3, "Reference error found")
     581
     582
     583
     584def Validate_xml_names(ctCDPI_Callouts, ref_Callouts, tag_Callouts, lex, u8, check_streams):
     585        PI_names = pablo.SpanUpTo(ctCDPI_Callouts.PI_name_starts,ctCDPI_Callouts.PI_name_ends)
     586        GenRefs = pablo.SpanUpTo(ref_Callouts.GenRef_starts,ref_Callouts.GenRef_ends)
     587        ElemNames = pablo.SpanUpTo(tag_Callouts.ElemName_starts,tag_Callouts.ElemName_ends)
     588        AttNames = pablo.SpanUpTo(tag_Callouts.AttName_starts, tag_Callouts.AttName_ends)
    560589        qname_stream =  ElemNames | AttNames
    561590        ncname_stream = PI_names | GenRefs
     
    577606        check_streams.non_ascii_names = (name_stream &~ name_start) & ~lex.ASCII_name_char & ~u8.suffix
    578607
    579 def Do_check_streams(ctCDPI_Callouts, tag_Callouts, lex, u8, scope1, ref_Callouts, xml_names, check_streams):
    580     # Ensure that no occurrence of ]]> occurs outside of markup.
    581     CD_end_error = ctCDPI_Callouts.CD_end & ~(ctCDPI_Callouts.CtCDPI_mask | tag_Callouts.AttVal_spans)
    582 
    583     # Consolidate and check for errors
    584     if CD_end_error:
    585                 error_tracker.NoteError("Error: ]]> in text", CD_end_error)
    586 
    587 
    588     check_streams.tag_marks = tag_Callouts.EmptyTag_marks | tag_Callouts.ElemName_starts | tag_Callouts.EndTag_marks | tag_Callouts.AttName_starts
    589     check_streams.name_follows = tag_Callouts.ElemName_ends | tag_Callouts.AttName_ends
    590     check_streams.att_refs = tag_Callouts.AttVal_spans & scope1.RefStart
     608   
     609def Do_check_streams(marker, tag_Callouts, check_streams):
     610        pablo.assert_0(marker.CD_closer & ~tag_Callouts.AttVal_spans, "Error: ]]> in text")
     611        check_streams.tag_marks = tag_Callouts.EmptyTag_marks | tag_Callouts.ElemName_starts | tag_Callouts.EndTag_marks | tag_Callouts.AttName_starts
     612        check_streams.name_follows = tag_Callouts.ElemName_ends | tag_Callouts.AttName_ends
     613        check_streams.att_refs = tag_Callouts.AttVal_spans & marker.Ref_opener
    591614
    592615
     
    743766   
    744767        # Parse all comments, CDATA sections and processing instructions.
    745         Parse_CtCDPI(ctCDPI_Callouts, lex, scope1, check_streams)
     768        Parse_CtCDPI(lex, marker, ctCDPI_Callouts, check_streams)
    746769               
    747770        # All remaining '<' must be tag start characters; parse tags.
    748         Parse_tags(lex, scope1, ctCDPI_Callouts, tag_Callouts)
     771        Parse_tags(lex, marker, tag_Callouts)
    749772
    750773        # All remaining '&' must be reference start characters; parse them.
    751         Parse_refs(lex, scope1, ctCDPI_Callouts, ref_Callouts)
     774        Parse_refs(lex, marker, ref_Callouts)
    752775       
    753776        # Validate XML namespaces and generate bit streams to post validate non-ascii range XML names
    754         Validate_xml_names(ctCDPI_Callouts, ref_Callouts, tag_Callouts, lex, u8, xml_names, check_streams)
     777        Validate_xml_names(ctCDPI_Callouts, ref_Callouts, tag_Callouts, lex, u8, check_streams)
    755778   
    756    
    757         Do_check_streams(ctCDPI_Callouts, tag_Callouts, lex, u8, scope1, ref_Callouts, xml_names, check_streams)
    758 
     779        Do_check_streams(marker, tag_Callouts, check_streams)
    759780        # These methods are needed to do Paralel Bitstream Based Length Sorting
    760781        Form_Length_Group_Bitstreams(tag_Callouts)
Note: See TracChangeset for help on using the changeset viewer.