Parse the productions: flow_sequence ::= FLOW-SEQUENCE-START ******************* (flow_sequence_entry FLOW-ENTRY)* * ********** flow_sequence_entry? * FLOW-SEQUENCE-END ***************** flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? *
(parser *yaml_parser_t, event *yaml_event_t, first bool)
| 926 | // * |
| 927 | // |
| 928 | func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { |
| 929 | if first { |
| 930 | token := peek_token(parser) |
| 931 | if token == nil { |
| 932 | return false |
| 933 | } |
| 934 | parser.marks = append(parser.marks, token.start_mark) |
| 935 | skip_token(parser) |
| 936 | } |
| 937 | token := peek_token(parser) |
| 938 | if token == nil { |
| 939 | return false |
| 940 | } |
| 941 | if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { |
| 942 | if !first { |
| 943 | if token.typ == yaml_FLOW_ENTRY_TOKEN { |
| 944 | skip_token(parser) |
| 945 | token = peek_token(parser) |
| 946 | if token == nil { |
| 947 | return false |
| 948 | } |
| 949 | } else { |
| 950 | context_mark := parser.marks[len(parser.marks)-1] |
| 951 | parser.marks = parser.marks[:len(parser.marks)-1] |
| 952 | return yaml_parser_set_parser_error_context(parser, |
| 953 | "while parsing a flow sequence", context_mark, |
| 954 | "did not find expected ',' or ']'", token.start_mark) |
| 955 | } |
| 956 | } |
| 957 | |
| 958 | if token.typ == yaml_KEY_TOKEN { |
| 959 | parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE |
| 960 | *event = yaml_event_t{ |
| 961 | typ: yaml_MAPPING_START_EVENT, |
| 962 | start_mark: token.start_mark, |
| 963 | end_mark: token.end_mark, |
| 964 | implicit: true, |
| 965 | style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), |
| 966 | } |
| 967 | skip_token(parser) |
| 968 | return true |
| 969 | } else if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { |
| 970 | parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE) |
| 971 | return yaml_parser_parse_node(parser, event, false, false) |
| 972 | } |
| 973 | } |
| 974 | |
| 975 | parser.state = parser.states[len(parser.states)-1] |
| 976 | parser.states = parser.states[:len(parser.states)-1] |
| 977 | parser.marks = parser.marks[:len(parser.marks)-1] |
| 978 | |
| 979 | *event = yaml_event_t{ |
| 980 | typ: yaml_SEQUENCE_END_EVENT, |
| 981 | start_mark: token.start_mark, |
| 982 | end_mark: token.end_mark, |
| 983 | } |
| 984 | yaml_parser_set_event_comments(parser, event) |
| 985 |
no test coverage detected