Ignore:
Timestamp:
03/19/06 08:00:38 (8 years ago)
Author:
xi
Message:
  • Add the token STREAM-START.
  • Add parsing events: STREAM-START, DOCUMENT-START, DOCUMENT-END.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pyyaml/trunk/tests/test_appliance.py

    r54 r118  
    4848        #print self.data[self.index:] 
    4949        tokens = [] 
     50        tokens.append(StreamStartToken(None, None)) 
    5051        while True: 
    5152            self.find_token() 
     
    207208        self.events = [] 
    208209 
    209     # stream: document* END 
     210    # stream: STREAM-START document* STREAM-END 
    210211    def parse_stream(self): 
     212        self.consume_token(StreamStartToken) 
     213        self.events.append(StreamStartEvent(None, None)) 
    211214        while not self.test_token(StreamEndToken): 
    212215            if self.test_token(DirectiveToken, DocumentStartToken): 
     
    214217            else: 
    215218                raise Error("document is expected, got "+repr(self.tokens[self.index])) 
     219        self.consume_token(StreamEndToken) 
    216220        self.events.append(StreamEndEvent(None, None)) 
    217221 
     
    222226            self.consume_token(DirectiveToken) 
    223227        self.consume_token(DocumentStartToken) 
     228        self.events.append(DocumentStartEvent(None, None)) 
    224229        self.parse_node() 
     230        self.events.append(DocumentEndEvent(None, None)) 
    225231 
    226232    # node: ALIAS | ANCHOR? TAG? (SCALAR|sequence|mapping) 
Note: See TracChangeset for help on using the changeset viewer.