30 # if defined(YAML_DECLARE_STATIC)
31 # define YAML_DECLARE(type) type
32 # elif defined(YAML_DECLARE_EXPORT)
33 # define YAML_DECLARE(type) __declspec(dllexport) type
35 # define YAML_DECLARE(type) __declspec(dllimport) type
38 # define YAML_DECLARE(type) type
581 int plain_implicit,
int quoted_implicit,
665 #define YAML_NULL_TAG "tag:yaml.org,2002:null"
667 #define YAML_BOOL_TAG "tag:yaml.org,2002:bool"
669 #define YAML_STR_TAG "tag:yaml.org,2002:str"
671 #define YAML_INT_TAG "tag:yaml.org,2002:int"
673 #define YAML_FLOAT_TAG "tag:yaml.org,2002:float"
675 #define YAML_TIMESTAMP_TAG "tag:yaml.org,2002:timestamp"
678 #define YAML_SEQ_TAG "tag:yaml.org,2002:seq"
680 #define YAML_MAP_TAG "tag:yaml.org,2002:map"
683 #define YAML_DEFAULT_SCALAR_TAG YAML_STR_TAG
685 #define YAML_DEFAULT_SEQUENCE_TAG YAML_SEQ_TAG
687 #define YAML_DEFAULT_MAPPING_TAG YAML_MAP_TAG
836 int start_implicit,
int end_implicit);
944 int sequence,
int item);
959 int mapping,
int key,
int value);
1804 unsigned char *
output,
size_t size,
size_t *size_written);
struct yaml_token_s::@12::@19 tag_directive
The tag directive (for YAML_TAG_DIRECTIVE_TOKEN).
Let the emitter choose the style.
yaml_scalar_style_t style
The scalar style.
The double-quoted scalar style.
union yaml_node_s::@29 data
The node data.
yaml_tag_directive_t * start
The beginning of the tag directives list.
Use LN for line breaks (Unix style).
unsigned char * buffer
The buffer pointer.
struct yaml_token_s::@12::@15 anchor
The anchor (for YAML_ANCHOR_TOKEN).
size_t anchor_length
The anchor length.
void * write_handler_data
A pointer for passing to the white handler.
Expect an entry of a flow sequence.
yaml_char_t * last
The last filled position of the buffer.
yaml_char_t * last
The last filled position of the buffer.
yaml_mark_t mark
The anchor mark.
yaml_char_t * suffix
The tag suffix.
yaml_stream_end_event_initialize(yaml_event_t *event)
Create the STREAM-END event.
yaml_break_e
Line break types.
A BLOCK-SEQUENCE-START token.
yaml_parser_parse(yaml_parser_t *parser, yaml_event_t *event)
Parse the input stream and produce the next parsing event.
yaml_node_pair_t * end
The end of the stack.
yaml_event_delete(yaml_event_t *event)
Free any memory allocated for an event object.
yaml_version_directive_t * version_directive
The version directive.
Expect DOCUMENT-START or STREAM-END.
int canonical
If the output is in the canonical style?
yaml_alias_data_t * end
The end of the list.
yaml_token_t * tail
The tail of the tokens queue.
yaml_tag_directive_t * start
The beginning of the list.
struct yaml_parser_s::@38 buffer
The working buffer.
const unsigned char * current
The string current position.
yaml_document_add_mapping(yaml_document_t *document, yaml_char_t *tag, yaml_mapping_style_t style)
Create a MAPPING node and attach it to the document.
int end_implicit
Is the document end indicator implicit?
struct yaml_alias_data_s yaml_alias_data_t
This structure holds aliases data.
int root_context
Is it the document root context?
enum yaml_encoding_e yaml_encoding_t
The stream encoding.
yaml_char_t * end
The end of the buffer.
struct yaml_token_s::@12::@18 version_directive
The version directive (for YAML_VERSION_DIRECTIVE_TOKEN).
struct yaml_emitter_s::@55 anchor_data
Anchor analysis.
yaml_mark_t start_mark
The beginning of the node.
Expect an item of a block sequence.
The UTF-16-BE encoding with BOM.
yaml_parser_set_encoding(yaml_parser_t *parser, yaml_encoding_t encoding)
Set the source encoding.
A FLOW-SEQUENCE-START token.
Expect the first key of a block mapping.
int sequence_context
Is it a sequence context?
int last_anchor_id
The last assigned anchor id.
struct yaml_token_s yaml_token_t
The token structure.
Cannot compose a YAML document.
enum yaml_sequence_style_e yaml_sequence_style_t
Sequence styles.
Use CR LN for line breaks (DOS style).
Expect a value of a block mapping.
struct yaml_event_s::@20::@22 document_start
The document parameters (for YAML_DOCUMENT_START_EVENT).
Cannot allocate or reallocate a block of memory.
yaml_alias_data_t * top
The top of the list.
yaml_mark_t end_mark
The end of the token.
Expect the content of a document.
yaml_scalar_event_initialize(yaml_event_t *event, yaml_char_t *anchor, yaml_char_t *tag, yaml_char_t *value, int length, int plain_implicit, int quoted_implicit, yaml_scalar_style_t style)
Create a SCALAR event.
yaml_document_t * document
The currently emitted document.
struct yaml_parser_s::@40 tokens
The tokens queue.
int stream_start_produced
Have we started to scan the input stream?
yaml_parser_set_input_string(yaml_parser_t *parser, const unsigned char *input, size_t size)
Set a string input.
int problem_value
The problematic value (-1 is none).
int yaml_write_handler_t(void *data, unsigned char *buffer, size_t size)
The prototype of a write handler.
struct yaml_event_s::@20::@22::@28 tag_directives
The list of tag directives.
size_t handle_length
The tag handle length.
yaml_encoding_t encoding
The input encoding.
const unsigned char * end
The string end pointer.
enum yaml_node_type_e yaml_node_type_t
Node types.
yaml_node_pair_t * start
The beginning of the stack.
Expect a key of a flow mapping.
A BLOCK-SEQUENCE-END token.
yaml_emitter_set_output(yaml_emitter_t *emitter, yaml_write_handler_t *handler, void *data)
Set a generic output handler.
yaml_node_t * end
The end of the stack.
yaml_mapping_style_e
Mapping styles.
int yaml_read_handler_t(void *data, unsigned char *buffer, size_t size, size_t *size_read)
The prototype of a read handler.
void * read_handler_data
A pointer for passing to the read handler.
yaml_parser_state_t state
The current parser state.
yaml_node_type_t type
The node type.
yaml_char_t * handle
The tag handle.
yaml_char_t * start
The beginning of the buffer.
yaml_char_t * suffix
The tag suffix.
yaml_mark_t end_mark
The end of the event.
struct yaml_node_s::@29::@32 mapping
The mapping parameters (for YAML_MAPPING_NODE).
yaml_char_t * anchor
The anchor.
yaml_event_t * start
The beginning of the event queue.
Expect the key of a block mapping.
yaml_simple_key_t * end
The end of the stack.
union yaml_parser_s::@37 input
Standard (string or file) input data.
unsigned char yaml_char_t
The character type (UTF-8 octet).
int flow_level
The current flow level.
Let the parser choose the encoding.
struct yaml_emitter_s::@57 scalar_data
Scalar analysis.
const unsigned char * start
The string start pointer.
The version directive data.
yaml_char_t * start
The beginning of the buffer.
yaml_parser_delete(yaml_parser_t *parser)
Destroy a parser.
const char * context
The error context.
yaml_encoding_e
The stream encoding.
yaml_mark_t mark
The position mark.
int whitespace
If the last character was a whitespace?
unsigned char * pointer
The current position of the buffer.
Expect a value for a simple key of a block mapping.
Expect a key of an ordered mapping.
struct yaml_token_s::@12::@14 alias
The alias (for YAML_ALIAS_TOKEN).
int open_ended
If an explicit document end is required?
yaml_char_t * prefix
The tag prefix.
union yaml_token_s::@12 data
The token data.
yaml_sequence_style_e
Sequence styles.
yaml_stream_start_event_initialize(yaml_event_t *event, yaml_encoding_t encoding)
Create the STREAM-START event.
yaml_tag_directive_t * top
The top of the list.
size_t length
The scalar length.
int references
The number of references.
int indent
The current indentation level.
yaml_emitter_set_break(yaml_emitter_t *emitter, yaml_break_t line_break)
Set the preferred line break.
struct yaml_parser_s yaml_parser_t
The parser structure.
Expect the first key of a flow mapping.
yaml_alias_event_initialize(yaml_event_t *event, yaml_char_t *anchor)
Create an ALIAS event.
int minor
The minor version number.
An element of a mapping node.
int major
The major version number.
yaml_char_t * tag
The tag.
struct yaml_tag_directive_s yaml_tag_directive_t
The tag directive data.
yaml_event_t * head
The head of the event queue.
int column
The current column.
yaml_error_type_t error
Error type.
yaml_document_delete(yaml_document_t *document)
Delete a YAML document and all its nodes.
yaml_tag_directive_t * start
The beginning of the list.
yaml_char_t * pointer
The current position of the buffer.
int yaml_node_item_t
An element of a sequence node.
yaml_emitter_emit(yaml_emitter_t *emitter, yaml_event_t *event)
Emit an event.
yaml_document_append_mapping_pair(yaml_document_t *document, int mapping, int key, int value)
Add a pair of a key and a value to a MAPPING node.
struct yaml_node_pair_s yaml_node_pair_t
An element of a mapping node.
yaml_parser_state_t * end
The end of the stack.
yaml_mark_t mark
The mark of the current position.
yaml_tag_directive_t * end
The end of the tag directives list.
struct yaml_simple_key_s yaml_simple_key_t
This structure holds information about a potential simple key.
Let the parser choose the break type.
The UTF-16-LE encoding with BOM.
size_t * size_written
The number of written bytes.
struct yaml_node_s::@29::@32::@34 pairs
The stack of mapping pairs (key, value).
yaml_read_handler_t * read_handler
Read handler.
yaml_document_append_sequence_item(yaml_document_t *document, int sequence, int item)
Add an item to a SEQUENCE node.
yaml_char_t * anchor
The anchor.
Expect the beginning of an implicit document.
A FLOW-SEQUENCE-END token.
yaml_emitter_state_t * top
The top of the stack.
yaml_mark_t * top
The top of the stack.
yaml_get_version_string(void)
Get the library version as a string.
static unsigned char * output
int indent
The current indentation level.
Expect the content of a document.
int key
The key of the element.
int * start
The beginning of the stack.
yaml_scalar_style_t style
The scalar style.
yaml_emitter_state_e
The emitter states.
FILE * file
File output data.
int indention
If the last character was an indentation character (' ', '-', '?', ':')?
yaml_emitter_state_t state
The current emitter state.
yaml_parser_state_e
The states of the parser.
int * top
The top of the stack.
Use CR for line breaks (Mac style).
int flow_plain_allowed
Can the scalar be expessed in the flow plain style?
struct yaml_parser_s::@46 aliases
The alias data.
int required
Is a simple key required?
A VERSION-DIRECTIVE token.
yaml_tag_directive_t * end
The end of the list.
yaml_char_t * end
The end of the buffer.
yaml_emitter_set_encoding(yaml_emitter_t *emitter, yaml_encoding_t encoding)
Set the output encoding.
enum yaml_error_type_e yaml_error_type_t
Many bad things could happen with the parser and emitter.
struct yaml_emitter_s::@50 raw_buffer
The raw buffer.
static VALUE canonical(VALUE self)
yaml_scalar_style_t style
The scalar style.
int simple_key_allowed
May a simple key occur at the current position?
size_t size
The buffer size.
Cannot read or decode the input stream.
yaml_emitter_close(yaml_emitter_t *emitter)
Finish a YAML stream.
int major
The major version number.
int stream_end_produced
Have we reached the end of the input stream?
yaml_emitter_set_output_string(yaml_emitter_t *emitter, unsigned char *output, size_t size, size_t *size_written)
Set a string output.
yaml_char_t * tag
The node tag.
yaml_alias_data_t * start
The beginning of the list.
enum yaml_scalar_style_e yaml_scalar_style_t
Scalar styles.
yaml_mark_t end_mark
The end of the node.
yaml_error_type_e
Many bad things could happen with the parser and emitter.
int implicit
Is the document indicator implicit?
Expect a value for a simple key of a flow mapping.
struct yaml_node_s::@29::@31::@33 items
The stack of sequence items.
int quoted_implicit
Is the tag optional for any non-plain style?
Expect an entry of a block sequence.
size_t length
The length of the scalar value.
yaml_encoding_t encoding
The stream encoding.
yaml_token_delete(yaml_token_t *token)
Free any memory allocated for a token object.
int line
The current line.
int opened
If the stream was already opened?
yaml_sequence_style_t style
The sequence style.
yaml_sequence_end_event_initialize(yaml_event_t *event)
Create a SEQUENCE-END event.
Cannot emit a YAML stream.
yaml_parser_set_input_file(yaml_parser_t *parser, FILE *file)
Set a file input.
yaml_char_t * value
The alias value.
int serialized
If the node has been emitted?
union yaml_emitter_s::@48 output
Standard (string or file) output data.
yaml_document_get_node(yaml_document_t *document, int index)
Get a document node.
yaml_tag_directive_t * start
The beginning of the tag directives list.
struct yaml_parser_s::@41 indents
The indentation levels stack.
#define YAML_DECLARE(type)
The public API declaration.
A FLOW-MAPPING-START token.
yaml_node_t * top
The top of the stack.
yaml_parser_load(yaml_parser_t *parser, yaml_document_t *document)
Parse the input stream and produce the next YAML document.
int simple_key_context
Is it a simple mapping key context?
yaml_event_t * end
The end of the event queue.
unsigned char * last
The last filled position of the buffer.
struct yaml_node_s::@29::@30 scalar
The scalar parameters (for YAML_SCALAR_NODE).
Expect an item of a flow sequence.
This structure holds aliases data.
yaml_error_type_t error
Error type.
yaml_parser_set_input(yaml_parser_t *parser, yaml_read_handler_t *handler, void *data)
Set a generic input handler.
struct yaml_event_s yaml_event_t
The event structure.
yaml_scalar_style_e
Scalar styles.
yaml_scalar_style_t style
The output style.
yaml_document_initialize(yaml_document_t *document, yaml_version_directive_t *version_directive, yaml_tag_directive_t *tag_directives_start, yaml_tag_directive_t *tag_directives_end, int start_implicit, int end_implicit)
Create a YAML document.
Expect the first item of a block sequence.
struct yaml_emitter_s::@52 events
The event queue.
struct yaml_parser_s::@43 states
The parser states stack.
int * end
The end of the stack.
yaml_node_item_t * top
The top of the stack.
yaml_char_t * handle
The tag handle.
int start_implicit
Is the document start indicator implicit?
yaml_char_t * value
The scalar value.
yaml_parser_state_t * top
The top of the stack.
yaml_version_directive_t * version_directive
The version directive.
yaml_document_end_event_initialize(yaml_event_t *event, int implicit)
Create the DOCUMENT-END event.
struct yaml_parser_s::@44 marks
The stack of marks.
Expect a block mapping value.
size_t token_number
The number of the token.
enum yaml_emitter_state_e yaml_emitter_state_t
The emitter states.
yaml_emitter_set_width(yaml_emitter_t *emitter, int width)
Set the preferred line width.
Let the emitter choose the style.
struct yaml_event_s::@20::@23 document_end
The document end parameters (for YAML_DOCUMENT_END_EVENT).
yaml_char_t * anchor
The anchor value.
size_t length
The length of the scalar value.
yaml_emitter_set_canonical(yaml_emitter_t *emitter, int canonical)
Set if the output should be in the "canonical" format as in the YAML specification.
Expect the first item of a flow sequence.
int value
The value of the element.
yaml_char_t * pointer
The current position of the buffer.
enum yaml_token_type_e yaml_token_type_t
Token types.
struct parser_params * parser
yaml_node_item_t * start
The beginning of the stack.
unsigned char * start
The beginning of the buffer.
struct yaml_event_s::@20::@27 mapping_start
The mapping parameters (for YAML_MAPPING_START_EVENT).
yaml_simple_key_t * top
The top of the stack.
struct yaml_document_s yaml_document_t
The document structure.
yaml_token_t * head
The head of the tokens queue.
yaml_document_start_event_initialize(yaml_event_t *event, yaml_version_directive_t *version_directive, yaml_tag_directive_t *tag_directives_start, yaml_tag_directive_t *tag_directives_end, int implicit)
Create the DOCUMENT-START event.
struct yaml_node_s::@29::@31 sequence
The sequence parameters (for YAML_SEQUENCE_NODE).
int * end
The end of the stack.
yaml_token_type_t type
The token type.
yaml_mark_t start_mark
The beginning of the document.
yaml_emitter_flush(yaml_emitter_t *emitter)
Flush the accumulated characters to the output.
size_t suffix_length
The tag suffix length.
Cannot parse the input stream.
struct yaml_emitter_s yaml_emitter_t
The emitter structure.
Expect an empty value of a flow mapping.
size_t offset
The offset of the current position (in bytes).
yaml_mark_t context_mark
The context position.
yaml_tag_directive_t * top
The top of the list.
yaml_emitter_set_unicode(yaml_emitter_t *emitter, int unicode)
Set if unescaped non-ASCII characters are allowed.
FILE * file
File input data.
The default UTF-8 encoding.
int single_quoted_allowed
Can the scalar be expressed in the single quoted style?
struct yaml_parser_s::@42 simple_keys
The stack of simple keys.
yaml_char_t * handle
The tag handle.
int block_plain_allowed
Can the scalar be expressed in the block plain style?
A FLOW-MAPPING-END token.
yaml_token_t * end
The end of the tokens queue.
yaml_mark_t problem_mark
The problem position.
unsigned char * end
The end of the buffer.
size_t tokens_parsed
The number of tokens fetched from the queue.
int * start
The beginning of the stack.
size_t problem_offset
The byte about which the problem occured.
struct yaml_parser_s::@45 tag_directives
The list of TAG directives.
struct yaml_event_s::@20::@24 alias
The alias parameters (for YAML_ALIAS_EVENT).
yaml_char_t * value
The scalar value.
yaml_mapping_start_event_initialize(yaml_event_t *event, yaml_char_t *anchor, yaml_char_t *tag, int implicit, yaml_mapping_style_t style)
Create a MAPPING-START event.
int closed
If the stream was already closed?
yaml_write_handler_t * write_handler
Write handler.
Expect a value of a flow mapping.
int mapping_context
Is it a mapping context?
yaml_document_add_scalar(yaml_document_t *document, yaml_char_t *tag, yaml_char_t *value, int length, yaml_scalar_style_t style)
Create a SCALAR node and attach it to the document.
struct yaml_emitter_s::@53 indents
The stack of indentation levels.
Expect the and of an ordered mapping entry.
Expect an entry of an indentless sequence.
Expect a block node or indentless sequence.
This structure holds information about a potential simple key.
int best_indent
The number of indentation spaces.
struct yaml_token_s::@12::@17 scalar
The scalar value (for YAML_SCALAR_TOKEN).
struct yaml_token_s::@12::@16 tag
The tag (for YAML_TAG_TOKEN).
enum yaml_parser_state_e yaml_parser_state_t
The states of the parser.
int multiline
Does the scalar contain line breaks?
Expect the first key of a block mapping.
yaml_parser_initialize(yaml_parser_t *parser)
Initialize a parser.
yaml_encoding_t encoding
The document encoding.
enum yaml_event_type_e yaml_event_type_t
Event types.
yaml_mark_t * start
The beginning of the stack.
The literal scalar style.
int minor
The minor version number.
union yaml_event_s::@20 data
The event data.
yaml_node_item_t * end
The end of the stack.
Expect the first entry of a flow sequence.
yaml_node_pair_t * top
The top of the stack.
size_t line
The position line.
yaml_encoding_t encoding
The stream encoding.
yaml_emitter_set_output_file(yaml_emitter_t *emitter, FILE *file)
Set a file output.
Expect the first entry of a block sequence.
Expect the first DOCUMENT-START or STREAM-END.
yaml_node_type_e
Node types.
struct yaml_document_s::@35 nodes
The document nodes.
yaml_node_t * start
The beginning of the stack.
yaml_break_t line_break
The preferred line break.
yaml_emitter_state_t * start
The beginning of the stack.
Cannot scan the input stream.
Expect a value of a flow mapping.
yaml_mapping_style_t style
The mapping style.
yaml_simple_key_t * start
The beginning of the stack.
struct yaml_event_s::@20::@21 stream_start
The stream parameters (for YAML_STREAM_START_EVENT).
int block_allowed
Can the scalar be expressed in the literal or folded styles?
yaml_document_t * document
The currently parsed document.
size_t index
The position index.
unsigned char * end
The end of the buffer.
yaml_mapping_end_event_initialize(yaml_event_t *event)
Create a MAPPING-END event.
unsigned char * start
The beginning of the buffer.
yaml_emitter_dump(yaml_emitter_t *emitter, yaml_document_t *document)
Emit a YAML document.
Expect a key of a flow mapping.
Cannot write to the output stream.
yaml_parser_scan(yaml_parser_t *parser, yaml_token_t *token)
Scan the input stream and produce the next token.
Expect the first key of a flow mapping.
int unicode
Allow unescaped non-ASCII characters?
yaml_tag_directive_t * end
The end of the tag directives list.
yaml_event_type_e
Event types.
yaml_document_add_sequence(yaml_document_t *document, yaml_char_t *tag, yaml_sequence_style_t style)
Create a SEQUENCE node and attach it to the document.
yaml_emitter_open(yaml_emitter_t *emitter)
Start a YAML stream.
int best_width
The preferred width of the output lines.
const char * problem
Error description.
yaml_emitter_set_indent(yaml_emitter_t *emitter, int indent)
Set the intendation increment.
yaml_token_type_e
Token types.
unsigned char * pointer
The current position of the buffer.
int possible
Is a simple key possible?
yaml_event_t * tail
The tail of the event queue.
struct yaml_emitter_s::@54 tag_directives
The list of tag directives.
yaml_char_t * value
The scalar value.
Expect a value of an ordered mapping.
yaml_get_version(int *major, int *minor, int *patch)
Get the library version numbers.
struct yaml_document_s::@36 tag_directives
The list of tag directives.
enum yaml_mapping_style_e yaml_mapping_style_t
Mapping styles.
struct yaml_parser_s::@39 raw_buffer
The raw buffer.
yaml_tag_directive_t * end
The end of the list.
const char * problem
Error description.
struct yaml_version_directive_s yaml_version_directive_t
The version directive data.
unsigned char * last
The last filled position of the buffer.
struct yaml_parser_s::@37::@47 string
String input data.
struct yaml_emitter_s::@51 states
The stack of states.
Let the emitter choose the style.
struct yaml_event_s::@20::@26 sequence_start
The sequence parameters (for YAML_SEQUENCE_START_EVENT).
yaml_emitter_initialize(yaml_emitter_t *emitter)
Initialize an emitter.
struct yaml_emitter_s::@48::@59 string
String output data.
size_t column
The position column.
yaml_emitter_delete(yaml_emitter_t *emitter)
Destroy an emitter.
yaml_document_get_root_node(yaml_document_t *document)
Get the root object.
struct yaml_emitter_s::@56 tag_data
Tag analysis.
yaml_mapping_style_t style
The mapping style.
yaml_char_t * prefix
The tag prefix.
int flow_level
The number of unclosed '[' and '{' indicators.
struct yaml_token_s::@12::@13 stream_start
The stream start (for YAML_STREAM_START_TOKEN).
yaml_emitter_state_t * end
The end of the stack.
yaml_token_t * start
The beginning of the tokens queue.
Expect a block mapping key.
yaml_mark_t * end
The end of the stack.
yaml_event_type_t type
The event type.
struct yaml_event_s::@20::@25 scalar
The scalar parameters (for YAML_SCALAR_EVENT).
enum yaml_break_e yaml_break_t
Line break types.
struct yaml_mark_s yaml_mark_t
The pointer position.
yaml_mark_t end_mark
The end of the document.
yaml_mark_t start_mark
The beginning of the event.
yaml_sequence_style_t style
The sequence style.
struct yaml_emitter_s::@58 * anchors
The information associated with the document nodes.
int * top
The top of the stack.
The block sequence style.
yaml_mark_t start_mark
The beginning of the token.
yaml_sequence_start_event_initialize(yaml_event_t *event, yaml_char_t *anchor, yaml_char_t *tag, int implicit, yaml_sequence_style_t style)
Create a SEQUENCE-START event.
int plain_implicit
Is the tag optional for the plain style?
The single-quoted scalar style.
yaml_parser_state_t * start
The beginning of the stack.
size_t length
The length of the scalar value.