Ruby  2.0.0p247(2013-06-27revision41674)
yaml.h
Go to the documentation of this file.
1 
11 #ifndef YAML_H
12 #define YAML_H
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 #include <stdlib.h>
19 #include <stdio.h>
20 #include <string.h>
21 
29 #ifdef _WIN32
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
34 # else
35 # define YAML_DECLARE(type) __declspec(dllimport) type
36 # endif
37 #else
38 # define YAML_DECLARE(type) type
39 #endif
40 
56 YAML_DECLARE(const char *)
58 
67 YAML_DECLARE(void)
68 yaml_get_version(int *major, int *minor, int *patch);
69 
78 typedef unsigned char yaml_char_t;
79 
81 typedef struct yaml_version_directive_s {
83  int major;
85  int minor;
87 
89 typedef struct yaml_tag_directive_s {
95 
97 typedef enum yaml_encoding_e {
107 
110 typedef enum yaml_break_e {
119 } yaml_break_t;
120 
122 typedef enum yaml_error_type_e {
125 
128 
137 
143 
145 typedef struct yaml_mark_s {
147  size_t index;
148 
150  size_t line;
151 
153  size_t column;
154 } yaml_mark_t;
155 
164 typedef enum yaml_scalar_style_e {
167 
170 
175 
181 
183 typedef enum yaml_sequence_style_e {
186 
192 
194 typedef enum yaml_mapping_style_e {
197 
202 /* YAML_FLOW_SET_MAPPING_STYLE */
204 
213 typedef enum yaml_token_type_e {
216 
221 
230 
237 
246 
255 
265 
267 typedef struct yaml_token_s {
268 
271 
273  union {
274 
276  struct {
279  } stream_start;
280 
282  struct {
285  } alias;
286 
288  struct {
291  } anchor;
292 
294  struct {
299  } tag;
300 
302  struct {
306  size_t length;
309  } scalar;
310 
312  struct {
314  int major;
316  int minor;
318 
320  struct {
325  } tag_directive;
326 
327  } data;
328 
333 
334 } yaml_token_t;
335 
342 YAML_DECLARE(void)
344 
353 typedef enum yaml_event_type_e {
356 
361 
366 
371 
376 
382 
384 typedef struct yaml_event_s {
385 
388 
390  union {
391 
393  struct {
396  } stream_start;
397 
399  struct {
402 
404  struct {
409  } tag_directives;
410 
412  int implicit;
413  } document_start;
414 
416  struct {
418  int implicit;
419  } document_end;
420 
422  struct {
425  } alias;
426 
428  struct {
436  size_t length;
443  } scalar;
444 
446  struct {
450  yaml_char_t *tag;
452  int implicit;
455  } sequence_start;
456 
458  struct {
462  yaml_char_t *tag;
464  int implicit;
467  } mapping_start;
468 
469  } data;
470 
475 
476 } yaml_event_t;
477 
487 YAML_DECLARE(int)
489  yaml_encoding_t encoding);
490 
499 YAML_DECLARE(int)
501 
521 YAML_DECLARE(int)
523  yaml_version_directive_t *version_directive,
524  yaml_tag_directive_t *tag_directives_start,
525  yaml_tag_directive_t *tag_directives_end,
526  int implicit);
527 
540 YAML_DECLARE(int)
542 
552 YAML_DECLARE(int)
554 
577 YAML_DECLARE(int)
579  yaml_char_t *anchor, yaml_char_t *tag,
580  yaml_char_t *value, int length,
581  int plain_implicit, int quoted_implicit,
582  yaml_scalar_style_t style);
583 
600 YAML_DECLARE(int)
602  yaml_char_t *anchor, yaml_char_t *tag, int implicit,
603  yaml_sequence_style_t style);
604 
613 YAML_DECLARE(int)
615 
632 YAML_DECLARE(int)
634  yaml_char_t *anchor, yaml_char_t *tag, int implicit,
635  yaml_mapping_style_t style);
636 
645 YAML_DECLARE(int)
647 
654 YAML_DECLARE(void)
656 
665 #define YAML_NULL_TAG "tag:yaml.org,2002:null"
666 
667 #define YAML_BOOL_TAG "tag:yaml.org,2002:bool"
668 
669 #define YAML_STR_TAG "tag:yaml.org,2002:str"
670 
671 #define YAML_INT_TAG "tag:yaml.org,2002:int"
672 
673 #define YAML_FLOAT_TAG "tag:yaml.org,2002:float"
674 
675 #define YAML_TIMESTAMP_TAG "tag:yaml.org,2002:timestamp"
676 
678 #define YAML_SEQ_TAG "tag:yaml.org,2002:seq"
679 
680 #define YAML_MAP_TAG "tag:yaml.org,2002:map"
681 
683 #define YAML_DEFAULT_SCALAR_TAG YAML_STR_TAG
684 
685 #define YAML_DEFAULT_SEQUENCE_TAG YAML_SEQ_TAG
686 
687 #define YAML_DEFAULT_MAPPING_TAG YAML_MAP_TAG
688 
690 typedef enum yaml_node_type_e {
693 
701 
703 typedef struct yaml_node_s yaml_node_t;
704 
706 typedef int yaml_node_item_t;
707 
709 typedef struct yaml_node_pair_s {
711  int key;
713  int value;
715 
717 struct yaml_node_s {
718 
721 
724 
726  union {
727 
729  struct {
733  size_t length;
736  } scalar;
737 
739  struct {
741  struct {
743  yaml_node_item_t *start;
745  yaml_node_item_t *end;
747  yaml_node_item_t *top;
748  } items;
751  } sequence;
752 
754  struct {
756  struct {
763  } pairs;
766  } mapping;
767 
768  } data;
769 
774 
775 };
776 
778 typedef struct yaml_document_s {
779 
781  struct {
788  } nodes;
789 
792 
794  struct {
799  } tag_directives;
800 
805 
810 
812 
831 YAML_DECLARE(int)
833  yaml_version_directive_t *version_directive,
834  yaml_tag_directive_t *tag_directives_start,
835  yaml_tag_directive_t *tag_directives_end,
836  int start_implicit, int end_implicit);
837 
844 YAML_DECLARE(void)
846 
861 
880 
895 YAML_DECLARE(int)
897  yaml_char_t *tag, yaml_char_t *value, int length,
898  yaml_scalar_style_t style);
899 
912 YAML_DECLARE(int)
914  yaml_char_t *tag, yaml_sequence_style_t style);
915 
928 YAML_DECLARE(int)
930  yaml_char_t *tag, yaml_mapping_style_t style);
931 
942 YAML_DECLARE(int)
944  int sequence, int item);
945 
957 YAML_DECLARE(int)
959  int mapping, int key, int value);
960 
986 typedef int yaml_read_handler_t(void *data, unsigned char *buffer, size_t size,
987  size_t *size_read);
988 
993 typedef struct yaml_simple_key_s {
995  int possible;
996 
998  int required;
999 
1002 
1006 
1010 typedef enum yaml_parser_state_e {
1060 
1065 typedef struct yaml_alias_data_s {
1069  int index;
1073 
1081 typedef struct yaml_parser_s {
1082 
1091  const char *problem;
1099  const char *context;
1102 
1114 
1117 
1119  union {
1121  struct {
1123  const unsigned char *start;
1125  const unsigned char *end;
1127  const unsigned char *current;
1128  } string;
1129 
1132  } input;
1133 
1135  int eof;
1136 
1138  struct {
1147  } buffer;
1148 
1149  /* The number of unread characters in the buffer. */
1150  size_t unread;
1151 
1153  struct {
1155  unsigned char *start;
1157  unsigned char *end;
1159  unsigned char *pointer;
1161  unsigned char *last;
1162  } raw_buffer;
1163 
1166 
1168  size_t offset;
1169 
1172 
1184 
1187 
1190 
1192  struct {
1201  } tokens;
1202 
1205 
1206  /* Does the tokens queue contain a token ready for dequeueing. */
1208 
1210  struct {
1212  int *start;
1214  int *end;
1216  int *top;
1217  } indents;
1218 
1220  int indent;
1221 
1224 
1226  struct {
1233  } simple_keys;
1234 
1245  struct {
1252  } states;
1253 
1256 
1258  struct {
1265  } marks;
1266 
1268  struct {
1275  } tag_directives;
1276 
1287  struct {
1294  } aliases;
1295 
1298 
1303 } yaml_parser_t;
1304 
1316 YAML_DECLARE(int)
1318 
1325 YAML_DECLARE(void)
1327 
1340 YAML_DECLARE(void)
1342  const unsigned char *input, size_t size);
1343 
1354 YAML_DECLARE(void)
1356 
1366 YAML_DECLARE(void)
1368  yaml_read_handler_t *handler, void *data);
1369 
1377 YAML_DECLARE(void)
1379 
1401 YAML_DECLARE(int)
1403 
1425 YAML_DECLARE(int)
1427 
1450 YAML_DECLARE(int)
1451 yaml_parser_load(yaml_parser_t *parser, yaml_document_t *document);
1452 
1476 typedef int yaml_write_handler_t(void *data, unsigned char *buffer, size_t size);
1477 
1479 typedef enum yaml_emitter_state_e {
1517 
1525 typedef struct yaml_emitter_s {
1526 
1535  const char *problem;
1536 
1548 
1551 
1553  union {
1555  struct {
1557  unsigned char *buffer;
1559  size_t size;
1561  size_t *size_written;
1562  } string;
1563 
1566  } output;
1567 
1569  struct {
1578  } buffer;
1579 
1581  struct {
1583  unsigned char *start;
1585  unsigned char *end;
1587  unsigned char *pointer;
1589  unsigned char *last;
1590  } raw_buffer;
1591 
1594 
1611  int unicode;
1614 
1616  struct {
1623  } states;
1624 
1627 
1629  struct {
1638  } events;
1639 
1641  struct {
1643  int *start;
1645  int *end;
1647  int *top;
1648  } indents;
1649 
1651  struct {
1658  } tag_directives;
1659 
1661  int indent;
1662 
1665 
1674 
1676  int line;
1678  int column;
1685 
1687  struct {
1693  int alias;
1694  } anchor_data;
1695 
1697  struct {
1706  } tag_data;
1707 
1709  struct {
1713  size_t length;
1726  } scalar_data;
1727 
1738  int opened;
1740  int closed;
1741 
1743  struct {
1747  int anchor;
1750  } *anchors;
1751 
1754 
1757 
1762 } yaml_emitter_t;
1763 
1775 YAML_DECLARE(int)
1777 
1784 YAML_DECLARE(void)
1786 
1802 YAML_DECLARE(void)
1804  unsigned char *output, size_t size, size_t *size_written);
1805 
1816 YAML_DECLARE(void)
1818 
1828 YAML_DECLARE(void)
1830  yaml_write_handler_t *handler, void *data);
1831 
1839 YAML_DECLARE(void)
1841 
1850 YAML_DECLARE(void)
1852 
1860 YAML_DECLARE(void)
1861 yaml_emitter_set_indent(yaml_emitter_t *emitter, int indent);
1862 
1870 YAML_DECLARE(void)
1871 yaml_emitter_set_width(yaml_emitter_t *emitter, int width);
1872 
1880 YAML_DECLARE(void)
1881 yaml_emitter_set_unicode(yaml_emitter_t *emitter, int unicode);
1882 
1890 YAML_DECLARE(void)
1891 yaml_emitter_set_break(yaml_emitter_t *emitter, yaml_break_t line_break);
1892 
1907 YAML_DECLARE(int)
1909 
1920 YAML_DECLARE(int)
1922 
1933 YAML_DECLARE(int)
1935 
1950 YAML_DECLARE(int)
1951 yaml_emitter_dump(yaml_emitter_t *emitter, yaml_document_t *document);
1952 
1961 YAML_DECLARE(int)
1963 
1966 #ifdef __cplusplus
1967 }
1968 #endif
1969 
1970 #endif /* #ifndef YAML_H */
1971 
struct yaml_token_s::@12::@19 tag_directive
The tag directive (for YAML_TAG_DIRECTIVE_TOKEN).
VALUE data
Definition: tcltklib.c:3368
Let the emitter choose the style.
Definition: yaml.h:185
yaml_scalar_style_t style
The scalar style.
Definition: yaml.h:308
The double-quoted scalar style.
Definition: yaml.h:174
union yaml_node_s::@29 data
The node data.
yaml_tag_directive_t * start
The beginning of the tag directives list.
Definition: yaml.h:406
Use LN for line breaks (Unix style).
Definition: yaml.h:116
unsigned char * buffer
The buffer pointer.
Definition: yaml.h:1557
struct yaml_token_s::@12::@15 anchor
The anchor (for YAML_ANCHOR_TOKEN).
size_t anchor_length
The anchor length.
Definition: yaml.h:1691
void * write_handler_data
A pointer for passing to the white handler.
Definition: yaml.h:1550
Expect STREAM-START.
Definition: yaml.h:1481
Expect an entry of a flow sequence.
Definition: yaml.h:1042
yaml_char_t * last
The last filled position of the buffer.
Definition: yaml.h:1577
yaml_char_t * last
The last filled position of the buffer.
Definition: yaml.h:1146
yaml_mark_t mark
The anchor mark.
Definition: yaml.h:1071
yaml_char_t * suffix
The tag suffix.
Definition: yaml.h:298
The block mapping style.
Definition: yaml.h:199
yaml_stream_end_event_initialize(yaml_event_t *event)
Create the STREAM-END event.
Definition: api.c:680
yaml_break_e
Line break types.
Definition: yaml.h:110
A BLOCK-SEQUENCE-START token.
Definition: yaml.h:232
yaml_parser_parse(yaml_parser_t *parser, yaml_event_t *event)
Parse the input stream and produce the next parsing event.
Definition: parser.c:170
yaml_node_pair_t * end
The end of the stack.
Definition: yaml.h:760
The pointer position.
Definition: yaml.h:145
The event structure.
Definition: yaml.h:384
Expect DOCUMENT-START.
Definition: yaml.h:1016
yaml_event_delete(yaml_event_t *event)
Free any memory allocated for an event object.
Definition: api.c:979
yaml_version_directive_t * version_directive
The version directive.
Definition: yaml.h:791
Expect DOCUMENT-START or STREAM-END.
Definition: yaml.h:1485
int canonical
If the output is in the canonical style?
Definition: yaml.h:1605
yaml_alias_data_t * end
The end of the list.
Definition: yaml.h:1291
yaml_token_t * tail
The tail of the tokens queue.
Definition: yaml.h:1200
int minor
Definition: tcltklib.c:110
yaml_tag_directive_t * start
The beginning of the list.
Definition: yaml.h:1270
struct yaml_parser_s::@38 buffer
The working buffer.
const unsigned char * current
The string current position.
Definition: yaml.h:1127
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.
Definition: api.c:1289
int end_implicit
Is the document end indicator implicit?
Definition: yaml.h:804
struct yaml_alias_data_s yaml_alias_data_t
This structure holds aliases data.
int root_context
Is it the document root context?
Definition: yaml.h:1667
enum yaml_encoding_e yaml_encoding_t
The stream encoding.
yaml_char_t * end
The end of the buffer.
Definition: yaml.h:1573
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.
Definition: yaml.h:771
Expect an item of a block sequence.
Definition: yaml.h:1505
The UTF-16-BE encoding with BOM.
Definition: yaml.h:105
yaml_parser_set_encoding(yaml_parser_t *parser, yaml_encoding_t encoding)
Set the source encoding.
Definition: api.c:336
A FLOW-SEQUENCE-START token.
Definition: yaml.h:239
A VALUE token.
Definition: yaml.h:254
Expect the first key of a block mapping.
Definition: yaml.h:1034
int sequence_context
Is it a sequence context?
Definition: yaml.h:1669
int last_anchor_id
The last assigned anchor id.
Definition: yaml.h:1753
A SEQUENCE-START event.
Definition: yaml.h:373
struct yaml_token_s yaml_token_t
The token structure.
Cannot compose a YAML document.
Definition: yaml.h:136
enum yaml_sequence_style_e yaml_sequence_style_t
Sequence styles.
Use CR LN for line breaks (DOS style).
Definition: yaml.h:118
Expect a value of a block mapping.
Definition: yaml.h:1513
struct yaml_event_s::@20::@22 document_start
The document parameters (for YAML_DOCUMENT_START_EVENT).
Cannot allocate or reallocate a block of memory.
Definition: yaml.h:127
yaml_alias_data_t * top
The top of the list.
Definition: yaml.h:1293
yaml_mark_t end_mark
The end of the token.
Definition: yaml.h:332
Expect the content of a document.
Definition: yaml.h:1487
A BLOCK-END token.
Definition: yaml.h:236
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.
Definition: api.c:815
yaml_document_t * document
The currently emitted document.
Definition: yaml.h:1756
struct yaml_parser_s::@40 tokens
The tokens queue.
int stream_start_produced
Have we started to scan the input stream?
Definition: yaml.h:1183
yaml_parser_set_input_string(yaml_parser_t *parser, const unsigned char *input, size_t size)
Set a string input.
Definition: api.c:283
int problem_value
The problematic value (-1 is none).
Definition: yaml.h:1095
int yaml_write_handler_t(void *data, unsigned char *buffer, size_t size)
The prototype of a write handler.
Definition: yaml.h:1476
A MAPPING-START event.
Definition: yaml.h:378
struct yaml_event_s::@20::@22::@28 tag_directives
The list of tag directives.
size_t unread
Definition: yaml.h:1150
size_t handle_length
The tag handle length.
Definition: yaml.h:1701
yaml_encoding_t encoding
The input encoding.
Definition: yaml.h:1165
const unsigned char * end
The string end pointer.
Definition: yaml.h:1125
enum yaml_node_type_e yaml_node_type_t
Node types.
yaml_node_pair_t * start
The beginning of the stack.
Definition: yaml.h:758
The parser structure.
Definition: yaml.h:1081
Expect a key of a flow mapping.
Definition: yaml.h:1497
A BLOCK-SEQUENCE-END token.
Definition: yaml.h:234
yaml_emitter_set_output(yaml_emitter_t *emitter, yaml_write_handler_t *handler, void *data)
Set a generic output handler.
Definition: api.c:489
A scalar node.
Definition: yaml.h:695
yaml_node_t * end
The end of the stack.
Definition: yaml.h:785
yaml_mapping_style_e
Mapping styles.
Definition: yaml.h:194
int yaml_read_handler_t(void *data, unsigned char *buffer, size_t size, size_t *size_read)
The prototype of a read handler.
Definition: yaml.h:986
void * read_handler_data
A pointer for passing to the read handler.
Definition: yaml.h:1116
yaml_parser_state_t state
The current parser state.
Definition: yaml.h:1255
yaml_node_type_t type
The node type.
Definition: yaml.h:720
yaml_char_t * handle
The tag handle.
Definition: yaml.h:296
A FLOW-ENTRY token.
Definition: yaml.h:250
yaml_char_t * start
The beginning of the buffer.
Definition: yaml.h:1140
yaml_char_t * suffix
The tag suffix.
Definition: yaml.h:1703
yaml_mark_t end_mark
The end of the event.
Definition: yaml.h:474
struct yaml_node_s::@29::@32 mapping
The mapping parameters (for YAML_MAPPING_NODE).
yaml_char_t * anchor
The anchor.
Definition: yaml.h:424
yaml_event_t * start
The beginning of the event queue.
Definition: yaml.h:1631
Expect the key of a block mapping.
Definition: yaml.h:1509
yaml_simple_key_t * end
The end of the stack.
Definition: yaml.h:1230
union yaml_parser_s::@37 input
Standard (string or file) input data.
unsigned char yaml_char_t
The character type (UTF-8 octet).
Definition: yaml.h:78
int flow_level
The current flow level.
Definition: yaml.h:1664
Let the parser choose the encoding.
Definition: yaml.h:99
struct yaml_emitter_s::@57 scalar_data
Scalar analysis.
const unsigned char * start
The string start pointer.
Definition: yaml.h:1123
The version directive data.
Definition: yaml.h:81
int index
Definition: tcltklib.c:4478
yaml_char_t * start
The beginning of the buffer.
Definition: yaml.h:1571
yaml_parser_delete(yaml_parser_t *parser)
Destroy a parser.
Definition: api.c:214
const char * context
The error context.
Definition: yaml.h:1099
yaml_encoding_e
The stream encoding.
Definition: yaml.h:97
yaml_mark_t mark
The position mark.
Definition: yaml.h:1004
int whitespace
If the last character was a whitespace?
Definition: yaml.h:1680
unsigned char * pointer
The current position of the buffer.
Definition: yaml.h:1587
Expect a value for a simple key of a block mapping.
Definition: yaml.h:1511
Expect a key of an ordered mapping.
Definition: yaml.h:1044
struct yaml_token_s::@12::@14 alias
The alias (for YAML_ALIAS_TOKEN).
int open_ended
If an explicit document end is required?
Definition: yaml.h:1684
yaml_char_t * prefix
The tag prefix.
Definition: yaml.h:93
union yaml_token_s::@12 data
The token data.
yaml_sequence_style_e
Sequence styles.
Definition: yaml.h:183
yaml_stream_start_event_initialize(yaml_event_t *event, yaml_encoding_t encoding)
Create the STREAM-START event.
Definition: api.c:663
yaml_tag_directive_t * top
The top of the list.
Definition: yaml.h:1657
size_t length
The scalar length.
Definition: yaml.h:1713
int references
The number of references.
Definition: yaml.h:1745
int indent
The current indentation level.
Definition: yaml.h:1220
yaml_emitter_set_break(yaml_emitter_t *emitter, yaml_break_t line_break)
Set the preferred line break.
Definition: api.c:566
Expect DOCUMENT-END.
Definition: yaml.h:1489
struct yaml_parser_s yaml_parser_t
The parser structure.
Expect the first key of a flow mapping.
Definition: yaml.h:1495
yaml_alias_event_initialize(yaml_event_t *event, yaml_char_t *anchor)
Create an ALIAS event.
Definition: api.c:791
int minor
The minor version number.
Definition: yaml.h:316
An element of a mapping node.
Definition: yaml.h:709
int major
The major version number.
Definition: yaml.h:314
yaml_char_t * tag
The tag.
Definition: yaml.h:432
struct yaml_tag_directive_s yaml_tag_directive_t
The tag directive data.
yaml_event_t * head
The head of the event queue.
Definition: yaml.h:1635
int column
The current column.
Definition: yaml.h:1678
yaml_error_type_t error
Error type.
Definition: yaml.h:1533
yaml_document_delete(yaml_document_t *document)
Delete a YAML document and all its nodes.
Definition: api.c:1117
yaml_tag_directive_t * start
The beginning of the list.
Definition: yaml.h:1653
yaml_char_t * pointer
The current position of the buffer.
Definition: yaml.h:1144
int yaml_node_item_t
An element of a sequence node.
Definition: yaml.h:706
An ALIAS token.
Definition: yaml.h:257
yaml_emitter_emit(yaml_emitter_t *emitter, yaml_event_t *event)
Emit an event.
Definition: emitter.c:281
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.
Definition: api.c:1362
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.
Definition: yaml.h:1249
yaml_mark_t mark
The mark of the current position.
Definition: yaml.h:1171
yaml_tag_directive_t * end
The end of the tag directives list.
Definition: yaml.h:408
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.
Definition: yaml.h:112
The UTF-16-LE encoding with BOM.
Definition: yaml.h:103
The node structure.
Definition: yaml.h:717
size_t * size_written
The number of written bytes.
Definition: yaml.h:1561
struct yaml_node_s::@29::@32::@34 pairs
The stack of mapping pairs (key, value).
yaml_read_handler_t * read_handler
Read handler.
Definition: yaml.h:1113
yaml_document_append_sequence_item(yaml_document_t *document, int sequence, int item)
Add an item to a SEQUENCE node.
Definition: api.c:1334
yaml_char_t * anchor
The anchor.
Definition: yaml.h:1067
Expect the beginning of an implicit document.
Definition: yaml.h:1014
A FLOW-SEQUENCE-END token.
Definition: yaml.h:241
yaml_emitter_state_t * top
The top of the stack.
Definition: yaml.h:1622
yaml_mark_t * top
The top of the stack.
Definition: yaml.h:1264
yaml_get_version_string(void)
Get the library version as a string.
Definition: api.c:9
static unsigned char * output
Definition: nkf.c:32
int indent
The current indentation level.
Definition: yaml.h:1661
int token_available
Definition: yaml.h:1207
Expect the content of a document.
Definition: yaml.h:1018
int alias
Is it an alias?
Definition: yaml.h:1693
int key
The key of the element.
Definition: yaml.h:711
int * start
The beginning of the stack.
Definition: yaml.h:1212
yaml_scalar_style_t style
The scalar style.
Definition: yaml.h:442
yaml_emitter_state_e
The emitter states.
Definition: yaml.h:1479
The folded scalar style.
Definition: yaml.h:179
FILE * file
File output data.
Definition: yaml.h:1565
int indention
If the last character was an indentation character (&#39; &#39;, &#39;-&#39;, &#39;?&#39;, &#39;:&#39;)?
Definition: yaml.h:1682
yaml_emitter_state_t state
The current emitter state.
Definition: yaml.h:1626
yaml_parser_state_e
The states of the parser.
Definition: yaml.h:1010
int * top
The top of the stack.
Definition: yaml.h:1216
unsigned int input
Definition: nkf.c:4311
Use CR for line breaks (Mac style).
Definition: yaml.h:114
int flow_plain_allowed
Can the scalar be expessed in the flow plain style?
Definition: yaml.h:1717
struct yaml_parser_s::@46 aliases
The alias data.
int required
Is a simple key required?
Definition: yaml.h:998
A VERSION-DIRECTIVE token.
Definition: yaml.h:223
yaml_tag_directive_t * end
The end of the list.
Definition: yaml.h:1272
The emitter structure.
Definition: yaml.h:1525
yaml_char_t * end
The end of the buffer.
Definition: yaml.h:1142
yaml_emitter_set_encoding(yaml_emitter_t *emitter, yaml_encoding_t encoding)
Set the output encoding.
Definition: api.c:505
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.
Definition: yaml.h:735
int simple_key_allowed
May a simple key occur at the current position?
Definition: yaml.h:1223
size_t size
The buffer size.
Definition: yaml.h:1559
int index
The node id.
Definition: yaml.h:1069
Cannot read or decode the input stream.
Definition: yaml.h:130
A mapping node.
Definition: yaml.h:699
yaml_emitter_close(yaml_emitter_t *emitter)
Finish a YAML stream.
Definition: dumper.c:86
int major
The major version number.
Definition: yaml.h:83
A TAG token.
Definition: yaml.h:261
A STREAM-START token.
Definition: yaml.h:218
int stream_end_produced
Have we reached the end of the input stream?
Definition: yaml.h:1186
yaml_emitter_set_output_string(yaml_emitter_t *emitter, unsigned char *output, size_t size, size_t *size_written)
Set a string output.
Definition: api.c:451
yaml_char_t * tag
The node tag.
Definition: yaml.h:723
yaml_alias_data_t * start
The beginning of the list.
Definition: yaml.h:1289
enum yaml_scalar_style_e yaml_scalar_style_t
Scalar styles.
yaml_mark_t end_mark
The end of the node.
Definition: yaml.h:773
yaml_error_type_e
Many bad things could happen with the parser and emitter.
Definition: yaml.h:122
int implicit
Is the document indicator implicit?
Definition: yaml.h:412
Expect a value for a simple key of a flow mapping.
Definition: yaml.h:1499
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?
Definition: yaml.h:440
An empty node.
Definition: yaml.h:692
Expect an entry of a block sequence.
Definition: yaml.h:1030
A DOCUMENT-START event.
Definition: yaml.h:363
size_t length
The length of the scalar value.
Definition: yaml.h:306
yaml_encoding_t encoding
The stream encoding.
Definition: yaml.h:1593
yaml_token_delete(yaml_token_t *token)
Free any memory allocated for a token object.
Definition: api.c:578
int line
The current line.
Definition: yaml.h:1676
int opened
If the stream was already opened?
Definition: yaml.h:1738
yaml_sequence_style_t style
The sequence style.
Definition: yaml.h:454
yaml_sequence_end_event_initialize(yaml_event_t *event)
Create a SEQUENCE-END event.
Definition: api.c:908
Cannot emit a YAML stream.
Definition: yaml.h:141
yaml_parser_set_input_file(yaml_parser_t *parser, FILE *file)
Set a file input.
Definition: api.c:303
yaml_char_t * value
The alias value.
Definition: yaml.h:284
int serialized
If the node has been emitted?
Definition: yaml.h:1749
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.
Definition: api.c:1164
yaml_tag_directive_t * start
The beginning of the tag directives list.
Definition: yaml.h:796
struct yaml_parser_s::@41 indents
The indentation levels stack.
#define YAML_DECLARE(type)
The public API declaration.
Definition: yaml.h:38
ID token
Definition: ripper.c:15558
static int VALUE key
Definition: tkutil.c:265
A MAPPING-END event.
Definition: yaml.h:380
A FLOW-MAPPING-START token.
Definition: yaml.h:243
yaml_node_t * top
The top of the stack.
Definition: yaml.h:787
yaml_parser_load(yaml_parser_t *parser, yaml_document_t *document)
Parse the input stream and produce the next YAML document.
Definition: loader.c:67
int simple_key_context
Is it a simple mapping key context?
Definition: yaml.h:1673
yaml_event_t * end
The end of the event queue.
Definition: yaml.h:1633
unsigned char * last
The last filled position of the buffer.
Definition: yaml.h:1589
struct yaml_node_s::@29::@30 scalar
The scalar parameters (for YAML_SCALAR_NODE).
Expect an item of a flow sequence.
Definition: yaml.h:1493
This structure holds aliases data.
Definition: yaml.h:1065
yaml_error_type_t error
Error type.
Definition: yaml.h:1089
yaml_parser_set_input(yaml_parser_t *parser, yaml_read_handler_t *handler, void *data)
Set a generic input handler.
Definition: api.c:320
struct yaml_event_s yaml_event_t
The event structure.
An empty token.
Definition: yaml.h:215
yaml_scalar_style_e
Scalar styles.
Definition: yaml.h:164
yaml_scalar_style_t style
The output style.
Definition: yaml.h:1725
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.
Definition: api.c:1030
Expect the first item of a block sequence.
Definition: yaml.h:1503
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.
Definition: yaml.h:1645
volatile VALUE value
Definition: tcltklib.c:9442
yaml_node_item_t * top
The top of the stack.
Definition: yaml.h:747
yaml_char_t * handle
The tag handle.
Definition: yaml.h:91
int start_implicit
Is the document start indicator implicit?
Definition: yaml.h:802
yaml_char_t * value
The scalar value.
Definition: yaml.h:434
yaml_parser_state_t * top
The top of the stack.
Definition: yaml.h:1251
int anchor
The anchor id.
Definition: yaml.h:1747
yaml_version_directive_t * version_directive
The version directive.
Definition: yaml.h:401
yaml_document_end_event_initialize(yaml_event_t *event, int implicit)
Create the DOCUMENT-END event.
Definition: api.c:775
struct yaml_parser_s::@44 marks
The stack of marks.
#define const
Definition: strftime.c:102
Expect a block mapping value.
Definition: yaml.h:1038
size_t token_number
The number of the token.
Definition: yaml.h:1001
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.
Definition: api.c:542
Let the emitter choose the style.
Definition: yaml.h:196
struct yaml_event_s::@20::@23 document_end
The document end parameters (for YAML_DOCUMENT_END_EVENT).
A SEQUENCE-END event.
Definition: yaml.h:375
yaml_char_t * anchor
The anchor value.
Definition: yaml.h:1689
size_t length
The length of the scalar value.
Definition: yaml.h:733
size_t length
Definition: tcltklib.c:4559
yaml_emitter_set_canonical(yaml_emitter_t *emitter, int canonical)
Set if the output should be in the &quot;canonical&quot; format as in the YAML specification.
Definition: api.c:518
Expect the first item of a flow sequence.
Definition: yaml.h:1491
int value
The value of the element.
Definition: yaml.h:713
yaml_char_t * pointer
The current position of the buffer.
Definition: yaml.h:1575
A STREAM-END token.
Definition: yaml.h:220
enum yaml_token_type_e yaml_token_type_t
Token types.
struct parser_params * parser
Definition: ripper.c:4578
yaml_node_item_t * start
The beginning of the stack.
Definition: yaml.h:743
unsigned char * start
The beginning of the buffer.
Definition: yaml.h:1583
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.
Definition: yaml.h:1232
struct yaml_document_s yaml_document_t
The document structure.
yaml_token_t * head
The head of the tokens queue.
Definition: yaml.h:1198
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.
Definition: api.c:696
The tag directive data.
Definition: yaml.h:89
struct yaml_node_s::@29::@31 sequence
The sequence parameters (for YAML_SEQUENCE_NODE).
int * end
The end of the stack.
Definition: yaml.h:1214
An ANCHOR token.
Definition: yaml.h:259
yaml_token_type_t type
The token type.
Definition: yaml.h:270
yaml_mark_t start_mark
The beginning of the document.
Definition: yaml.h:807
yaml_emitter_flush(yaml_emitter_t *emitter)
Flush the accumulated characters to the output.
Definition: writer.c:32
size_t suffix_length
The tag suffix length.
Definition: yaml.h:1705
Cannot parse the input stream.
Definition: yaml.h:134
struct yaml_emitter_s yaml_emitter_t
The emitter structure.
Expect an empty value of a flow mapping.
Definition: yaml.h:1056
size_t offset
The offset of the current position (in bytes).
Definition: yaml.h:1168
yaml_mark_t context_mark
The context position.
Definition: yaml.h:1101
yaml_tag_directive_t * top
The top of the list.
Definition: yaml.h:1274
yaml_emitter_set_unicode(yaml_emitter_t *emitter, int unicode)
Set if unescaped non-ASCII characters are allowed.
Definition: api.c:554
FILE * file
File input data.
Definition: yaml.h:1131
The default UTF-8 encoding.
Definition: yaml.h:101
int single_quoted_allowed
Can the scalar be expressed in the single quoted style?
Definition: yaml.h:1721
struct yaml_parser_s::@42 simple_keys
The stack of simple keys.
yaml_char_t * handle
The tag handle.
Definition: yaml.h:1699
int block_plain_allowed
Can the scalar be expressed in the block plain style?
Definition: yaml.h:1719
A FLOW-MAPPING-END token.
Definition: yaml.h:245
yaml_token_t * end
The end of the tokens queue.
Definition: yaml.h:1196
Expect a flow node.
Definition: yaml.h:1026
yaml_mark_t problem_mark
The problem position.
Definition: yaml.h:1097
unsigned char * end
The end of the buffer.
Definition: yaml.h:1157
A sequence node.
Definition: yaml.h:697
size_t tokens_parsed
The number of tokens fetched from the queue.
Definition: yaml.h:1204
int * start
The beginning of the stack.
Definition: yaml.h:1643
size_t problem_offset
The byte about which the problem occured.
Definition: yaml.h:1093
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.
Definition: yaml.h:1711
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.
Definition: api.c:924
int closed
If the stream was already closed?
Definition: yaml.h:1740
yaml_write_handler_t * write_handler
Write handler.
Definition: yaml.h:1547
A DOCUMENT-END event.
Definition: yaml.h:365
Expect a value of a flow mapping.
Definition: yaml.h:1501
int size
Definition: encoding.c:52
A DOCUMENT-START token.
Definition: yaml.h:227
int mapping_context
Is it a mapping context?
Definition: yaml.h:1671
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.
Definition: api.c:1194
struct yaml_emitter_s::@53 indents
The stack of indentation levels.
Expect the and of an ordered mapping entry.
Definition: yaml.h:1048
No error is produced.
Definition: yaml.h:124
Expect an entry of an indentless sequence.
Definition: yaml.h:1032
Expect a block node or indentless sequence.
Definition: yaml.h:1024
This structure holds information about a potential simple key.
Definition: yaml.h:993
A SCALAR event.
Definition: yaml.h:370
int best_indent
The number of indentation spaces.
Definition: yaml.h:1607
struct yaml_token_s::@12::@17 scalar
The scalar value (for YAML_SCALAR_TOKEN).
The plain scalar style.
Definition: yaml.h:169
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?
Definition: yaml.h:1715
Expect the first key of a block mapping.
Definition: yaml.h:1507
yaml_parser_initialize(yaml_parser_t *parser)
Initialize a parser.
Definition: api.c:171
yaml_encoding_t encoding
The document encoding.
Definition: yaml.h:395
enum yaml_event_type_e yaml_event_type_t
Event types.
yaml_mark_t * start
The beginning of the stack.
Definition: yaml.h:1260
The literal scalar style.
Definition: yaml.h:177
int minor
The minor version number.
Definition: yaml.h:85
A STREAM-END event.
Definition: yaml.h:360
union yaml_event_s::@20 data
The event data.
yaml_node_item_t * end
The end of the stack.
Definition: yaml.h:745
Expect the first entry of a flow sequence.
Definition: yaml.h:1040
yaml_node_pair_t * top
The top of the stack.
Definition: yaml.h:762
size_t line
The position line.
Definition: yaml.h:150
A DOCUMENT-END token.
Definition: yaml.h:229
yaml_encoding_t encoding
The stream encoding.
Definition: yaml.h:278
yaml_emitter_set_output_file(yaml_emitter_t *emitter, FILE *file)
Set a file output.
Definition: api.c:472
Expect the first entry of a block sequence.
Definition: yaml.h:1028
Expect the first DOCUMENT-START or STREAM-END.
Definition: yaml.h:1483
A TAG-DIRECTIVE token.
Definition: yaml.h:225
yaml_node_type_e
Node types.
Definition: yaml.h:690
struct yaml_document_s::@35 nodes
The document nodes.
yaml_node_t * start
The beginning of the stack.
Definition: yaml.h:783
yaml_break_t line_break
The preferred line break.
Definition: yaml.h:1613
Expect nothing.
Definition: yaml.h:1515
yaml_emitter_state_t * start
The beginning of the stack.
Definition: yaml.h:1618
Cannot scan the input stream.
Definition: yaml.h:132
Expect a value of a flow mapping.
Definition: yaml.h:1054
yaml_mapping_style_t style
The mapping style.
Definition: yaml.h:466
yaml_simple_key_t * start
The beginning of the stack.
Definition: yaml.h:1228
struct yaml_event_s::@20::@21 stream_start
The stream parameters (for YAML_STREAM_START_EVENT).
Expect DOCUMENT-END.
Definition: yaml.h:1020
int block_allowed
Can the scalar be expressed in the literal or folded styles?
Definition: yaml.h:1723
Expect nothing.
Definition: yaml.h:1058
yaml_document_t * document
The currently parsed document.
Definition: yaml.h:1297
size_t index
The position index.
Definition: yaml.h:147
unsigned char * end
The end of the buffer.
Definition: yaml.h:1585
yaml_mapping_end_event_initialize(yaml_event_t *event)
Create a MAPPING-END event.
Definition: api.c:963
unsigned char * start
The beginning of the buffer.
Definition: yaml.h:1155
yaml_emitter_dump(yaml_emitter_t *emitter, yaml_document_t *document)
Emit a YAML document.
Definition: dumper.c:112
Expect a key of a flow mapping.
Definition: yaml.h:1052
Cannot write to the output stream.
Definition: yaml.h:139
yaml_parser_scan(yaml_parser_t *parser, yaml_token_t *token)
Scan the input stream and produce the next token.
Definition: scanner.c:742
A SCALAR token.
Definition: yaml.h:263
A STREAM-START event.
Definition: yaml.h:358
Expect the first key of a flow mapping.
Definition: yaml.h:1050
int unicode
Allow unescaped non-ASCII characters?
Definition: yaml.h:1611
yaml_tag_directive_t * end
The end of the tag directives list.
Definition: yaml.h:798
yaml_event_type_e
Event types.
Definition: yaml.h:353
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.
Definition: api.c:1244
yaml_emitter_open(yaml_emitter_t *emitter)
Start a YAML stream.
Definition: dumper.c:62
int best_width
The preferred width of the output lines.
Definition: yaml.h:1609
const char * problem
Error description.
Definition: yaml.h:1091
yaml_emitter_set_indent(yaml_emitter_t *emitter, int indent)
Set the intendation increment.
Definition: api.c:530
yaml_token_type_e
Token types.
Definition: yaml.h:213
unsigned char * pointer
The current position of the buffer.
Definition: yaml.h:1159
int possible
Is a simple key possible?
Definition: yaml.h:995
yaml_event_t * tail
The tail of the event queue.
Definition: yaml.h:1637
struct yaml_emitter_s::@54 tag_directives
The list of tag directives.
yaml_char_t * value
The scalar value.
Definition: yaml.h:731
The flow mapping style.
Definition: yaml.h:201
Expect a value of an ordered mapping.
Definition: yaml.h:1046
yaml_get_version(int *major, int *minor, int *patch)
Get the library version numbers.
Definition: api.c:19
struct yaml_document_s::@36 tag_directives
The list of tag directives.
enum yaml_mapping_style_e yaml_mapping_style_t
Mapping styles.
Expect a block node.
Definition: yaml.h:1022
A BLOCK-ENTRY token.
Definition: yaml.h:248
struct yaml_parser_s::@39 raw_buffer
The raw buffer.
yaml_tag_directive_t * end
The end of the list.
Definition: yaml.h:1655
const char * problem
Error description.
Definition: yaml.h:1535
int major
Definition: tcltklib.c:109
struct yaml_version_directive_s yaml_version_directive_t
The version directive data.
unsigned char * last
The last filled position of the buffer.
Definition: yaml.h:1161
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.
Definition: yaml.h:166
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.
Definition: api.c:349
struct yaml_emitter_s::@48::@59 string
String output data.
size_t column
The position column.
Definition: yaml.h:153
yaml_emitter_delete(yaml_emitter_t *emitter)
Destroy an emitter.
Definition: api.c:386
The document structure.
Definition: yaml.h:778
yaml_document_get_root_node(yaml_document_t *document)
Get the root object.
Definition: api.c:1179
struct yaml_emitter_s::@56 tag_data
Tag analysis.
A KEY token.
Definition: yaml.h:252
yaml_mapping_style_t style
The mapping style.
Definition: yaml.h:765
yaml_char_t * prefix
The tag prefix.
Definition: yaml.h:324
int flow_level
The number of unclosed &#39;[&#39; and &#39;{&#39; indicators.
Definition: yaml.h:1189
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.
Definition: yaml.h:1620
yaml_token_t * start
The beginning of the tokens queue.
Definition: yaml.h:1194
Expect a block mapping key.
Definition: yaml.h:1036
yaml_mark_t * end
The end of the stack.
Definition: yaml.h:1262
yaml_event_type_t type
The event type.
Definition: yaml.h:387
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.
Expect STREAM-START.
Definition: yaml.h:1012
The token structure.
Definition: yaml.h:267
yaml_mark_t end_mark
The end of the document.
Definition: yaml.h:809
An ALIAS event.
Definition: yaml.h:368
yaml_mark_t start_mark
The beginning of the event.
Definition: yaml.h:472
The flow sequence style.
Definition: yaml.h:190
yaml_sequence_style_t style
The sequence style.
Definition: yaml.h:750
struct yaml_emitter_s::@58 * anchors
The information associated with the document nodes.
An empty event.
Definition: yaml.h:355
int * top
The top of the stack.
Definition: yaml.h:1647
The block sequence style.
Definition: yaml.h:188
yaml_mark_t start_mark
The beginning of the token.
Definition: yaml.h:330
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.
Definition: api.c:869
int eof
EOF flag.
Definition: yaml.h:1135
int plain_implicit
Is the tag optional for the plain style?
Definition: yaml.h:438
The single-quoted scalar style.
Definition: yaml.h:172
yaml_parser_state_t * start
The beginning of the stack.
Definition: yaml.h:1247
size_t length
The length of the scalar value.
Definition: yaml.h:436