Ignore:
Timestamp:
Jul 30, 2011, 12:47:32 PM (8 years ago)
Author:
cameron
Message:

Integrate tag parsing error tests in loop

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/parabix2/parabix2_pablo.py

    r1244 r1245  
    405405        tag_Callouts.AttName_starts = 0 
    406406        tag_Callouts.AttName_ends = 0
    407         EqToCheck = 0
    408407        tag_Callouts.AttVal_starts = 0
    409         AttValEnds = 0
    410408        tag_Callouts.AttVal_ends = 0
    411409
     
    421419                # start tag, plus one.
    422420                while AttNameStart:
     421                        ParseError |= AttNameStart &~ lex.NameScan
    423422                        tag_Callouts.AttName_starts |= AttNameStart
    424423                        AttNameFollow = bitutil.ScanThru(AttNameStart, lex.NameScan)
     
    430429                                EqExpected = bitutil.ScanThru(AttNameFollow, lex.WS)
    431430                        else: EqExpected = AttNameFollow
    432                         EqToCheck |= EqExpected
     431                        ParseError |= EqExpected &~ lex.Equals
    433432                        AttValPos = bitutil.ScanThru(EqExpected, EqExpected | lex.WS)
    434433                        tag_Callouts.AttVal_starts |= AttValPos
     
    438437                        SQuoteAttEnd = bitutil.ScanTo(SQuoteAttVal, SQuoteDelim &~ SQuoteAttVal)
    439438                        AttValEnd = DQuoteAttEnd | SQuoteAttEnd
    440                         AttValEnds |= AttValEnd
     439                        ParseError |= (AttValPos | AttValEnd) &~ (lex.DQuote | lex.SQuote)
    441440                        AttValFollow = bitutil.Advance(AttValEnd)
    442441                        tag_Callouts.AttVal_ends |= AttValFollow
     
    444443                        if AttValFollow & lex.WS:
    445444                                AfterWS = bitutil.ScanThru(AttValFollow, lex.WS)
    446                         else: AfterWS = AttValFollow
    447                         AfterWS = bitutil.ScanThru(AttValFollow, lex.WS)
    448                         AttListEnd |= AfterWS & AttListDelim
    449                         AttNameStart = AfterWS & ~AttListDelim
    450                 # No more attribute values to process when AttNameStart == 0.
    451                 # Check for errors.
    452                 ParseError |= tag_Callouts.AttVal_ends & tag_Callouts.AttName_starts # No intervening WS.
    453                 ParseError |= tag_Callouts.AttName_starts & tag_Callouts.AttName_ends # Null AttName
    454                 ParseError |= EqToCheck & ~lex.Equals # = not found where expected.
    455                 ParseError |= tag_Callouts.AttVal_starts & ~ (lex.DQuote | lex.SQuote)
    456                 ParseError |= AttValEnds & ~ (lex.DQuote | lex.SQuote)
     445                                AttListEnd |= AfterWS & AttListDelim
     446                                AttNameStart = AfterWS & ~AttListDelim
     447                        else:
     448                                AttListEnd |= AttValFollow & AttListDelim       
     449                                AttNameStart = 0
     450                                ParseError |= AttValFollow & ~AttListDelim
    457451        else:
    458                 # At least one WS character is required between ElemNames and AttNames.
     452                # No WS character after ElemName; must be at the end
    459453                AttListEnd = tag_Callouts.ElemName_ends & AttListDelim
    460454                ParseError |= tag_Callouts.ElemName_ends & ~AttListDelim
    461455
    462         # No more attribute values to process when AttNameStart == 0.
    463456        STagEnds = AttListEnd & lex.RAngle
    464457        # Mark any "/" characters found as the ends of empty element tags.
Note: See TracChangeset for help on using the changeset viewer.