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

Function yaml_parser_parse_flow_mapping_value

parserc.go:1133–1155  ·  view source on GitHub ↗

Parse the productions: flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? * ***** *

(parser *yaml_parser_t, event *yaml_event_t, empty bool)

Source from the content-addressed store, hash-verified

1131// * ***** *
1132//
1133func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, event *yaml_event_t, empty bool) bool {
1134 token := peek_token(parser)
1135 if token == nil {
1136 return false
1137 }
1138 if empty {
1139 parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE
1140 return yaml_parser_process_empty_scalar(parser, event, token.start_mark)
1141 }
1142 if token.typ == yaml_VALUE_TOKEN {
1143 skip_token(parser)
1144 token = peek_token(parser)
1145 if token == nil {
1146 return false
1147 }
1148 if token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_MAPPING_END_TOKEN {
1149 parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_KEY_STATE)
1150 return yaml_parser_parse_node(parser, event, false, false)
1151 }
1152 }
1153 parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE
1154 return yaml_parser_process_empty_scalar(parser, event, token.start_mark)
1155}
1156
1157// Generate an empty scalar event.
1158func yaml_parser_process_empty_scalar(parser *yaml_parser_t, event *yaml_event_t, mark yaml_mark_t) bool {

Callers 1

Calls 4

peek_tokenFunction · 0.85
skip_tokenFunction · 0.85
yaml_parser_parse_nodeFunction · 0.85

Tested by

no test coverage detected