7
// The version directive data.
8
type yaml_version_directive_t struct {
9
major int8 // The major version number.
10
minor int8 // The minor version number.
13
// The tag directive data.
14
type yaml_tag_directive_t struct {
15
handle []byte // The tag handle.
16
prefix []byte // The tag prefix.
19
type yaml_encoding_t int
21
// The stream encoding.
23
// Let the parser choose the encoding.
24
yaml_ANY_ENCODING yaml_encoding_t = iota
26
yaml_UTF8_ENCODING // The default UTF-8 encoding.
27
yaml_UTF16LE_ENCODING // The UTF-16-LE encoding with BOM.
28
yaml_UTF16BE_ENCODING // The UTF-16-BE encoding with BOM.
35
// Let the parser choose the break type.
36
yaml_ANY_BREAK yaml_break_t = iota
38
yaml_CR_BREAK // Use CR for line breaks (Mac style).
39
yaml_LN_BREAK // Use LN for line breaks (Unix style).
40
yaml_CRLN_BREAK // Use CR LN for line breaks (DOS style).
43
type yaml_error_type_t int
45
// Many bad things could happen with the parser and emitter.
47
// No error is produced.
48
yaml_NO_ERROR yaml_error_type_t = iota
50
yaml_MEMORY_ERROR // Cannot allocate or reallocate a block of memory.
51
yaml_READER_ERROR // Cannot read or decode the input stream.
52
yaml_SCANNER_ERROR // Cannot scan the input stream.
53
yaml_PARSER_ERROR // Cannot parse the input stream.
54
yaml_COMPOSER_ERROR // Cannot compose a YAML document.
55
yaml_WRITER_ERROR // Cannot write to the output stream.
56
yaml_EMITTER_ERROR // Cannot emit a YAML stream.
59
// The pointer position.
60
type yaml_mark_t struct {
61
index int // The position index.
62
line int // The position line.
63
column int // The position column.
68
type yaml_style_t int8
70
type yaml_scalar_style_t yaml_style_t
74
// Let the emitter choose the style.
75
yaml_ANY_SCALAR_STYLE yaml_scalar_style_t = iota
77
yaml_PLAIN_SCALAR_STYLE // The plain scalar style.
78
yaml_SINGLE_QUOTED_SCALAR_STYLE // The single-quoted scalar style.
79
yaml_DOUBLE_QUOTED_SCALAR_STYLE // The double-quoted scalar style.
80
yaml_LITERAL_SCALAR_STYLE // The literal scalar style.
81
yaml_FOLDED_SCALAR_STYLE // The folded scalar style.
84
type yaml_sequence_style_t yaml_style_t
88
// Let the emitter choose the style.
89
yaml_ANY_SEQUENCE_STYLE yaml_sequence_style_t = iota
91
yaml_BLOCK_SEQUENCE_STYLE // The block sequence style.
92
yaml_FLOW_SEQUENCE_STYLE // The flow sequence style.
95
type yaml_mapping_style_t yaml_style_t
99
// Let the emitter choose the style.
100
yaml_ANY_MAPPING_STYLE yaml_mapping_style_t = iota
102
yaml_BLOCK_MAPPING_STYLE // The block mapping style.
103
yaml_FLOW_MAPPING_STYLE // The flow mapping style.
108
type yaml_token_type_t int
113
yaml_NO_TOKEN yaml_token_type_t = iota
115
yaml_STREAM_START_TOKEN // A STREAM-START token.
116
yaml_STREAM_END_TOKEN // A STREAM-END token.
118
yaml_VERSION_DIRECTIVE_TOKEN // A VERSION-DIRECTIVE token.
119
yaml_TAG_DIRECTIVE_TOKEN // A TAG-DIRECTIVE token.
120
yaml_DOCUMENT_START_TOKEN // A DOCUMENT-START token.
121
yaml_DOCUMENT_END_TOKEN // A DOCUMENT-END token.
123
yaml_BLOCK_SEQUENCE_START_TOKEN // A BLOCK-SEQUENCE-START token.
124
yaml_BLOCK_MAPPING_START_TOKEN // A BLOCK-SEQUENCE-END token.
125
yaml_BLOCK_END_TOKEN // A BLOCK-END token.
127
yaml_FLOW_SEQUENCE_START_TOKEN // A FLOW-SEQUENCE-START token.
128
yaml_FLOW_SEQUENCE_END_TOKEN // A FLOW-SEQUENCE-END token.
129
yaml_FLOW_MAPPING_START_TOKEN // A FLOW-MAPPING-START token.
130
yaml_FLOW_MAPPING_END_TOKEN // A FLOW-MAPPING-END token.
132
yaml_BLOCK_ENTRY_TOKEN // A BLOCK-ENTRY token.
133
yaml_FLOW_ENTRY_TOKEN // A FLOW-ENTRY token.
134
yaml_KEY_TOKEN // A KEY token.
135
yaml_VALUE_TOKEN // A VALUE token.
137
yaml_ALIAS_TOKEN // An ALIAS token.
138
yaml_ANCHOR_TOKEN // An ANCHOR token.
139
yaml_TAG_TOKEN // A TAG token.
140
yaml_SCALAR_TOKEN // A SCALAR token.
143
func (tt yaml_token_type_t) String() string {
146
return "yaml_NO_TOKEN"
147
case yaml_STREAM_START_TOKEN:
148
return "yaml_STREAM_START_TOKEN"
149
case yaml_STREAM_END_TOKEN:
150
return "yaml_STREAM_END_TOKEN"
151
case yaml_VERSION_DIRECTIVE_TOKEN:
152
return "yaml_VERSION_DIRECTIVE_TOKEN"
153
case yaml_TAG_DIRECTIVE_TOKEN:
154
return "yaml_TAG_DIRECTIVE_TOKEN"
155
case yaml_DOCUMENT_START_TOKEN:
156
return "yaml_DOCUMENT_START_TOKEN"
157
case yaml_DOCUMENT_END_TOKEN:
158
return "yaml_DOCUMENT_END_TOKEN"
159
case yaml_BLOCK_SEQUENCE_START_TOKEN:
160
return "yaml_BLOCK_SEQUENCE_START_TOKEN"
161
case yaml_BLOCK_MAPPING_START_TOKEN:
162
return "yaml_BLOCK_MAPPING_START_TOKEN"
163
case yaml_BLOCK_END_TOKEN:
164
return "yaml_BLOCK_END_TOKEN"
165
case yaml_FLOW_SEQUENCE_START_TOKEN:
166
return "yaml_FLOW_SEQUENCE_START_TOKEN"
167
case yaml_FLOW_SEQUENCE_END_TOKEN:
168
return "yaml_FLOW_SEQUENCE_END_TOKEN"
169
case yaml_FLOW_MAPPING_START_TOKEN:
170
return "yaml_FLOW_MAPPING_START_TOKEN"
171
case yaml_FLOW_MAPPING_END_TOKEN:
172
return "yaml_FLOW_MAPPING_END_TOKEN"
173
case yaml_BLOCK_ENTRY_TOKEN:
174
return "yaml_BLOCK_ENTRY_TOKEN"
175
case yaml_FLOW_ENTRY_TOKEN:
176
return "yaml_FLOW_ENTRY_TOKEN"
178
return "yaml_KEY_TOKEN"
179
case yaml_VALUE_TOKEN:
180
return "yaml_VALUE_TOKEN"
181
case yaml_ALIAS_TOKEN:
182
return "yaml_ALIAS_TOKEN"
183
case yaml_ANCHOR_TOKEN:
184
return "yaml_ANCHOR_TOKEN"
186
return "yaml_TAG_TOKEN"
187
case yaml_SCALAR_TOKEN:
188
return "yaml_SCALAR_TOKEN"
190
return "<unknown token>"
193
// The token structure.
194
type yaml_token_t struct {
196
typ yaml_token_type_t
198
// The start/end of the token.
199
start_mark, end_mark yaml_mark_t
201
// The stream encoding (for yaml_STREAM_START_TOKEN).
202
encoding yaml_encoding_t
204
// The alias/anchor/scalar value or tag/tag directive handle
205
// (for yaml_ALIAS_TOKEN, yaml_ANCHOR_TOKEN, yaml_SCALAR_TOKEN, yaml_TAG_TOKEN, yaml_TAG_DIRECTIVE_TOKEN).
208
// The tag suffix (for yaml_TAG_TOKEN).
211
// The tag directive prefix (for yaml_TAG_DIRECTIVE_TOKEN).
214
// The scalar style (for yaml_SCALAR_TOKEN).
215
style yaml_scalar_style_t
217
// The version directive major/minor (for yaml_VERSION_DIRECTIVE_TOKEN).
223
type yaml_event_type_t int8
228
yaml_NO_EVENT yaml_event_type_t = iota
230
yaml_STREAM_START_EVENT // A STREAM-START event.
231
yaml_STREAM_END_EVENT // A STREAM-END event.
232
yaml_DOCUMENT_START_EVENT // A DOCUMENT-START event.
233
yaml_DOCUMENT_END_EVENT // A DOCUMENT-END event.
234
yaml_ALIAS_EVENT // An ALIAS event.
235
yaml_SCALAR_EVENT // A SCALAR event.
236
yaml_SEQUENCE_START_EVENT // A SEQUENCE-START event.
237
yaml_SEQUENCE_END_EVENT // A SEQUENCE-END event.
238
yaml_MAPPING_START_EVENT // A MAPPING-START event.
239
yaml_MAPPING_END_EVENT // A MAPPING-END event.
242
// The event structure.
243
type yaml_event_t struct {
246
typ yaml_event_type_t
248
// The start and end of the event.
249
start_mark, end_mark yaml_mark_t
251
// The document encoding (for yaml_STREAM_START_EVENT).
252
encoding yaml_encoding_t
254
// The version directive (for yaml_DOCUMENT_START_EVENT).
255
version_directive *yaml_version_directive_t
257
// The list of tag directives (for yaml_DOCUMENT_START_EVENT).
258
tag_directives []yaml_tag_directive_t
260
// The anchor (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_ALIAS_EVENT).
263
// The tag (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT).
266
// The scalar value (for yaml_SCALAR_EVENT).
269
// Is the document start/end indicator implicit, or the tag optional?
270
// (for yaml_DOCUMENT_START_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_SCALAR_EVENT).
273
// Is the tag optional for any non-plain style? (for yaml_SCALAR_EVENT).
276
// The style (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT).
280
func (e *yaml_event_t) scalar_style() yaml_scalar_style_t { return yaml_scalar_style_t(e.style) }
281
func (e *yaml_event_t) sequence_style() yaml_sequence_style_t { return yaml_sequence_style_t(e.style) }
282
func (e *yaml_event_t) mapping_style() yaml_mapping_style_t { return yaml_mapping_style_t(e.style) }
287
yaml_NULL_TAG = "tag:yaml.org,2002:null" // The tag !!null with the only possible value: null.
288
yaml_BOOL_TAG = "tag:yaml.org,2002:bool" // The tag !!bool with the values: true and false.
289
yaml_STR_TAG = "tag:yaml.org,2002:str" // The tag !!str for string values.
290
yaml_INT_TAG = "tag:yaml.org,2002:int" // The tag !!int for integer values.
291
yaml_FLOAT_TAG = "tag:yaml.org,2002:float" // The tag !!float for float values.
292
yaml_TIMESTAMP_TAG = "tag:yaml.org,2002:timestamp" // The tag !!timestamp for date and time values.
294
yaml_SEQ_TAG = "tag:yaml.org,2002:seq" // The tag !!seq is used to denote sequences.
295
yaml_MAP_TAG = "tag:yaml.org,2002:map" // The tag !!map is used to denote mapping.
297
yaml_DEFAULT_SCALAR_TAG = yaml_STR_TAG // The default scalar tag is !!str.
298
yaml_DEFAULT_SEQUENCE_TAG = yaml_SEQ_TAG // The default sequence tag is !!seq.
299
yaml_DEFAULT_MAPPING_TAG = yaml_MAP_TAG // The default mapping tag is !!map.
302
type yaml_node_type_t int
307
yaml_NO_NODE yaml_node_type_t = iota
309
yaml_SCALAR_NODE // A scalar node.
310
yaml_SEQUENCE_NODE // A sequence node.
311
yaml_MAPPING_NODE // A mapping node.
314
// An element of a sequence node.
315
type yaml_node_item_t int
317
// An element of a mapping node.
318
type yaml_node_pair_t struct {
319
key int // The key of the element.
320
value int // The value of the element.
323
// The node structure.
324
type yaml_node_t struct {
325
typ yaml_node_type_t // The node type.
326
tag []byte // The node tag.
330
// The scalar parameters (for yaml_SCALAR_NODE).
332
value []byte // The scalar value.
333
length int // The length of the scalar value.
334
style yaml_scalar_style_t // The scalar style.
337
// The sequence parameters (for YAML_SEQUENCE_NODE).
339
items_data []yaml_node_item_t // The stack of sequence items.
340
style yaml_sequence_style_t // The sequence style.
343
// The mapping parameters (for yaml_MAPPING_NODE).
345
pairs_data []yaml_node_pair_t // The stack of mapping pairs (key, value).
346
pairs_start *yaml_node_pair_t // The beginning of the stack.
347
pairs_end *yaml_node_pair_t // The end of the stack.
348
pairs_top *yaml_node_pair_t // The top of the stack.
349
style yaml_mapping_style_t // The mapping style.
352
start_mark yaml_mark_t // The beginning of the node.
353
end_mark yaml_mark_t // The end of the node.
357
// The document structure.
358
type yaml_document_t struct {
360
// The document nodes.
363
// The version directive.
364
version_directive *yaml_version_directive_t
366
// The list of tag directives.
367
tag_directives_data []yaml_tag_directive_t
368
tag_directives_start int // The beginning of the tag directives list.
369
tag_directives_end int // The end of the tag directives list.
371
start_implicit int // Is the document start indicator implicit?
372
end_implicit int // Is the document end indicator implicit?
374
// The start/end of the document.
375
start_mark, end_mark yaml_mark_t
378
// The prototype of a read handler.
380
// The read handler is called when the parser needs to read more bytes from the
381
// source. The handler should write not more than size bytes to the buffer.
382
// The number of written bytes should be set to the size_read variable.
384
// [in,out] data A pointer to an application data specified by
385
// yaml_parser_set_input().
386
// [out] buffer The buffer to write the data from the source.
387
// [in] size The size of the buffer.
388
// [out] size_read The actual number of bytes read from the source.
390
// On success, the handler should return 1. If the handler failed,
391
// the returned value should be 0. On EOF, the handler should set the
392
// size_read to 0 and return 1.
393
type yaml_read_handler_t func(parser *yaml_parser_t, buffer []byte) (n int, err error)
395
// This structure holds information about a potential simple key.
396
type yaml_simple_key_t struct {
397
possible bool // Is a simple key possible?
398
required bool // Is a simple key required?
399
token_number int // The number of the token.
400
mark yaml_mark_t // The position mark.
403
// The states of the parser.
404
type yaml_parser_state_t int
407
yaml_PARSE_STREAM_START_STATE yaml_parser_state_t = iota
409
yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE // Expect the beginning of an implicit document.
410
yaml_PARSE_DOCUMENT_START_STATE // Expect DOCUMENT-START.
411
yaml_PARSE_DOCUMENT_CONTENT_STATE // Expect the content of a document.
412
yaml_PARSE_DOCUMENT_END_STATE // Expect DOCUMENT-END.
413
yaml_PARSE_BLOCK_NODE_STATE // Expect a block node.
414
yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE // Expect a block node or indentless sequence.
415
yaml_PARSE_FLOW_NODE_STATE // Expect a flow node.
416
yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a block sequence.
417
yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE // Expect an entry of a block sequence.
418
yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE // Expect an entry of an indentless sequence.
419
yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping.
420
yaml_PARSE_BLOCK_MAPPING_KEY_STATE // Expect a block mapping key.
421
yaml_PARSE_BLOCK_MAPPING_VALUE_STATE // Expect a block mapping value.
422
yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a flow sequence.
423
yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE // Expect an entry of a flow sequence.
424
yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE // Expect a key of an ordered mapping.
425
yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE // Expect a value of an ordered mapping.
426
yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE // Expect the and of an ordered mapping entry.
427
yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping.
428
yaml_PARSE_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping.
429
yaml_PARSE_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping.
430
yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE // Expect an empty value of a flow mapping.
431
yaml_PARSE_END_STATE // Expect nothing.
434
func (ps yaml_parser_state_t) String() string {
436
case yaml_PARSE_STREAM_START_STATE:
437
return "yaml_PARSE_STREAM_START_STATE"
438
case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE:
439
return "yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE"
440
case yaml_PARSE_DOCUMENT_START_STATE:
441
return "yaml_PARSE_DOCUMENT_START_STATE"
442
case yaml_PARSE_DOCUMENT_CONTENT_STATE:
443
return "yaml_PARSE_DOCUMENT_CONTENT_STATE"
444
case yaml_PARSE_DOCUMENT_END_STATE:
445
return "yaml_PARSE_DOCUMENT_END_STATE"
446
case yaml_PARSE_BLOCK_NODE_STATE:
447
return "yaml_PARSE_BLOCK_NODE_STATE"
448
case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE:
449
return "yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE"
450
case yaml_PARSE_FLOW_NODE_STATE:
451
return "yaml_PARSE_FLOW_NODE_STATE"
452
case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE:
453
return "yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE"
454
case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE:
455
return "yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE"
456
case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE:
457
return "yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE"
458
case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE:
459
return "yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE"
460
case yaml_PARSE_BLOCK_MAPPING_KEY_STATE:
461
return "yaml_PARSE_BLOCK_MAPPING_KEY_STATE"
462
case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE:
463
return "yaml_PARSE_BLOCK_MAPPING_VALUE_STATE"
464
case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE:
465
return "yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE"
466
case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE:
467
return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE"
468
case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE:
469
return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE"
470
case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE:
471
return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE"
472
case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE:
473
return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE"
474
case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE:
475
return "yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE"
476
case yaml_PARSE_FLOW_MAPPING_KEY_STATE:
477
return "yaml_PARSE_FLOW_MAPPING_KEY_STATE"
478
case yaml_PARSE_FLOW_MAPPING_VALUE_STATE:
479
return "yaml_PARSE_FLOW_MAPPING_VALUE_STATE"
480
case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE:
481
return "yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE"
482
case yaml_PARSE_END_STATE:
483
return "yaml_PARSE_END_STATE"
485
return "<unknown parser state>"
488
// This structure holds aliases data.
489
type yaml_alias_data_t struct {
490
anchor []byte // The anchor.
491
index int // The node id.
492
mark yaml_mark_t // The anchor mark.
495
// The parser structure.
497
// All members are internal. Manage the structure using the
498
// yaml_parser_ family of functions.
499
type yaml_parser_t struct {
503
error yaml_error_type_t // Error type.
505
problem string // Error description.
507
// The byte about which the problem occured.
510
problem_mark yaml_mark_t
512
// The error context.
514
context_mark yaml_mark_t
518
read_handler yaml_read_handler_t // Read handler.
520
input_file io.Reader // File input data.
521
input []byte // String input data.
526
buffer []byte // The working buffer.
527
buffer_pos int // The current position of the buffer.
529
unread int // The number of unread characters in the buffer.
531
raw_buffer []byte // The raw buffer.
532
raw_buffer_pos int // The current position of the buffer.
534
encoding yaml_encoding_t // The input encoding.
536
offset int // The offset of the current position (in bytes).
537
mark yaml_mark_t // The mark of the current position.
541
stream_start_produced bool // Have we started to scan the input stream?
542
stream_end_produced bool // Have we reached the end of the input stream?
544
flow_level int // The number of unclosed '[' and '{' indicators.
546
tokens []yaml_token_t // The tokens queue.
547
tokens_head int // The head of the tokens queue.
548
tokens_parsed int // The number of tokens fetched from the queue.
549
token_available bool // Does the tokens queue contain a token ready for dequeueing.
551
indent int // The current indentation level.
552
indents []int // The indentation levels stack.
554
simple_key_allowed bool // May a simple key occur at the current position?
555
simple_keys []yaml_simple_key_t // The stack of simple keys.
559
state yaml_parser_state_t // The current parser state.
560
states []yaml_parser_state_t // The parser states stack.
561
marks []yaml_mark_t // The stack of marks.
562
tag_directives []yaml_tag_directive_t // The list of TAG directives.
566
aliases []yaml_alias_data_t // The alias data.
568
document *yaml_document_t // The currently parsed document.
571
// Emitter Definitions
573
// The prototype of a write handler.
575
// The write handler is called when the emitter needs to flush the accumulated
576
// characters to the output. The handler should write @a size bytes of the
577
// @a buffer to the output.
579
// @param[in,out] data A pointer to an application data specified by
580
// yaml_emitter_set_output().
581
// @param[in] buffer The buffer with bytes to be written.
582
// @param[in] size The size of the buffer.
584
// @returns On success, the handler should return @c 1. If the handler failed,
585
// the returned value should be @c 0.
587
type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error
589
type yaml_emitter_state_t int
591
// The emitter states.
593
// Expect STREAM-START.
594
yaml_EMIT_STREAM_START_STATE yaml_emitter_state_t = iota
596
yaml_EMIT_FIRST_DOCUMENT_START_STATE // Expect the first DOCUMENT-START or STREAM-END.
597
yaml_EMIT_DOCUMENT_START_STATE // Expect DOCUMENT-START or STREAM-END.
598
yaml_EMIT_DOCUMENT_CONTENT_STATE // Expect the content of a document.
599
yaml_EMIT_DOCUMENT_END_STATE // Expect DOCUMENT-END.
600
yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a flow sequence.
601
yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE // Expect an item of a flow sequence.
602
yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping.
603
yaml_EMIT_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping.
604
yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a flow mapping.
605
yaml_EMIT_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping.
606
yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a block sequence.
607
yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE // Expect an item of a block sequence.
608
yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping.
609
yaml_EMIT_BLOCK_MAPPING_KEY_STATE // Expect the key of a block mapping.
610
yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a block mapping.
611
yaml_EMIT_BLOCK_MAPPING_VALUE_STATE // Expect a value of a block mapping.
612
yaml_EMIT_END_STATE // Expect nothing.
615
// The emitter structure.
617
// All members are internal. Manage the structure using the @c yaml_emitter_
618
// family of functions.
619
type yaml_emitter_t struct {
623
error yaml_error_type_t // Error type.
624
problem string // Error description.
628
write_handler yaml_write_handler_t // Write handler.
630
output_buffer *[]byte // String output data.
631
output_file io.Writer // File output data.
633
buffer []byte // The working buffer.
634
buffer_pos int // The current position of the buffer.
636
raw_buffer []byte // The raw buffer.
637
raw_buffer_pos int // The current position of the buffer.
639
encoding yaml_encoding_t // The stream encoding.
643
canonical bool // If the output is in the canonical style?
644
best_indent int // The number of indentation spaces.
645
best_width int // The preferred width of the output lines.
646
unicode bool // Allow unescaped non-ASCII characters?
647
line_break yaml_break_t // The preferred line break.
649
state yaml_emitter_state_t // The current emitter state.
650
states []yaml_emitter_state_t // The stack of states.
652
events []yaml_event_t // The event queue.
653
events_head int // The head of the event queue.
655
indents []int // The stack of indentation levels.
657
tag_directives []yaml_tag_directive_t // The list of tag directives.
659
indent int // The current indentation level.
661
flow_level int // The current flow level.
663
root_context bool // Is it the document root context?
664
sequence_context bool // Is it a sequence context?
665
mapping_context bool // Is it a mapping context?
666
simple_key_context bool // Is it a simple mapping key context?
668
line int // The current line.
669
column int // The current column.
670
whitespace bool // If the last character was a whitespace?
671
indention bool // If the last character was an indentation character (' ', '-', '?', ':')?
672
open_ended bool // If an explicit document end is required?
676
anchor []byte // The anchor value.
677
alias bool // Is it an alias?
682
handle []byte // The tag handle.
683
suffix []byte // The tag suffix.
688
value []byte // The scalar value.
689
multiline bool // Does the scalar contain line breaks?
690
flow_plain_allowed bool // Can the scalar be expessed in the flow plain style?
691
block_plain_allowed bool // Can the scalar be expressed in the block plain style?
692
single_quoted_allowed bool // Can the scalar be expressed in the single quoted style?
693
block_allowed bool // Can the scalar be expressed in the literal or folded styles?
694
style yaml_scalar_style_t // The output style.
699
opened bool // If the stream was already opened?
700
closed bool // If the stream was already closed?
702
// The information associated with the document nodes.
704
references int // The number of references.
705
anchor int // The anchor id.
706
serialized bool // If the node has been emitted?
709
last_anchor_id int // The last assigned anchor id.
711
document *yaml_document_t // The currently emitted document.