MCPcopy Create free account
hub / github.com/apache/madlib / parse_node

Method parse_node

src/madpack/yaml/parser.py:270–369  ·  view source on GitHub ↗
(self, block=False, indentless_sequence=False)

Source from the content-addressed store, hash-verified

268 return self.parse_node(block=True, indentless_sequence=True)
269
270 def parse_node(self, block=False, indentless_sequence=False):
271 if self.check_token(AliasToken):
272 token = self.get_token()
273 event = AliasEvent(token.value, token.start_mark, token.end_mark)
274 self.state = self.states.pop()
275 else:
276 anchor = None
277 tag = None
278 start_mark = end_mark = tag_mark = None
279 if self.check_token(AnchorToken):
280 token = self.get_token()
281 start_mark = token.start_mark
282 end_mark = token.end_mark
283 anchor = token.value
284 if self.check_token(TagToken):
285 token = self.get_token()
286 tag_mark = token.start_mark
287 end_mark = token.end_mark
288 tag = token.value
289 elif self.check_token(TagToken):
290 token = self.get_token()
291 start_mark = tag_mark = token.start_mark
292 end_mark = token.end_mark
293 tag = token.value
294 if self.check_token(AnchorToken):
295 token = self.get_token()
296 end_mark = token.end_mark
297 anchor = token.value
298 if tag is not None:
299 handle, suffix = tag
300 if handle is not None:
301 if handle not in self.tag_handles:
302 raise ParserError("while parsing a node", start_mark,
303 "found undefined tag handle %r" % handle.encode('utf-8'),
304 tag_mark)
305 tag = self.tag_handles[handle]+suffix
306 else:
307 tag = suffix
308 #if tag == u'!':
309 # raise ParserError("while parsing a node", start_mark,
310 # "found non-specific tag '!'", tag_mark,
311 # "Please check 'http://pyyaml.org/wiki/YAMLNonSpecificTag' and share your opinion.")
312 if start_mark is None:
313 start_mark = end_mark = self.peek_token().start_mark
314 event = None
315 implicit = (tag is None or tag == u'!')
316 if indentless_sequence and self.check_token(BlockEntryToken):
317 end_mark = self.peek_token().end_mark
318 event = SequenceStartEvent(anchor, tag, implicit,
319 start_mark, end_mark)
320 self.state = self.parse_indentless_sequence_entry
321 else:
322 if self.check_token(ScalarToken):
323 token = self.get_token()
324 end_mark = token.end_mark
325 if (token.plain and tag is None) or tag == u'!':
326 implicit = (True, False)
327 elif tag is None:

Callers 3

parse_block_nodeMethod · 0.95
parse_flow_nodeMethod · 0.95

Calls 8

AliasEventClass · 0.85
ParserErrorClass · 0.85
SequenceStartEventClass · 0.85
ScalarEventClass · 0.85
MappingStartEventClass · 0.85
check_tokenMethod · 0.80
get_tokenMethod · 0.80
peek_tokenMethod · 0.80

Tested by

no test coverage detected