Changeset 275


Ignore:
Timestamp:
Aug 7, 2009, 1:14:15 PM (10 years ago)
Author:
cameron
Message:

Combined CallOut? streams

File:
1 edited

Legend:

Unmodified
Added
Removed
  • proto/parallel_tag_parse.py

    r261 r275  
    9494        # Mark any occurrences of null names as errors.
    9595        ParseError = ElemNamePositions & ElemNameFollows
     96        ElemNames = ElemNameFollows - ElemNamePositions
    9697       
    9798        # Initialize the accumulators for attribute name and value positions.
     
    138139        # No more attribute values to process when AttNameStart == 0.
    139140
     141        AttNames = AttNameFollows - AttNameStarts
     142        AttVals = AttValFollows - AttValStarts
    140143        STagEnds = AttListEnd & RAngle
    141144        # Mark any "/" characters found as the ends of empty element tags.
    142145        EmptyTagEnds = Advance(AttListEnd & Slash)
     146        Tags = (STagEnds | EmptyTagEnds) - ElemNamePositions
    143147
    144148        # Check for errors.
     
    153157        EndTagEnds = ScanThru(ScanThru(Advance(EndTagSeconds), ~NameDelim), WS)
    154158        ParseError |= EndTagEnds & ~RAngle
    155 
    156         return {'ElemNamePositions' : ElemNamePositions,
    157                 'ElemNameFollows' : ElemNameFollows,
    158                 'STagEnds' : STagEnds,
    159                 'EmptyTagEnds' : EmptyTagEnds,
    160                 'ParseError' : ParseError,
    161                 'AttNameStarts' : AttNameStarts,
    162                 'AttNameFollows' : AttNameFollows,
    163                 'AttValStarts' : AttValStarts,
    164                 'AttValEnds' : AttValEnds,
    165                 'EndTagSeconds' : EndTagSeconds,
    166                 'EndTagEnds' : EndTagEnds}
     159        EndTags = EndTagEnds - EndTagSeconds
     160
     161        return {'ElemNames' : ElemNames,
     162                'AttNames' : AttNames,
     163                'AttVals' : AttVals,
     164                'Tags' : Tags,
     165                'EmptyTagMarks' : EmptyTagEnds,
     166                'EndTags' : EndTags,
     167                'ParseError' : ParseError}
    167168
    168169
     
    170171        doc_lgth = len(xml_data)
    171172        outfile.write("Document:%s%s\n" % (" "*16, xml_data))
    172         for k in ['ElemNamePositions', 'ElemNameFollows', 'STagEnds',
    173                   'EmptyTagEnds', 'AttNameStarts', 'AttNameFollows', 'AttValStarts', 'AttValEnds',
    174                         'EndTagSeconds', 'EndTagEnds']:
     173#       for k in ['ElemNamePositions', 'ElemNameFollows', 'STagEnds',
     174#                 'EmptyTagEnds', 'AttNameStarts', 'AttNameFollows', 'AttValStarts', 'AttValEnds',
     175#                       'EndTagSeconds', 'EndTagEnds']:
     176        for k in ['ElemNames', 'AttNames', 'AttVals', 'Tags', 'EmptyTagMarks', 'EndTags']:
    175177                outfile.write("%s:%s%s\n" % (k, ' '*(24-len(k)), bitstream2string(parse_results[k], doc_lgth)))
    176178        k = 'ParseError'
     
    192194        "<good/> <unterminated",
    193195        "<WSerror a = '345'b='123'>",
    194         "<EqExpectedError  a * 'b'> <OK a = 'b'>  <err2 a = 'b' c * 'd'>" 
     196        "<EqExpectedError  a * 'b'> <OK a = 'b'>  <err2 a = 'b' c * 'd'>",
     197        "<Top x='1'><a><leaf>4</leaf>;<void/></a></top>"
    195198]
    196199
Note: See TracChangeset for help on using the changeset viewer.