Modify

Ticket #178 (new defect)

Opened 3 years ago

Problem with parsing ':'

Reported by: Samuel.Hym@… Owned by: xi
Priority: normal Component: pyyaml
Severity: normal Keywords:
Cc:

Description

Hello,

The simple string ':' should be parsed, as far as I understand YAML specification, as { : }. pyyaml simply gives up (ipython trace, with the debian version 3.09-5 of python-yaml, Python 2.6.6, IPython 0.10):

In [14]: yaml.load(':')

ERROR: An unexpected error occurred while tokenizing input The following traceback may be corrupted or invalid The error message is: ('EOF in multi-line statement', (5, 0))


ParserError? Traceback (most recent call last)

/tmp/<ipython console> in <module>()

/usr/lib/python2.6/dist-packages/yaml/init.pyc in load(stream, Loader)

56 """ 57 loader = Loader(stream)

---> 58 return loader.get_single_data()

59 60 def load_all(stream, Loader=Loader):

/usr/lib/python2.6/dist-packages/yaml/constructor.pyc in get_single_data(self)

40 def get_single_data(self): 41 # Ensure that the stream contains a single document and construct it.

---> 42 node = self.get_single_node()

43 if node is not None: 44 return self.construct_document(node)

/usr/lib/python2.6/dist-packages/yaml/composer.pyc in get_single_node(self)

34 document = None 35 if not self.check_event(StreamEndEvent?):

---> 36 document = self.compose_document()

37 38 # Ensure that the stream contains no more documents.

/usr/lib/python2.6/dist-packages/yaml/composer.pyc in compose_document(self)

53 54 # Compose the root node.

---> 55 node = self.compose_node(None, None)

56 57 # Drop the DOCUMENT-END event.

/usr/lib/python2.6/dist-packages/yaml/composer.pyc in compose_node(self, parent, index)

82 node = self.compose_sequence_node(anchor) 83 elif self.check_event(MappingStartEvent?):

---> 84 node = self.compose_mapping_node(anchor)

85 self.ascend_resolver() 86 return node

/usr/lib/python2.6/dist-packages/yaml/composer.pyc in compose_mapping_node(self, anchor)

125 if anchor is not None: 126 self.anchors[anchor] = node

--> 127 while not self.check_event(MappingEndEvent?):

128 #key_event = self.peek_event()

129 item_key = self.compose_node(node, None)

/usr/lib/python2.6/dist-packages/yaml/parser.pyc in check_event(self, *choices)

91 if self.current_event is None: 92 if self.state:

---> 93 self.current_event = self.state()

94 if self.current_event is not None: 95 if not choices:

/usr/lib/python2.6/dist-packages/yaml/parser.pyc in parse_block_mapping_first_key(self)

418 token = self.get_token() 419 self.marks.append(token.start_mark)

--> 420 return self.parse_block_mapping_key()

421 422 def parse_block_mapping_key(self):

/usr/lib/python2.6/dist-packages/yaml/parser.pyc in parse_block_mapping_key(self)

432 token = self.peek_token() 433 raise ParserError?("while parsing a block mapping", self.marks[-1],

--> 434 "expected <block end>, but found %r" % token.id, token.start_mark)

435 token = self.get_token() 436 event = MappingEndEvent?(token.start_mark, token.end_mark)

ParserError?: while parsing a block mapping expected <block end>, but found ':'

in "<string>", line 1, column 1:

:

Best regards

Samuel Hym

Attachments

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will be changed from xi. Next status will be 'new'
The owner will be changed from xi to anonymous. Next status will be 'assigned'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.