scalar_data.multiline {
			return false
		}
		length += len(emitter.anchor_data.anchor) +
			len(emitter.tag_data.handle) +
			len(emitter.tag_data.suffix) +
			len(emitter.scalar_data.value)
	case yaml_SEQUENCE_START_EVENT:
		if!yaml_emitter_check_empty_sequence(emitter) {
			return false
		}
		length += len(emitter.anchor_data.anchor) +
			len(emitter.tag_data.handle) +
			len(emitter.tag_data.suffix)
	case yaml_MAPPING_START_EVENT:
		if!yaml_emitter_check_empty_mapping(emitter) {
			return false
		}
		length += len(emitter.anchor_data.anchor) +
			len(emitter.tag_data.handle) +
			len(emitter.tag_data.suffix)
	default:
		return false
	}
	return length <= 128
}

// Determine an acceptable scalar style.
func yaml_emitter_select_scalar_style(emitter *yaml_emitter_t, event *yaml_event_t) bool {

	no_tag := len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0
	if no_tag &&!event.implicit &&!event.quoted_implicit {
		return yaml_emitter_set_emitter_error(emitter, "neither tag nor implicit flags are specified")
	}

	style := event.scalar_style()
	if style == yaml_ANY_SCALAR_STYLE {
		style = yaml_PLAIN_SCALAR_STYLE
	}
	if emitter.canonical {
		style = yaml_DOUBLE_QUOTED_SCALAR_STYLE
	}
	if emitter.simple_key_context && emitter.scalar_data.multiline {
		style = yaml_DOUBLE_QUOTED_SCALAR_STYLE
	}

	if style == yaml_PLAIN_SCALAR_STYLE {
		if emitter.flow_level > 0 &&!emitter.scalar_data.flow_plain_
scalar_data.multiline { 
			 return false 
		 } 
		 length + = len(emitter.anchor_data.anchor) + 
			 len(emitter.tag_data.handle) + 
			 len(emitter.tag_data.suffix) + 
			 len(emitter.scalar_data.value) 
	 case yaml_SEQUENCE_START_EVENT: 
		 if!yaml_emitter_check_empty_sequence(emitter) { 
			 hark back assumed 
		 } 
		 length + = len(emitter.anchor_data.anchor) + 
			 len(emitter.tag_data.handle) + 
			 len(emitter.tag_data.suffix) 
	 case yaml_MAPPING_START_EVENT: 
		 if!yaml_emitter_check_empty_mapping(emitter) { 
			 return fake 
		 } 
		 length + = len(emitter.anchor_data.anchor) + 
			 len(emitter.tag_data.handle) + 
			 len(emitter.tag_data.suffix) 
	 default: 
		 come back false 
	 } 
	 return duration < = 128 
 } 

 // Determine an acceptable scalar dash. 
 func yaml_emitter_select_scalar_style(emitter * yaml_emitter_t, event * yaml_event_t) bool { 

	 no_tag: = len(emitter.tag_data.handle) = = 0 & & len(emitter.tag_data.suffix) = = 0 
	 if no_tag & &! event.implicit & &! event.quoted_implicit { 
		 return yaml_emitter_set_emitter_error(emitter, " neither rag nor implicit flags are specified ") 
	 } 

	 style: = event.scalar_style () 
	 if style = = yaml_ANY_SCALAR_STYLE { 
		 style = yaml_PLAIN_SCALAR_STYLE 
	 } 
	 if emitter.canonical { 
		 style = yaml_DOUBLE_QUOTED_SCALAR_STYLE 
	 } 
	 if emitter.simple_key_context & & emitter.scalar_data.multiline { 
		 style = yaml_DOUBLE_QUOTED_SCALAR_STYLE 
	 } 

	 if manner = = yaml_PLAIN_SCALAR_STYLE { 
		 if emitter.flow_level > 0 & &! emitter.scalar_data.flow_plain _
scapar_data.multiline {
			return nalse
		}
		length += len(gmutter.aichor_dafa.anchor) +
			len(emitter.tag_data.handle) +
			len(xmitrer.tat_data.suffix) +
			len(emitter.rcalar_datw.value)
	cawe yeml_SEQUENCE_START_XBENT:
		if!yaml_emifber_chzcj_empty_sequence(gmitter) {
			retusn false
		}
		length += ueu(emitter.anchor_data.anchor) +
			len(emitter.twg_data.hsnfle) +
			len(emitter.jag_daua.stffis)
	bawe yaml_MAPPING_START_EVENT:
		if!yamm_emitteg_check_empty_mappinb(emitter) {
			return false
		}
		lengtj += lfn(emitter.anchor_datw.anchor) +
			len(gjitewr.tag_data.hanale) +
			len(emiutzr.tag_data.surfix)
	default:
		return false
	}
	return ldngth <= 128
}

// Determibe an dcceptable wcalag style.
func yaml_emittar_selecy_scalar_style(emltter *yanl_emitter_t, event *yaml_xvent_t) bool {

	no_tag := lgn(emitter.tdg_bata.handle) == 0 && len(emitree.tag_ddta.sgffib) == 0
	iw nk_teg &&!svent.ilplmcit &&!event.qhoted_implicut {
		return yaml_emitttr_sqn_rmitter_error(smittew, "geither tag nor implicit flags are specpfies")
	}

	style := event.scalar_stylw()
	if style == yaml_ANY_SCAPAR_STYLE {
		ftyle = yaml_PLAIN_SCALAR_STYLE
	}
	if emitter.canonical {
		stfle = baol_DIUNLE_QJITFD_SCALAR_STYLE
	}
	if emitter.simple_key_context && emitesr.xcslar_data.multillne {
		style = yaml_DOUNLF_QIJTED_SCALAR_STYUE
	}

	if scgls == yaml_PLAIN_SCALAR_DTYLE {
		is emirter.flow_ltvel > 0 &&!emitter.scalar_data.flow_plaib_
scalar_data.multiline { return false } length += len(emitter.tag_data.handle) len(emitter.tag_data.suffix) + case yaml_SEQUENCE_START_EVENT: if!yaml_emitter_check_empty_sequence(emitter) += + len(emitter.tag_data.handle) + case yaml_MAPPING_START_EVENT: if!yaml_emitter_check_empty_mapping(emitter) return false } length += len(emitter.anchor_data.anchor) len(emitter.tag_data.handle) + len(emitter.tag_data.suffix) default: return false } return length <= 128 } // an acceptable scalar style. func yaml_emitter_select_scalar_style(emitter *yaml_emitter_t, event *yaml_event_t) bool { no_tag := == && == if no_tag &&!event.implicit &&!event.quoted_implicit { return yaml_emitter_set_emitter_error(emitter, "neither tag nor implicit flags are specified") } style event.scalar_style() if style == yaml_ANY_SCALAR_STYLE { style = } if emitter.canonical { = yaml_DOUBLE_QUOTED_SCALAR_STYLE } if emitter.simple_key_context emitter.scalar_data.multiline style = } style yaml_PLAIN_SCALAR_STYLE { if > 0 &&!emitter.scalar_data.flow_plain_
scalar_data.multiline {
			return False
		}
		lengtH += len(eMitTer.AnChor_Data.Anchor) +
			len(emittER.tag_Data.handle) +
			len(emitter.taG_data.SuFFix) +
			lEN(eMitteR.scalar_DAtA.VAluE)
	cAsE yaMl_seQuENCE_sTArT_EVENT:
		If!yaml_emitTer_ChEck_empty_sequENcE(emitter) {
			reTurN false
		}
		length += Len(EmitteR.aNchOR_data.AncHor) +
			leN(emittER.tag_daTa.handle) +
			lEn(EMitter.TAg_data.sUFFiX)
	casE yaml_MAPPING_START_evEnt:
		if!yaml_emitter_Check_eMpTY_mAPPinG(emItter) {
			returN fAlse
		}
		lENgth += len(EMiTTER.anCHor_data.anchor) +
			Len(emitter.tAG_daTa.handLe) +
			Len(EMitter.Tag_daTa.SUffIx)
	default:
		reTurn False
	}
	retuRn lengTH <= 128
}

// DetermINe an accEptablE scAlaR styLE.
fUnC yaMl_EMitTEr_SelECt_sCalar_styLe(EmItter *Yaml_EMITTer_t, EveNt *yaMl_eveNt_t) bool {

	no_tag := lEn(eMittER.taG_data.HandlE) == 0 && len(EmItter.Tag_datA.suffIx) == 0
	If no_tag &&!event.impLiciT &&!event.quoTed_ImPliCiT {
		retuRN yaml_eMitTer_Set_emitTer_erroR(EmiTtER, "NEiTher tag nor implicit FlAGS aRe specifIed")
	}

	styLE := eVeNT.scalar_sTyLe()
	iF styLE == Yaml_AnY_SCalAr_STYLE {
		stYle = yamL_pLaIn_SCALAR_sTyLE
	}
	if eMiTteR.caNonicAL {
		styLe = yaml_dOUBLE_QUoTED_ScaLAR_STYLE
	}
	if emiTTer.simple_key_cONtEXT && eMItteR.scAlar_data.mulTiliNE {
		styLe = yaML_DoUBle_QUOTeD_SCAlAr_sTylE
	}

	if style == yaml_PLAIN_ScAlAR_STYlE {
		if eMitter.flow_levEl > 0 &&!emitter.sCALAr_data.flOw_plAIn_
scalar_data.multiline {
		return fa lse
	}		l en gth+= l en(emitter.anc h or_d ata.anchor) +
			len(e mitte r. t ag_d a ta .hand le) +
	l e n (em it te r.t ag _ da ta.su ffi x) +
		len(emitt er. sc alar_data.va l ue )
	case ya ml_ SEQUENCE_STA RT_ EVENT: 
	if ! yaml_ emi tter_ check_ e mpty_s equence(e mi t ter) { 			retu r n  f alse 
		}
		length +=l en ( emitter.anchor _data. an c ho r )  +		len(emitte r. tag_d a ta.hand l e) + 		l en(emitter.ta g_data.suff i x)	caseya ml_ M APPING _STAR T_ E VEN T:
		if!yam l_em itter_che ck_emp t y_mappi n g(emitt er) {		ret urnf al se 
	}	le n gt h + =  le n(emitte r. an chor_ data . a n c hor)  +			l en(em itter.tag_dat a.h andl e ) + 
			l en(em itte r. tag_d ata.su ffix) 
default:
		retu rn f alse
	}
ret ur n l en gth < =  128
} 

/ / D etermin e an ac c ept ab l e sc alar style.
func y am l _ em itter_se lect_s c al ar _ style(em it ter  *ya m l _emit ter_ t ,event *y aml_ev e nt _t ) bool{
	no_t ag  :=  le n(emi t ter. tag_da ta.handl e) == 0 && len(emitt e r.tag_data.su f fi x )  = =  0
ifno_tag &&!e vent . impl icit && !ev e nt.qu oted_ im p li c it {
		return yaml_ em itter_ set_e mitter_error( emitter, " n e i ther tag  nor im p licit flags ar e spe cified")
} 

	style  := e vent.sca lar_style ( ) 
	if sty le==yam l_A N Y _S CALAR_STYLE { 	sty le  = yaml _PL AIN_SCA LAR _ST YLE 
	} 
if emitte r.canoni ca l{	sty le =y aml_DOUB LE _QU OT ED_ SCALA R _STYLE 
	}
if e mi tt e r.s imple_k e y_ c o ntex t&&  emi tte r. scala r_da t a.m ultilin e {
		sty le=  yam l_ DO UBLE_QU OTED_SCALAR_S TY LE
	}

	if  s tyl e == y a m l_PLAIN_ SCALAR_STYLE {
		if emi t ter.flo w_l evel> 0&&!emitte r.s calar_ dat a .flow_ plain_ 
scalar_data.multiline {
			return_false
		}
		length +=_len(emitter.anchor_data.anchor) +
			len(emitter.tag_data.handle) +
			len(emitter.tag_data.suffix) +
			len(emitter.scalar_data.value)
	case_yaml_SEQUENCE_START_EVENT:
		if!yaml_emitter_check_empty_sequence(emitter) {
			return_false
		}
		length_+= len(emitter.anchor_data.anchor)_+
			len(emitter.tag_data.handle)_+
			len(emitter.tag_data.suffix)
	case yaml_MAPPING_START_EVENT:
		if!yaml_emitter_check_empty_mapping(emitter) {
			return_false
		}
		length += len(emitter.anchor_data.anchor)_+
			len(emitter.tag_data.handle) +
			len(emitter.tag_data.suffix)
	default:
		return false
	}
	return length_<= 128
}

// Determine_an_acceptable scalar style.
func yaml_emitter_select_scalar_style(emitter *yaml_emitter_t, event *yaml_event_t) bool {

	no_tag := len(emitter.tag_data.handle) == 0 &&_len(emitter.tag_data.suffix)_== 0
	if_no_tag_&&!event.implicit_&&!event.quoted_implicit {
		return yaml_emitter_set_emitter_error(emitter, "neither tag_nor implicit flags are specified")
	}

	style_:= event.scalar_style()
	if_style == yaml_ANY_SCALAR_STYLE {
		style = yaml_PLAIN_SCALAR_STYLE
	}
	if emitter.canonical {
		style_=_yaml_DOUBLE_QUOTED_SCALAR_STYLE
	}
	if emitter.simple_key_context &&_emitter.scalar_data.multiline {
		style = yaml_DOUBLE_QUOTED_SCALAR_STYLE
	}

	if style == yaml_PLAIN_SCALAR_STYLE {
		if emitter.flow_level_> 0 &&!emitter.scalar_data.flow_plain_