Parse the productions: block_mapping ::= BLOCK-MAPPING_START ******************* ((KEY block_node_or_indentless_sequence?)? *** * (VALUE block_node_or_indentless_sequence?)?)* BLOCK-END *********
(parser *yaml_parser_t, event *yaml_event_t, first bool)
| 814 | // ********* |
| 815 | // |
| 816 | func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { |
| 817 | if first { |
| 818 | token := peek_token(parser) |
| 819 | if token == nil { |
| 820 | return false |
| 821 | } |
| 822 | parser.marks = append(parser.marks, token.start_mark) |
| 823 | skip_token(parser) |
| 824 | } |
| 825 | |
| 826 | token := peek_token(parser) |
| 827 | if token == nil { |
| 828 | return false |
| 829 | } |
| 830 | |
| 831 | // [Go] A tail comment was left from the prior mapping value processed. Emit an event |
| 832 | // as it needs to be processed with that value and not the following key. |
| 833 | if len(parser.tail_comment) > 0 { |
| 834 | *event = yaml_event_t{ |
| 835 | typ: yaml_TAIL_COMMENT_EVENT, |
| 836 | start_mark: token.start_mark, |
| 837 | end_mark: token.end_mark, |
| 838 | foot_comment: parser.tail_comment, |
| 839 | } |
| 840 | parser.tail_comment = nil |
| 841 | return true |
| 842 | } |
| 843 | |
| 844 | if token.typ == yaml_KEY_TOKEN { |
| 845 | mark := token.end_mark |
| 846 | skip_token(parser) |
| 847 | token = peek_token(parser) |
| 848 | if token == nil { |
| 849 | return false |
| 850 | } |
| 851 | if token.typ != yaml_KEY_TOKEN && |
| 852 | token.typ != yaml_VALUE_TOKEN && |
| 853 | token.typ != yaml_BLOCK_END_TOKEN { |
| 854 | parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_VALUE_STATE) |
| 855 | return yaml_parser_parse_node(parser, event, true, true) |
| 856 | } else { |
| 857 | parser.state = yaml_PARSE_BLOCK_MAPPING_VALUE_STATE |
| 858 | return yaml_parser_process_empty_scalar(parser, event, mark) |
| 859 | } |
| 860 | } else if token.typ == yaml_BLOCK_END_TOKEN { |
| 861 | parser.state = parser.states[len(parser.states)-1] |
| 862 | parser.states = parser.states[:len(parser.states)-1] |
| 863 | parser.marks = parser.marks[:len(parser.marks)-1] |
| 864 | *event = yaml_event_t{ |
| 865 | typ: yaml_MAPPING_END_EVENT, |
| 866 | start_mark: token.start_mark, |
| 867 | end_mark: token.end_mark, |
| 868 | } |
| 869 | yaml_parser_set_event_comments(parser, event) |
| 870 | skip_token(parser) |
| 871 | return true |
| 872 | } |
| 873 |
no test coverage detected
searching dependent graphs…