| 146 | | /* Write 'type'. */ |
| 147 | | |
| 148 | | if (!yaml_scalar_event_initialize(&output_event, |
| 149 | | NULL, "tag:yaml.org,2002:str", "type", -1, |
| 150 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 151 | | goto event_error; |
| 152 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 153 | | goto emitter_error; |
| 154 | | |
| 155 | | /* Write 'STREAM-START'. */ |
| 156 | | |
| 157 | | if (!yaml_scalar_event_initialize(&output_event, |
| 158 | | NULL, "tag:yaml.org,2002:str", "STREAM-START", -1, |
| 159 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 160 | | goto event_error; |
| 161 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 162 | | goto emitter_error; |
| 163 | | |
| 164 | | /* Display encoding information. */ |
| | 141 | /* Add 'type': 'STREAM-START'. */ |
| | 142 | |
| | 143 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 144 | "type", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 145 | if (!key) goto document_error; |
| | 146 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 147 | "STREAM-START", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 148 | if (!value) goto document_error; |
| | 149 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 150 | properties, key, value)) goto document_error; |
| | 151 | |
| | 152 | /* Add 'encoding': <encoding>. */ |
| 171 | | /* Write 'encoding'. */ |
| 172 | | |
| 173 | | if (!yaml_scalar_event_initialize(&output_event, |
| 174 | | NULL, "tag:yaml.org,2002:str", "encoding", -1, |
| 175 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 176 | | goto event_error; |
| 177 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 178 | | goto emitter_error; |
| 179 | | |
| 180 | | /* Write the stream encoding. */ |
| 181 | | |
| 182 | | if (!yaml_scalar_event_initialize(&output_event, |
| 183 | | NULL, "tag:yaml.org,2002:str", |
| 184 | | (encoding == YAML_UTF8_ENCODING ? "utf-8" : |
| 185 | | encoding == YAML_UTF16LE_ENCODING ? "utf-16-le" : |
| 186 | | encoding == YAML_UTF16BE_ENCODING ? "utf-16-be" : |
| 187 | | "unknown"), -1, |
| 188 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 189 | | goto event_error; |
| 190 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 191 | | goto emitter_error; |
| 192 | | } |
| 193 | | |
| | 159 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 160 | "encoding", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 161 | if (!key) goto document_error; |
| | 162 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 163 | (encoding == YAML_UTF8_ENCODING ? "utf-8" : |
| | 164 | encoding == YAML_UTF16LE_ENCODING ? "utf-16-le" : |
| | 165 | encoding == YAML_UTF16BE_ENCODING ? "utf-16-be" : |
| | 166 | "unknown"), -1, YAML_PLAIN_SCALAR_STYLE); |
| | 167 | if (!value) goto document_error; |
| | 168 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 169 | properties, key, value)) goto document_error; |
| | 170 | } |
| | 171 | |
| 198 | | /* Write 'type'. */ |
| 199 | | |
| 200 | | if (!yaml_scalar_event_initialize(&output_event, |
| 201 | | NULL, "tag:yaml.org,2002:str", "type", -1, |
| 202 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 203 | | goto event_error; |
| 204 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 205 | | goto emitter_error; |
| 206 | | |
| 207 | | /* Write 'STREAM-END'. */ |
| 208 | | |
| 209 | | if (!yaml_scalar_event_initialize(&output_event, |
| 210 | | NULL, "tag:yaml.org,2002:str", "STREAM-END", -1, |
| 211 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 212 | | goto event_error; |
| 213 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 214 | | goto emitter_error; |
| | 176 | /* Add 'type': 'STREAM-END'. */ |
| | 177 | |
| | 178 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 179 | "type", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 180 | if (!key) goto document_error; |
| | 181 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 182 | "STREAM-END", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 183 | if (!value) goto document_error; |
| | 184 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 185 | properties, key, value)) goto document_error; |
| 220 | | /* Write 'type'. */ |
| 221 | | |
| 222 | | if (!yaml_scalar_event_initialize(&output_event, |
| 223 | | NULL, "tag:yaml.org,2002:str", "type", -1, |
| 224 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 225 | | goto event_error; |
| 226 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 227 | | goto emitter_error; |
| 228 | | |
| 229 | | /* Write 'DOCUMENT-START'. */ |
| 230 | | |
| 231 | | if (!yaml_scalar_event_initialize(&output_event, |
| 232 | | NULL, "tag:yaml.org,2002:str", "DOCUMENT-START", -1, |
| 233 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 234 | | goto event_error; |
| 235 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 236 | | goto emitter_error; |
| 237 | | |
| 238 | | /* Display the document version numbers. */ |
| | 191 | /* Add 'type': 'DOCUMENT-START'. */ |
| | 192 | |
| | 193 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 194 | "type", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 195 | if (!key) goto document_error; |
| | 196 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 197 | "DOCUMENT-START", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 198 | if (!value) goto document_error; |
| | 199 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 200 | properties, key, value)) goto document_error; |
| | 201 | |
| | 202 | /* Display the output_document version numbers. */ |
| 248 | | if (!yaml_scalar_event_initialize(&output_event, |
| 249 | | NULL, "tag:yaml.org,2002:str", "version", -1, |
| 250 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 251 | | goto event_error; |
| 252 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 253 | | goto emitter_error; |
| 254 | | |
| 255 | | /* Write '{'. */ |
| 256 | | |
| 257 | | if (!yaml_mapping_start_event_initialize(&output_event, |
| 258 | | NULL, "tag:yaml.org,2002:map", 1, |
| 259 | | YAML_FLOW_MAPPING_STYLE)) |
| 260 | | goto event_error; |
| 261 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 262 | | goto emitter_error; |
| 263 | | |
| 264 | | /* Write 'major'. */ |
| 265 | | |
| 266 | | if (!yaml_scalar_event_initialize(&output_event, |
| 267 | | NULL, "tag:yaml.org,2002:str", "major", -1, |
| 268 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 269 | | goto event_error; |
| 270 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 271 | | goto emitter_error; |
| 272 | | |
| 273 | | /* Write a number. */ |
| 274 | | |
| | 212 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 213 | "version", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 214 | if (!key) goto document_error; |
| | 215 | map = yaml_document_add_mapping(&output_document, NULL, |
| | 216 | YAML_FLOW_MAPPING_STYLE); |
| | 217 | if (!map) goto document_error; |
| | 218 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 219 | properties, key, map)) goto document_error; |
| | 220 | |
| | 221 | /* Add 'major': <number>. */ |
| | 222 | |
| | 223 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 224 | "major", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 225 | if (!key) goto document_error; |
| 276 | | if (!yaml_scalar_event_initialize(&output_event, |
| 277 | | NULL, "tag:yaml.org,2002:int", number, -1, |
| 278 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 279 | | goto event_error; |
| 280 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 281 | | goto emitter_error; |
| 282 | | |
| 283 | | /* Write 'minor'. */ |
| 284 | | |
| 285 | | if (!yaml_scalar_event_initialize(&output_event, |
| 286 | | NULL, "tag:yaml.org,2002:str", "minor", -1, |
| 287 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 288 | | goto event_error; |
| 289 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 290 | | goto emitter_error; |
| 291 | | |
| 292 | | /* Write a number. */ |
| 293 | | |
| | 227 | value = yaml_document_add_scalar(&output_document, YAML_INT_TAG, |
| | 228 | number, -1, YAML_PLAIN_SCALAR_STYLE); |
| | 229 | if (!value) goto document_error; |
| | 230 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 231 | map, key, value)) goto document_error; |
| | 232 | |
| | 233 | /* Add 'minor': <number>. */ |
| | 234 | |
| | 235 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 236 | "minor", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 237 | if (!key) goto document_error; |
| 319 | | if (!yaml_scalar_event_initialize(&output_event, |
| 320 | | NULL, "tag:yaml.org,2002:str", "tags", -1, |
| 321 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 322 | | goto event_error; |
| 323 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 324 | | goto emitter_error; |
| 325 | | |
| 326 | | /* Start a block sequence. */ |
| 327 | | |
| 328 | | if (!yaml_sequence_start_event_initialize(&output_event, |
| 329 | | NULL, "tag:yaml.org,2002:seq", 1, |
| 330 | | YAML_BLOCK_SEQUENCE_STYLE)) |
| 331 | | goto event_error; |
| 332 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 333 | | goto emitter_error; |
| | 255 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 256 | "tags", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 257 | if (!key) goto document_error; |
| | 258 | seq = yaml_document_add_sequence(&output_document, NULL, |
| | 259 | YAML_BLOCK_SEQUENCE_STYLE); |
| | 260 | if (!seq) goto document_error; |
| | 261 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 262 | properties, key, seq)) goto document_error; |
| 339 | | /* Write '{'. */ |
| 340 | | |
| 341 | | if (!yaml_mapping_start_event_initialize(&output_event, |
| 342 | | NULL, "tag:yaml.org,2002:map", 1, |
| 343 | | YAML_FLOW_MAPPING_STYLE)) |
| 344 | | goto event_error; |
| 345 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 346 | | goto emitter_error; |
| 347 | | |
| 348 | | /* Write 'handle'. */ |
| 349 | | |
| 350 | | if (!yaml_scalar_event_initialize(&output_event, |
| 351 | | NULL, "tag:yaml.org,2002:str", "handle", -1, |
| 352 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 353 | | goto event_error; |
| 354 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 355 | | goto emitter_error; |
| 356 | | |
| 357 | | /* Write the tag directive handle. */ |
| 358 | | |
| 359 | | if (!yaml_scalar_event_initialize(&output_event, |
| 360 | | NULL, "tag:yaml.org,2002:str", |
| 361 | | tag->handle, -1, |
| 362 | | 0, 1, YAML_DOUBLE_QUOTED_SCALAR_STYLE)) |
| 363 | | goto event_error; |
| 364 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 365 | | goto emitter_error; |
| 366 | | |
| 367 | | /* Write 'prefix'. */ |
| 368 | | |
| 369 | | if (!yaml_scalar_event_initialize(&output_event, |
| 370 | | NULL, "tag:yaml.org,2002:str", "prefix", -1, |
| 371 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 372 | | goto event_error; |
| 373 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 374 | | goto emitter_error; |
| 375 | | |
| 376 | | /* Write the tag directive prefix. */ |
| 377 | | |
| 378 | | if (!yaml_scalar_event_initialize(&output_event, |
| 379 | | NULL, "tag:yaml.org,2002:str", |
| 380 | | tag->prefix, -1, |
| 381 | | 0, 1, YAML_DOUBLE_QUOTED_SCALAR_STYLE)) |
| 382 | | goto event_error; |
| 383 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 384 | | goto emitter_error; |
| 385 | | |
| 386 | | /* Write '}'. */ |
| 387 | | |
| 388 | | if (!yaml_mapping_end_event_initialize(&output_event)) |
| 389 | | goto event_error; |
| 390 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 391 | | goto emitter_error; |
| 392 | | } |
| 393 | | |
| 394 | | /* End a block sequence. */ |
| 395 | | |
| 396 | | if (!yaml_sequence_end_event_initialize(&output_event)) |
| 397 | | goto event_error; |
| 398 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 399 | | goto emitter_error; |
| 400 | | } |
| 401 | | |
| 402 | | /* Write 'implicit'. */ |
| 403 | | |
| 404 | | if (!yaml_scalar_event_initialize(&output_event, |
| 405 | | NULL, "tag:yaml.org,2002:str", "implicit", -1, |
| 406 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 407 | | goto event_error; |
| 408 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 409 | | goto emitter_error; |
| 410 | | |
| 411 | | /* Write if the document is implicit. */ |
| 412 | | |
| 413 | | if (!yaml_scalar_event_initialize(&output_event, |
| 414 | | NULL, "tag:yaml.org,2002:bool", |
| 415 | | (input_event.data.document_start.implicit ? |
| 416 | | "true" : "false"), -1, |
| 417 | | 1, 0, YAML_PLAIN_SCALAR_STYLE)) |
| 418 | | goto event_error; |
| 419 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 420 | | goto emitter_error; |
| | 268 | /* Add {}. */ |
| | 269 | |
| | 270 | map = yaml_document_add_mapping(&output_document, NULL, |
| | 271 | YAML_FLOW_MAPPING_STYLE); |
| | 272 | if (!map) goto document_error; |
| | 273 | if (!yaml_document_append_sequence_item(&output_document, |
| | 274 | seq, map)) goto document_error; |
| | 275 | |
| | 276 | /* Add 'handle': <handle>. */ |
| | 277 | |
| | 278 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 279 | "handle", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 280 | if (!key) goto document_error; |
| | 281 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 282 | tag->handle, -1, YAML_DOUBLE_QUOTED_SCALAR_STYLE); |
| | 283 | if (!value) goto document_error; |
| | 284 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 285 | map, key, value)) goto document_error; |
| | 286 | |
| | 287 | /* Add 'prefix': <prefix>. */ |
| | 288 | |
| | 289 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 290 | "prefix", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 291 | if (!key) goto document_error; |
| | 292 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 293 | tag->prefix, -1, YAML_DOUBLE_QUOTED_SCALAR_STYLE); |
| | 294 | if (!value) goto document_error; |
| | 295 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 296 | map, key, value)) goto document_error; |
| | 297 | } |
| | 298 | } |
| | 299 | |
| | 300 | /* Add 'implicit': <flag>. */ |
| | 301 | |
| | 302 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 303 | "implicit", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 304 | if (!key) goto document_error; |
| | 305 | value = yaml_document_add_scalar(&output_document, YAML_BOOL_TAG, |
| | 306 | (input_event.data.document_start.implicit ? |
| | 307 | "true" : "false"), -1, YAML_PLAIN_SCALAR_STYLE); |
| | 308 | if (!value) goto document_error; |
| | 309 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 310 | properties, key, value)) goto document_error; |
| 426 | | /* Write 'type'. */ |
| 427 | | |
| 428 | | if (!yaml_scalar_event_initialize(&output_event, |
| 429 | | NULL, "tag:yaml.org,2002:str", "type", -1, |
| 430 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 431 | | goto event_error; |
| 432 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 433 | | goto emitter_error; |
| 434 | | |
| 435 | | /* Write 'DOCUMENT-END'. */ |
| 436 | | |
| 437 | | if (!yaml_scalar_event_initialize(&output_event, |
| 438 | | NULL, "tag:yaml.org,2002:str", "DOCUMENT-END", -1, |
| 439 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 440 | | goto event_error; |
| 441 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 442 | | goto emitter_error; |
| 443 | | |
| 444 | | /* Write 'implicit'. */ |
| 445 | | |
| 446 | | if (!yaml_scalar_event_initialize(&output_event, |
| 447 | | NULL, "tag:yaml.org,2002:str", "implicit", -1, |
| 448 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 449 | | goto event_error; |
| 450 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 451 | | goto emitter_error; |
| 452 | | |
| 453 | | /* Write if the document is implicit. */ |
| 454 | | |
| 455 | | if (!yaml_scalar_event_initialize(&output_event, |
| 456 | | NULL, "tag:yaml.org,2002:bool", |
| 457 | | (input_event.data.document_end.implicit ? |
| 458 | | "true" : "false"), -1, |
| 459 | | 1, 0, YAML_PLAIN_SCALAR_STYLE)) |
| 460 | | goto event_error; |
| 461 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 462 | | goto emitter_error; |
| | 316 | /* Add 'type': 'DOCUMENT-END'. */ |
| | 317 | |
| | 318 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 319 | "type", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 320 | if (!key) goto document_error; |
| | 321 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 322 | "DOCUMENT-END", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 323 | if (!value) goto document_error; |
| | 324 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 325 | properties, key, value)) goto document_error; |
| | 326 | |
| | 327 | /* Add 'implicit': <flag>. */ |
| | 328 | |
| | 329 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 330 | "implicit", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 331 | if (!key) goto document_error; |
| | 332 | value = yaml_document_add_scalar(&output_document, YAML_BOOL_TAG, |
| | 333 | (input_event.data.document_end.implicit ? |
| | 334 | "true" : "false"), -1, YAML_PLAIN_SCALAR_STYLE); |
| | 335 | if (!value) goto document_error; |
| | 336 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 337 | properties, key, value)) goto document_error; |
| 468 | | /* Write 'type'. */ |
| 469 | | |
| 470 | | if (!yaml_scalar_event_initialize(&output_event, |
| 471 | | NULL, "tag:yaml.org,2002:str", "type", -1, |
| 472 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 473 | | goto event_error; |
| 474 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 475 | | goto emitter_error; |
| 476 | | |
| 477 | | /* Write 'ALIAS'. */ |
| 478 | | |
| 479 | | if (!yaml_scalar_event_initialize(&output_event, |
| 480 | | NULL, "tag:yaml.org,2002:str", "ALIAS", -1, |
| 481 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 482 | | goto event_error; |
| 483 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 484 | | goto emitter_error; |
| 485 | | |
| 486 | | /* Write 'anchor'. */ |
| 487 | | |
| 488 | | if (!yaml_scalar_event_initialize(&output_event, |
| 489 | | NULL, "tag:yaml.org,2002:str", "anchor", -1, |
| 490 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 491 | | goto event_error; |
| 492 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 493 | | goto emitter_error; |
| 494 | | |
| 495 | | /* Write the alias anchor. */ |
| 496 | | |
| 497 | | if (!yaml_scalar_event_initialize(&output_event, |
| 498 | | NULL, "tag:yaml.org,2002:str", |
| 499 | | input_event.data.alias.anchor, -1, |
| 500 | | 0, 1, YAML_DOUBLE_QUOTED_SCALAR_STYLE)) |
| 501 | | goto event_error; |
| 502 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 503 | | goto emitter_error; |
| | 343 | /* Add 'type': 'ALIAS'. */ |
| | 344 | |
| | 345 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 346 | "type", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 347 | if (!key) goto document_error; |
| | 348 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 349 | "ALIAS", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 350 | if (!value) goto document_error; |
| | 351 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 352 | properties, key, value)) goto document_error; |
| | 353 | |
| | 354 | /* Add 'anchor': <anchor>. */ |
| | 355 | |
| | 356 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 357 | "anchor", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 358 | if (!key) goto document_error; |
| | 359 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 360 | input_event.data.alias.anchor, -1, |
| | 361 | YAML_DOUBLE_QUOTED_SCALAR_STYLE); |
| | 362 | if (!value) goto document_error; |
| | 363 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 364 | properties, key, value)) goto document_error; |
| 509 | | /* Write 'type'. */ |
| 510 | | |
| 511 | | if (!yaml_scalar_event_initialize(&output_event, |
| 512 | | NULL, "tag:yaml.org,2002:str", "type", -1, |
| 513 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 514 | | goto event_error; |
| 515 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 516 | | goto emitter_error; |
| 517 | | |
| 518 | | /* Write 'SCALAR'. */ |
| 519 | | |
| 520 | | if (!yaml_scalar_event_initialize(&output_event, |
| 521 | | NULL, "tag:yaml.org,2002:str", "SCALAR", -1, |
| 522 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 523 | | goto event_error; |
| 524 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 525 | | goto emitter_error; |
| 526 | | |
| 527 | | /* Display the scalar anchor. */ |
| | 370 | /* Add 'type': 'SCALAR'. */ |
| | 371 | |
| | 372 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 373 | "type", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 374 | if (!key) goto document_error; |
| | 375 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 376 | "SCALAR", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 377 | if (!value) goto document_error; |
| | 378 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 379 | properties, key, value)) goto document_error; |
| | 380 | |
| | 381 | /* Add 'anchor': <anchor>. */ |
| 531 | | /* Write 'anchor'. */ |
| 532 | | |
| 533 | | if (!yaml_scalar_event_initialize(&output_event, |
| 534 | | NULL, "tag:yaml.org,2002:str", "anchor", -1, |
| 535 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 536 | | goto event_error; |
| 537 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 538 | | goto emitter_error; |
| 539 | | |
| 540 | | /* Write the scalar anchor. */ |
| 541 | | |
| 542 | | if (!yaml_scalar_event_initialize(&output_event, |
| 543 | | NULL, "tag:yaml.org,2002:str", |
| 544 | | input_event.data.scalar.anchor, -1, |
| 545 | | 0, 1, YAML_DOUBLE_QUOTED_SCALAR_STYLE)) |
| 546 | | goto event_error; |
| 547 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 548 | | goto emitter_error; |
| 549 | | } |
| 550 | | |
| 551 | | /* Display the scalar tag. */ |
| | 385 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 386 | "anchor", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 387 | if (!key) goto document_error; |
| | 388 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 389 | input_event.data.scalar.anchor, -1, |
| | 390 | YAML_DOUBLE_QUOTED_SCALAR_STYLE); |
| | 391 | if (!value) goto document_error; |
| | 392 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 393 | properties, key, value)) goto document_error; |
| | 394 | } |
| | 395 | |
| | 396 | /* Add 'tag': <tag>. */ |
| 555 | | /* Write 'tag'. */ |
| 556 | | |
| 557 | | if (!yaml_scalar_event_initialize(&output_event, |
| 558 | | NULL, "tag:yaml.org,2002:str", "tag", -1, |
| 559 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 560 | | goto event_error; |
| 561 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 562 | | goto emitter_error; |
| 563 | | |
| 564 | | /* Write the scalar tag. */ |
| 565 | | |
| 566 | | if (!yaml_scalar_event_initialize(&output_event, |
| 567 | | NULL, "tag:yaml.org,2002:str", |
| 568 | | input_event.data.scalar.tag, -1, |
| 569 | | 0, 1, YAML_DOUBLE_QUOTED_SCALAR_STYLE)) |
| 570 | | goto event_error; |
| 571 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 572 | | goto emitter_error; |
| 573 | | } |
| 574 | | |
| 575 | | /* Display the scalar value. */ |
| 576 | | |
| 577 | | /* Write 'value'. */ |
| 578 | | |
| 579 | | if (!yaml_scalar_event_initialize(&output_event, |
| 580 | | NULL, "tag:yaml.org,2002:str", "value", -1, |
| 581 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 582 | | goto event_error; |
| 583 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 584 | | goto emitter_error; |
| 585 | | |
| 586 | | /* Write the scalar value. */ |
| 587 | | |
| 588 | | if (!yaml_scalar_event_initialize(&output_event, |
| 589 | | NULL, "tag:yaml.org,2002:str", |
| 590 | | input_event.data.scalar.value, |
| 591 | | input_event.data.scalar.length, |
| 592 | | 0, 1, YAML_DOUBLE_QUOTED_SCALAR_STYLE)) |
| 593 | | goto event_error; |
| 594 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 595 | | goto emitter_error; |
| | 400 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 401 | "tag", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 402 | if (!key) goto document_error; |
| | 403 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 404 | input_event.data.scalar.tag, -1, |
| | 405 | YAML_DOUBLE_QUOTED_SCALAR_STYLE); |
| | 406 | if (!value) goto document_error; |
| | 407 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 408 | properties, key, value)) goto document_error; |
| | 409 | } |
| | 410 | |
| | 411 | /* Add 'value': <value>. */ |
| | 412 | |
| | 413 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 414 | "value", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 415 | if (!key) goto document_error; |
| | 416 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 417 | input_event.data.scalar.value, |
| | 418 | input_event.data.scalar.length, |
| | 419 | YAML_DOUBLE_QUOTED_SCALAR_STYLE); |
| | 420 | if (!value) goto document_error; |
| | 421 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 422 | properties, key, value)) goto document_error; |
| 599 | | /* Write 'implicit'. */ |
| 600 | | |
| 601 | | if (!yaml_scalar_event_initialize(&output_event, |
| 602 | | NULL, "tag:yaml.org,2002:str", "implicit", -1, |
| 603 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 604 | | goto event_error; |
| 605 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 606 | | goto emitter_error; |
| 607 | | |
| 608 | | /* Write '{'. */ |
| 609 | | |
| 610 | | if (!yaml_mapping_start_event_initialize(&output_event, |
| 611 | | NULL, "tag:yaml.org,2002:map", 1, |
| 612 | | YAML_FLOW_MAPPING_STYLE)) |
| 613 | | goto event_error; |
| 614 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 615 | | goto emitter_error; |
| 616 | | |
| 617 | | /* Write 'plain'. */ |
| 618 | | |
| 619 | | if (!yaml_scalar_event_initialize(&output_event, |
| 620 | | NULL, "tag:yaml.org,2002:str", "plain", -1, |
| 621 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 622 | | goto event_error; |
| 623 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 624 | | goto emitter_error; |
| 625 | | |
| 626 | | /* Write if the scalar is implicit in the plain style. */ |
| 627 | | |
| 628 | | if (!yaml_scalar_event_initialize(&output_event, |
| 629 | | NULL, "tag:yaml.org,2002:bool", |
| 630 | | (input_event.data.scalar.plain_implicit ? |
| 631 | | "true" : "false"), -1, |
| 632 | | 1, 0, YAML_PLAIN_SCALAR_STYLE)) |
| 633 | | goto event_error; |
| 634 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 635 | | goto emitter_error; |
| 636 | | |
| 637 | | /* Write 'quoted'. */ |
| 638 | | |
| 639 | | if (!yaml_scalar_event_initialize(&output_event, |
| 640 | | NULL, "tag:yaml.org,2002:str", "non-plain", -1, |
| 641 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 642 | | goto event_error; |
| 643 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 644 | | goto emitter_error; |
| 645 | | |
| 646 | | /* Write if the scalar is implicit in a non-plain style. */ |
| 647 | | |
| 648 | | if (!yaml_scalar_event_initialize(&output_event, |
| 649 | | NULL, "tag:yaml.org,2002:bool", |
| 650 | | (input_event.data.scalar.quoted_implicit ? |
| 651 | | "true" : "false"), -1, |
| 652 | | 1, 0, YAML_PLAIN_SCALAR_STYLE)) |
| 653 | | goto event_error; |
| 654 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 655 | | goto emitter_error; |
| 656 | | |
| 657 | | /* Write '}'. */ |
| 658 | | |
| 659 | | if (!yaml_mapping_end_event_initialize(&output_event)) |
| 660 | | goto event_error; |
| 661 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 662 | | goto emitter_error; |
| | 426 | /* Add 'implicit': {} */ |
| | 427 | |
| | 428 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 429 | "version", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 430 | if (!key) goto document_error; |
| | 431 | map = yaml_document_add_mapping(&output_document, NULL, |
| | 432 | YAML_FLOW_MAPPING_STYLE); |
| | 433 | if (!map) goto document_error; |
| | 434 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 435 | properties, key, map)) goto document_error; |
| | 436 | |
| | 437 | /* Add 'plain': <flag>. */ |
| | 438 | |
| | 439 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 440 | "plain", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 441 | if (!key) goto document_error; |
| | 442 | value = yaml_document_add_scalar(&output_document, YAML_BOOL_TAG, |
| | 443 | (input_event.data.scalar.plain_implicit ? |
| | 444 | "true" : "false"), -1, YAML_PLAIN_SCALAR_STYLE); |
| | 445 | if (!value) goto document_error; |
| | 446 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 447 | map, key, value)) goto document_error; |
| | 448 | |
| | 449 | /* Add 'quoted': <flag>. */ |
| | 450 | |
| | 451 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 452 | "quoted", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 453 | if (!key) goto document_error; |
| | 454 | value = yaml_document_add_scalar(&output_document, YAML_BOOL_TAG, |
| | 455 | (input_event.data.scalar.quoted_implicit ? |
| | 456 | "true" : "false"), -1, YAML_PLAIN_SCALAR_STYLE); |
| | 457 | if (!value) goto document_error; |
| | 458 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 459 | map, key, value)) goto document_error; |
| 670 | | /* Write 'style'. */ |
| 671 | | |
| 672 | | if (!yaml_scalar_event_initialize(&output_event, |
| 673 | | NULL, "tag:yaml.org,2002:str", "style", -1, |
| 674 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 675 | | goto event_error; |
| 676 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 677 | | goto emitter_error; |
| 678 | | |
| 679 | | /* Write the scalar style. */ |
| 680 | | |
| 681 | | if (!yaml_scalar_event_initialize(&output_event, |
| 682 | | NULL, "tag:yaml.org,2002:str", |
| 683 | | (style == YAML_PLAIN_SCALAR_STYLE ? "plain" : |
| 684 | | style == YAML_SINGLE_QUOTED_SCALAR_STYLE ? |
| 685 | | "single-quoted" : |
| 686 | | style == YAML_DOUBLE_QUOTED_SCALAR_STYLE ? |
| 687 | | "double-quoted" : |
| 688 | | style == YAML_LITERAL_SCALAR_STYLE ? "literal" : |
| 689 | | style == YAML_FOLDED_SCALAR_STYLE ? "folded" : |
| 690 | | "unknown"), -1, |
| 691 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 692 | | goto event_error; |
| 693 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 694 | | goto emitter_error; |
| | 467 | /* Add 'style': <style>. */ |
| | 468 | |
| | 469 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 470 | "style", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 471 | if (!key) goto document_error; |
| | 472 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 473 | (style == YAML_PLAIN_SCALAR_STYLE ? "plain" : |
| | 474 | style == YAML_SINGLE_QUOTED_SCALAR_STYLE ? |
| | 475 | "single-quoted" : |
| | 476 | style == YAML_DOUBLE_QUOTED_SCALAR_STYLE ? |
| | 477 | "double-quoted" : |
| | 478 | style == YAML_LITERAL_SCALAR_STYLE ? "literal" : |
| | 479 | style == YAML_FOLDED_SCALAR_STYLE ? "folded" : |
| | 480 | "unknown"), -1, YAML_PLAIN_SCALAR_STYLE); |
| | 481 | if (!value) goto document_error; |
| | 482 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 483 | properties, key, value)) goto document_error; |
| 701 | | /* Write 'type'. */ |
| 702 | | |
| 703 | | if (!yaml_scalar_event_initialize(&output_event, |
| 704 | | NULL, "tag:yaml.org,2002:str", "type", -1, |
| 705 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 706 | | goto event_error; |
| 707 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 708 | | goto emitter_error; |
| 709 | | |
| 710 | | /* Write 'SEQUENCE-START'. */ |
| 711 | | |
| 712 | | if (!yaml_scalar_event_initialize(&output_event, |
| 713 | | NULL, "tag:yaml.org,2002:str", "SEQUENCE-START", -1, |
| 714 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 715 | | goto event_error; |
| 716 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 717 | | goto emitter_error; |
| 718 | | |
| 719 | | /* Display the sequence anchor. */ |
| | 490 | /* Add 'type': 'SEQUENCE-START'. */ |
| | 491 | |
| | 492 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 493 | "type", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 494 | if (!key) goto document_error; |
| | 495 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 496 | "SEQUENCE-START", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 497 | if (!value) goto document_error; |
| | 498 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 499 | properties, key, value)) goto document_error; |
| | 500 | |
| | 501 | /* Add 'anchor': <anchor>. */ |
| 723 | | /* Write 'anchor'. */ |
| 724 | | |
| 725 | | if (!yaml_scalar_event_initialize(&output_event, |
| 726 | | NULL, "tag:yaml.org,2002:str", "anchor", -1, |
| 727 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 728 | | goto event_error; |
| 729 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 730 | | goto emitter_error; |
| 731 | | |
| 732 | | /* Write the sequence anchor. */ |
| 733 | | |
| 734 | | if (!yaml_scalar_event_initialize(&output_event, |
| 735 | | NULL, "tag:yaml.org,2002:str", |
| 736 | | input_event.data.sequence_start.anchor, -1, |
| 737 | | 0, 1, YAML_DOUBLE_QUOTED_SCALAR_STYLE)) |
| 738 | | goto event_error; |
| 739 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 740 | | goto emitter_error; |
| 741 | | } |
| 742 | | |
| 743 | | /* Display the sequence tag. */ |
| | 505 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 506 | "anchor", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 507 | if (!key) goto document_error; |
| | 508 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 509 | input_event.data.sequence_start.anchor, -1, |
| | 510 | YAML_DOUBLE_QUOTED_SCALAR_STYLE); |
| | 511 | if (!value) goto document_error; |
| | 512 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 513 | properties, key, value)) goto document_error; |
| | 514 | } |
| | 515 | |
| | 516 | /* Add 'tag': <tag>. */ |
| 747 | | /* Write 'tag'. */ |
| 748 | | |
| 749 | | if (!yaml_scalar_event_initialize(&output_event, |
| 750 | | NULL, "tag:yaml.org,2002:str", "tag", -1, |
| 751 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 752 | | goto event_error; |
| 753 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 754 | | goto emitter_error; |
| 755 | | |
| 756 | | /* Write the sequence tag. */ |
| 757 | | |
| 758 | | if (!yaml_scalar_event_initialize(&output_event, |
| 759 | | NULL, "tag:yaml.org,2002:str", |
| 760 | | input_event.data.sequence_start.tag, -1, |
| 761 | | 0, 1, YAML_DOUBLE_QUOTED_SCALAR_STYLE)) |
| 762 | | goto event_error; |
| 763 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 764 | | goto emitter_error; |
| 765 | | } |
| 766 | | |
| 767 | | /* Write 'implicit'. */ |
| 768 | | |
| 769 | | if (!yaml_scalar_event_initialize(&output_event, |
| 770 | | NULL, "tag:yaml.org,2002:str", "implicit", -1, |
| 771 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 772 | | goto event_error; |
| 773 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 774 | | goto emitter_error; |
| 775 | | |
| 776 | | /* Write if the sequence tag is implicit. */ |
| 777 | | |
| 778 | | if (!yaml_scalar_event_initialize(&output_event, |
| 779 | | NULL, "tag:yaml.org,2002:bool", |
| 780 | | (input_event.data.sequence_start.implicit ? |
| 781 | | "true" : "false"), -1, |
| 782 | | 1, 0, YAML_PLAIN_SCALAR_STYLE)) |
| 783 | | goto event_error; |
| 784 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 785 | | goto emitter_error; |
| | 520 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 521 | "tag", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 522 | if (!key) goto document_error; |
| | 523 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 524 | input_event.data.sequence_start.tag, -1, |
| | 525 | YAML_DOUBLE_QUOTED_SCALAR_STYLE); |
| | 526 | if (!value) goto document_error; |
| | 527 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 528 | properties, key, value)) goto document_error; |
| | 529 | } |
| | 530 | |
| | 531 | /* Add 'implicit': <flag>. */ |
| | 532 | |
| | 533 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 534 | "implicit", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 535 | if (!key) goto document_error; |
| | 536 | value = yaml_document_add_scalar(&output_document, YAML_BOOL_TAG, |
| | 537 | (input_event.data.sequence_start.implicit ? |
| | 538 | "true" : "false"), -1, YAML_PLAIN_SCALAR_STYLE); |
| | 539 | if (!value) goto document_error; |
| | 540 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 541 | properties, key, value)) goto document_error; |
| 794 | | /* Write 'style'. */ |
| 795 | | |
| 796 | | if (!yaml_scalar_event_initialize(&output_event, |
| 797 | | NULL, "tag:yaml.org,2002:str", "style", -1, |
| 798 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 799 | | goto event_error; |
| 800 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 801 | | goto emitter_error; |
| 802 | | |
| 803 | | /* Write the scalar style. */ |
| 804 | | |
| 805 | | if (!yaml_scalar_event_initialize(&output_event, |
| 806 | | NULL, "tag:yaml.org,2002:str", |
| 807 | | (style == YAML_BLOCK_SEQUENCE_STYLE ? "block" : |
| 808 | | style == YAML_FLOW_SEQUENCE_STYLE ? "flow" : |
| 809 | | "unknown"), -1, |
| 810 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 811 | | goto event_error; |
| 812 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 813 | | goto emitter_error; |
| | 550 | /* Add 'style': <style>. */ |
| | 551 | |
| | 552 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 553 | "style", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 554 | if (!key) goto document_error; |
| | 555 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 556 | (style == YAML_BLOCK_SEQUENCE_STYLE ? "block" : |
| | 557 | style == YAML_FLOW_SEQUENCE_STYLE ? "flow" : |
| | 558 | "unknown"), -1, YAML_PLAIN_SCALAR_STYLE); |
| | 559 | if (!value) goto document_error; |
| | 560 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 561 | properties, key, value)) goto document_error; |
| 820 | | /* Write 'type'. */ |
| 821 | | |
| 822 | | if (!yaml_scalar_event_initialize(&output_event, |
| 823 | | NULL, "tag:yaml.org,2002:str", "type", -1, |
| 824 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 825 | | goto event_error; |
| 826 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 827 | | goto emitter_error; |
| 828 | | |
| 829 | | /* Write 'SEQUENCE-END'. */ |
| 830 | | |
| 831 | | if (!yaml_scalar_event_initialize(&output_event, |
| 832 | | NULL, "tag:yaml.org,2002:str", "SEQUENCE-END", -1, |
| 833 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 834 | | goto event_error; |
| 835 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 836 | | goto emitter_error; |
| | 568 | /* Add 'type': 'SEQUENCE-END'. */ |
| | 569 | |
| | 570 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 571 | "type", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 572 | if (!key) goto document_error; |
| | 573 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 574 | "SEQUENCE-END", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 575 | if (!value) goto document_error; |
| | 576 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 577 | properties, key, value)) goto document_error; |
| 842 | | /* Write 'type'. */ |
| 843 | | |
| 844 | | if (!yaml_scalar_event_initialize(&output_event, |
| 845 | | NULL, "tag:yaml.org,2002:str", "type", -1, |
| 846 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 847 | | goto event_error; |
| 848 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 849 | | goto emitter_error; |
| 850 | | |
| 851 | | /* Write 'MAPPING-START'. */ |
| 852 | | |
| 853 | | if (!yaml_scalar_event_initialize(&output_event, |
| 854 | | NULL, "tag:yaml.org,2002:str", "MAPPING-START", -1, |
| 855 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 856 | | goto event_error; |
| 857 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 858 | | goto emitter_error; |
| 859 | | |
| 860 | | /* Display the mapping anchor. */ |
| | 583 | /* Add 'type': 'MAPPING-START'. */ |
| | 584 | |
| | 585 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 586 | "type", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 587 | if (!key) goto document_error; |
| | 588 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 589 | "MAPPING-START", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 590 | if (!value) goto document_error; |
| | 591 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 592 | properties, key, value)) goto document_error; |
| | 593 | |
| | 594 | /* Add 'anchor': <anchor>. */ |
| 864 | | /* Write 'anchor'. */ |
| 865 | | |
| 866 | | if (!yaml_scalar_event_initialize(&output_event, |
| 867 | | NULL, "tag:yaml.org,2002:str", "anchor", -1, |
| 868 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 869 | | goto event_error; |
| 870 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 871 | | goto emitter_error; |
| 872 | | |
| 873 | | /* Write the mapping anchor. */ |
| 874 | | |
| 875 | | if (!yaml_scalar_event_initialize(&output_event, |
| 876 | | NULL, "tag:yaml.org,2002:str", |
| 877 | | input_event.data.mapping_start.anchor, -1, |
| 878 | | 0, 1, YAML_DOUBLE_QUOTED_SCALAR_STYLE)) |
| 879 | | goto event_error; |
| 880 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 881 | | goto emitter_error; |
| 882 | | } |
| 883 | | |
| 884 | | /* Display the mapping tag. */ |
| | 598 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 599 | "anchor", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 600 | if (!key) goto document_error; |
| | 601 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 602 | input_event.data.mapping_start.anchor, -1, |
| | 603 | YAML_DOUBLE_QUOTED_SCALAR_STYLE); |
| | 604 | if (!value) goto document_error; |
| | 605 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 606 | properties, key, value)) goto document_error; |
| | 607 | } |
| | 608 | |
| | 609 | /* Add 'tag': <tag>. */ |
| 888 | | /* Write 'tag'. */ |
| 889 | | |
| 890 | | if (!yaml_scalar_event_initialize(&output_event, |
| 891 | | NULL, "tag:yaml.org,2002:str", "tag", -1, |
| 892 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 893 | | goto event_error; |
| 894 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 895 | | goto emitter_error; |
| 896 | | |
| 897 | | /* Write the mapping tag. */ |
| 898 | | |
| 899 | | if (!yaml_scalar_event_initialize(&output_event, |
| 900 | | NULL, "tag:yaml.org,2002:str", |
| 901 | | input_event.data.mapping_start.tag, -1, |
| 902 | | 0, 1, YAML_DOUBLE_QUOTED_SCALAR_STYLE)) |
| 903 | | goto event_error; |
| 904 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 905 | | goto emitter_error; |
| 906 | | } |
| 907 | | |
| 908 | | /* Write 'implicit'. */ |
| 909 | | |
| 910 | | if (!yaml_scalar_event_initialize(&output_event, |
| 911 | | NULL, "tag:yaml.org,2002:str", "implicit", -1, |
| 912 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 913 | | goto event_error; |
| 914 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 915 | | goto emitter_error; |
| 916 | | |
| 917 | | /* Write if the mapping tag is implicit. */ |
| 918 | | |
| 919 | | if (!yaml_scalar_event_initialize(&output_event, |
| 920 | | NULL, "tag:yaml.org,2002:bool", |
| 921 | | (input_event.data.mapping_start.implicit ? |
| 922 | | "true" : "false"), -1, |
| 923 | | 1, 0, YAML_PLAIN_SCALAR_STYLE)) |
| 924 | | goto event_error; |
| 925 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 926 | | goto emitter_error; |
| | 613 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 614 | "tag", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 615 | if (!key) goto document_error; |
| | 616 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 617 | input_event.data.mapping_start.tag, -1, |
| | 618 | YAML_DOUBLE_QUOTED_SCALAR_STYLE); |
| | 619 | if (!value) goto document_error; |
| | 620 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 621 | properties, key, value)) goto document_error; |
| | 622 | } |
| | 623 | |
| | 624 | /* Add 'implicit': <flag>. */ |
| | 625 | |
| | 626 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 627 | "implicit", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 628 | if (!key) goto document_error; |
| | 629 | value = yaml_document_add_scalar(&output_document, YAML_BOOL_TAG, |
| | 630 | (input_event.data.mapping_start.implicit ? |
| | 631 | "true" : "false"), -1, YAML_PLAIN_SCALAR_STYLE); |
| | 632 | if (!value) goto document_error; |
| | 633 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 634 | properties, key, value)) goto document_error; |
| 935 | | /* Write 'style'. */ |
| 936 | | |
| 937 | | if (!yaml_scalar_event_initialize(&output_event, |
| 938 | | NULL, "tag:yaml.org,2002:str", "style", -1, |
| 939 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 940 | | goto event_error; |
| 941 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 942 | | goto emitter_error; |
| 943 | | |
| 944 | | /* Write the scalar style. */ |
| 945 | | |
| 946 | | if (!yaml_scalar_event_initialize(&output_event, |
| 947 | | NULL, "tag:yaml.org,2002:str", |
| 948 | | (style == YAML_BLOCK_MAPPING_STYLE ? "block" : |
| 949 | | style == YAML_FLOW_MAPPING_STYLE ? "flow" : |
| 950 | | "unknown"), -1, |
| 951 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 952 | | goto event_error; |
| 953 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 954 | | goto emitter_error; |
| | 643 | /* Add 'style': <style>. */ |
| | 644 | |
| | 645 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 646 | "style", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 647 | if (!key) goto document_error; |
| | 648 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 649 | (style == YAML_BLOCK_MAPPING_STYLE ? "block" : |
| | 650 | style == YAML_FLOW_MAPPING_STYLE ? "flow" : |
| | 651 | "unknown"), -1, YAML_PLAIN_SCALAR_STYLE); |
| | 652 | if (!value) goto document_error; |
| | 653 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 654 | properties, key, value)) goto document_error; |
| 961 | | /* Write 'type'. */ |
| 962 | | |
| 963 | | if (!yaml_scalar_event_initialize(&output_event, |
| 964 | | NULL, "tag:yaml.org,2002:str", "type", -1, |
| 965 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 966 | | goto event_error; |
| 967 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 968 | | goto emitter_error; |
| 969 | | |
| 970 | | /* Write 'MAPPING-END'. */ |
| 971 | | |
| 972 | | if (!yaml_scalar_event_initialize(&output_event, |
| 973 | | NULL, "tag:yaml.org,2002:str", "MAPPING-END", -1, |
| 974 | | 1, 1, YAML_PLAIN_SCALAR_STYLE)) |
| 975 | | goto event_error; |
| 976 | | if (!yaml_emitter_emit(&emitter, &output_event)) |
| 977 | | goto emitter_error; |
| | 661 | /* Add 'type': 'MAPPING-END'. */ |
| | 662 | |
| | 663 | key = yaml_document_add_scalar(&output_document, NULL, |
| | 664 | "type", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 665 | if (!key) goto document_error; |
| | 666 | value = yaml_document_add_scalar(&output_document, NULL, |
| | 667 | "MAPPING-END", -1, YAML_PLAIN_SCALAR_STYLE); |
| | 668 | if (!value) goto document_error; |
| | 669 | if (!yaml_document_append_mapping_pair(&output_document, |
| | 670 | properties, key, value)) goto document_error; |