Kirill Simonov avatar Kirill Simonov committed 52a4aa2

Fix some minor issues with the new Parser.

Comments (0)

Files changed (1)

lib/yaml/parser.py

             if start_mark is None:
                 start_mark = end_mark = self.peek_token().start_mark
             event = None
-            collection_events = None
             implicit = (tag is None or tag == u'!')
             if indentless_sequence and self.check_token(BlockEntryToken):
                 end_mark = self.peek_token().end_mark
                     else:
                         node = 'flow'
                     token = self.peek_token()
-                    raise ParserError("while scanning a %s node" % node, start_mark,
+                    raise ParserError("while parsing a %s node" % node, start_mark,
                             "expected the node content, but found %r" % token.id,
                             token.start_mark)
         return event
                 return self.process_empty_scalar(token.end_mark)
         if not self.check_token(BlockEndToken):
             token = self.peek_token()
-            raise ParserError("while scanning a block collection", self.marks[-1],
+            raise ParserError("while parsing a block collection", self.marks[-1],
                     "expected <block end>, but found %r" % token.id, token.start_mark)
         token = self.get_token()
         event = SequenceEndEvent(token.start_mark, token.end_mark)
                 return self.process_empty_scalar(token.end_mark)
         if not self.check_token(BlockEndToken):
             token = self.peek_token()
-            raise ParserError("while scanning a block mapping", self.marks[-1],
+            raise ParserError("while parsing a block mapping", self.marks[-1],
                     "expected <block end>, but found %r" % token.id, token.start_mark)
         token = self.get_token()
         event = MappingEndEvent(token.start_mark, token.end_mark)
                     self.get_token()
                 else:
                     token = self.peek_token()
-                    raise ParserError("while scanning a flow sequence", self.marks[-1],
+                    raise ParserError("while parsing a flow sequence", self.marks[-1],
                             "expected ',' or ']', but got %r" % token.id, token.start_mark)
             
             if self.check_token(KeyToken):
-                token = self.get_token()
+                token = self.peek_token()
                 event = MappingStartEvent(None, None, True,
                         token.start_mark, token.end_mark,
                         flow_style=True)
         return event
 
     def parse_flow_sequence_entry_mapping_key(self):
+        token = self.get_token()
         if not self.check_token(ValueToken,
                 FlowEntryToken, FlowSequenceEndToken):
             self.states.append(self.parse_flow_sequence_entry_mapping_value)
                     self.get_token()
                 else:
                     token = self.peek_token()
-                    raise ParserError("while scanning a flow mapping", self.marks[-1],
+                    raise ParserError("while parsing a flow mapping", self.marks[-1],
                             "expected ',' or '}', but got %r" % token.id, token.start_mark)
             if self.check_token(KeyToken):
                 token = self.get_token()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.