MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / yaml_parser_parse_block_sequence_entry

Function yaml_parser_parse_block_sequence_entry

external/libyaml/src/parser.c:732–782  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

730 */
731
732static int
733yaml_parser_parse_block_sequence_entry(yaml_parser_t *parser,
734 yaml_event_t *event, int first)
735{
736 yaml_token_t *token;
737
738 if (first) {
739 token = PEEK_TOKEN(parser);
740 if (!PUSH(parser, parser->marks, token->start_mark))
741 return 0;
742 SKIP_TOKEN(parser);
743 }
744
745 token = PEEK_TOKEN(parser);
746 if (!token) return 0;
747
748 if (token->type == YAML_BLOCK_ENTRY_TOKEN)
749 {
750 yaml_mark_t mark = token->end_mark;
751 SKIP_TOKEN(parser);
752 token = PEEK_TOKEN(parser);
753 if (!token) return 0;
754 if (token->type != YAML_BLOCK_ENTRY_TOKEN &&
755 token->type != YAML_BLOCK_END_TOKEN) {
756 if (!PUSH(parser, parser->states,
757 YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE))
758 return 0;
759 return yaml_parser_parse_node(parser, event, 1, 0);
760 }
761 else {
762 parser->state = YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE;
763 return yaml_parser_process_empty_scalar(parser, event, mark);
764 }
765 }
766
767 else if (token->type == YAML_BLOCK_END_TOKEN)
768 {
769 parser->state = POP(parser, parser->states);
770 (void)POP(parser, parser->marks);
771 SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
772 SKIP_TOKEN(parser);
773 return 1;
774 }
775
776 else
777 {
778 return yaml_parser_set_parser_error_context(parser,
779 "while parsing a block collection", POP(parser, parser->marks),
780 "did not find expected '-' indicator", token->start_mark);
781 }
782}
783
784/*
785 * Parse the productions:

Callers 1

Tested by

no test coverage detected