MCPcopy
hub / github.com/go-yaml/yaml / yaml_parser_parse_node

Function yaml_parser_parse_node

parserc.go:455–681  ·  view source on GitHub ↗

Parse the productions: block_node_or_indentless_sequence ::= ALIAS ***** | properties (block_content | indentless_block_sequence)? ********** * | block_content | indentless_block_sequence * block_node ::= ALIAS ***** | properties block_content? ********** * | block_content * flow_node

(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool)

Source from the content-addressed store, hash-verified

453// flow_content ::= flow_collection | SCALAR
454// ******
455func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool) bool {
456 //defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)()
457
458 token := peek_token(parser)
459 if token == nil {
460 return false
461 }
462
463 if token.typ == yaml_ALIAS_TOKEN {
464 parser.state = parser.states[len(parser.states)-1]
465 parser.states = parser.states[:len(parser.states)-1]
466 *event = yaml_event_t{
467 typ: yaml_ALIAS_EVENT,
468 start_mark: token.start_mark,
469 end_mark: token.end_mark,
470 anchor: token.value,
471 }
472 yaml_parser_set_event_comments(parser, event)
473 skip_token(parser)
474 return true
475 }
476
477 start_mark := token.start_mark
478 end_mark := token.start_mark
479
480 var tag_token bool
481 var tag_handle, tag_suffix, anchor []byte
482 var tag_mark yaml_mark_t
483 if token.typ == yaml_ANCHOR_TOKEN {
484 anchor = token.value
485 start_mark = token.start_mark
486 end_mark = token.end_mark
487 skip_token(parser)
488 token = peek_token(parser)
489 if token == nil {
490 return false
491 }
492 if token.typ == yaml_TAG_TOKEN {
493 tag_token = true
494 tag_handle = token.value
495 tag_suffix = token.suffix
496 tag_mark = token.start_mark
497 end_mark = token.end_mark
498 skip_token(parser)
499 token = peek_token(parser)
500 if token == nil {
501 return false
502 }
503 }
504 } else if token.typ == yaml_TAG_TOKEN {
505 tag_token = true
506 tag_handle = token.value
507 tag_suffix = token.suffix
508 start_mark = token.start_mark
509 tag_mark = token.start_mark
510 end_mark = token.end_mark
511 skip_token(parser)
512 token = peek_token(parser)

Calls 5

peek_tokenFunction · 0.85
skip_tokenFunction · 0.85
yaml_style_tTypeAlias · 0.85

Tested by

no test coverage detected