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

Function yaml_emitter_emit_node

emitterc.go:855–876  ·  view source on GitHub ↗

Expect a node.

(emitter *yaml_emitter_t, event *yaml_event_t,
	root bool, sequence bool, mapping bool, simple_key bool)

Source from the content-addressed store, hash-verified

853
854// Expect a node.
855func yaml_emitter_emit_node(emitter *yaml_emitter_t, event *yaml_event_t,
856 root bool, sequence bool, mapping bool, simple_key bool) bool {
857
858 emitter.root_context = root
859 emitter.sequence_context = sequence
860 emitter.mapping_context = mapping
861 emitter.simple_key_context = simple_key
862
863 switch event.typ {
864 case yaml_ALIAS_EVENT:
865 return yaml_emitter_emit_alias(emitter, event)
866 case yaml_SCALAR_EVENT:
867 return yaml_emitter_emit_scalar(emitter, event)
868 case yaml_SEQUENCE_START_EVENT:
869 return yaml_emitter_emit_sequence_start(emitter, event)
870 case yaml_MAPPING_START_EVENT:
871 return yaml_emitter_emit_mapping_start(emitter, event)
872 default:
873 return yaml_emitter_set_emitter_error(emitter,
874 fmt.Sprintf("expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS, but got %v", event.typ))
875 }
876}
877
878// Expect ALIAS.
879func yaml_emitter_emit_alias(emitter *yaml_emitter_t, event *yaml_event_t) bool {

Tested by

no test coverage detected