libsheepy
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 #if defined(__MINGW32__)
30 # define YAML_DECLARE(type) type
31 #elif defined(_WIN32)
32 # if defined(YAML_DECLARE_STATIC)
33 # define YAML_DECLARE(type) type
34 # elif defined(YAML_DECLARE_EXPORT)
35 # define YAML_DECLARE(type) __declspec(dllexport) type
36 # else
37 # define YAML_DECLARE(type) __declspec(dllimport) type
38 # endif
39 #else
40 # define YAML_DECLARE(type) type
41 #endif
42 
58 YAML_DECLARE(const char *)
60 
69 YAML_DECLARE(void)
70 yaml_get_version(int *major, int *minor, int *patch);
71 
80 typedef unsigned char yaml_char_t;
81 
83 typedef struct yaml_version_directive_s {
85  int major;
87  int minor;
89 
91 typedef struct yaml_tag_directive_s {
93  yaml_char_t *handle;
95  yaml_char_t *prefix;
97 
99 typedef enum yaml_encoding_e {
109 
112 typedef enum yaml_break_e {
121 } yaml_break_t;
122 
124 typedef enum yaml_error_type_e {
127 
130 
139 
145 
147 typedef struct yaml_mark_s {
149  size_t index;
150 
152  size_t line;
153 
155  size_t column;
156 } yaml_mark_t;
157 
166 typedef enum yaml_scalar_style_e {
169 
172 
177 
183 
185 typedef enum yaml_sequence_style_e {
188 
194 
196 typedef enum yaml_mapping_style_e {
199 
204 /* YAML_FLOW_SET_MAPPING_STYLE */
206 
215 typedef enum yaml_token_type_e {
218 
223 
232 
239 
248 
257 
267 
269 typedef struct yaml_token_s {
270 
272  yaml_token_type_t type;
273 
275  union {
276 
278  struct {
280  yaml_encoding_t encoding;
281  } stream_start;
282 
284  struct {
286  yaml_char_t *value;
287  } alias;
288 
290  struct {
292  yaml_char_t *value;
293  } anchor;
294 
296  struct {
298  yaml_char_t *handle;
300  yaml_char_t *suffix;
301  } tag;
302 
304  struct {
306  yaml_char_t *value;
308  size_t length;
310  yaml_scalar_style_t style;
311  } scalar;
312 
314  struct {
316  int major;
318  int minor;
319  } version_directive;
320 
322  struct {
324  yaml_char_t *handle;
326  yaml_char_t *prefix;
327  } tag_directive;
328 
329  } data;
330 
335 
336 } yaml_token_t;
337 
344 YAML_DECLARE(void)
346 
355 typedef enum yaml_event_type_e {
358 
363 
368 
373 
378 
384 
386 typedef struct yaml_event_s {
387 
389  yaml_event_type_t type;
390 
392  union {
393 
395  struct {
397  yaml_encoding_t encoding;
398  } stream_start;
399 
401  struct {
404 
406  struct {
411  } tag_directives;
412 
414  int implicit;
415  } document_start;
416 
418  struct {
420  int implicit;
421  } document_end;
422 
424  struct {
426  yaml_char_t *anchor;
427  } alias;
428 
430  struct {
432  yaml_char_t *anchor;
434  yaml_char_t *tag;
436  yaml_char_t *value;
438  size_t length;
444  yaml_scalar_style_t style;
445  } scalar;
446 
448  struct {
450  yaml_char_t *anchor;
452  yaml_char_t *tag;
454  int implicit;
456  yaml_sequence_style_t style;
457  } sequence_start;
458 
460  struct {
462  yaml_char_t *anchor;
464  yaml_char_t *tag;
466  int implicit;
468  yaml_mapping_style_t style;
469  } mapping_start;
470 
471  } data;
472 
477 
478 } yaml_event_t;
479 
489 YAML_DECLARE(int)
491  yaml_encoding_t encoding);
492 
501 YAML_DECLARE(int)
503 
523 YAML_DECLARE(int)
525  yaml_version_directive_t *version_directive,
526  yaml_tag_directive_t *tag_directives_start,
527  yaml_tag_directive_t *tag_directives_end,
528  int implicit);
529 
542 YAML_DECLARE(int)
544 
554 YAML_DECLARE(int)
555 yaml_alias_event_initialize(yaml_event_t *event, const yaml_char_t *anchor);
556 
579 YAML_DECLARE(int)
581  const yaml_char_t *anchor, const yaml_char_t *tag,
582  const yaml_char_t *value, int length,
583  int plain_implicit, int quoted_implicit,
584  yaml_scalar_style_t style);
585 
602 YAML_DECLARE(int)
604  const yaml_char_t *anchor, const yaml_char_t *tag, int implicit,
605  yaml_sequence_style_t style);
606 
615 YAML_DECLARE(int)
617 
634 YAML_DECLARE(int)
636  const yaml_char_t *anchor, const yaml_char_t *tag, int implicit,
637  yaml_mapping_style_t style);
638 
647 YAML_DECLARE(int)
649 
656 YAML_DECLARE(void)
658 
667 #define YAML_NULL_TAG "tag:yaml.org,2002:null"
668 
669 #define YAML_BOOL_TAG "tag:yaml.org,2002:bool"
670 
671 #define YAML_STR_TAG "tag:yaml.org,2002:str"
672 
673 #define YAML_INT_TAG "tag:yaml.org,2002:int"
674 
675 #define YAML_FLOAT_TAG "tag:yaml.org,2002:float"
676 
677 #define YAML_TIMESTAMP_TAG "tag:yaml.org,2002:timestamp"
678 
680 #define YAML_SEQ_TAG "tag:yaml.org,2002:seq"
681 
682 #define YAML_MAP_TAG "tag:yaml.org,2002:map"
683 
685 #define YAML_DEFAULT_SCALAR_TAG YAML_STR_TAG
686 
687 #define YAML_DEFAULT_SEQUENCE_TAG YAML_SEQ_TAG
688 
689 #define YAML_DEFAULT_MAPPING_TAG YAML_MAP_TAG
690 
692 typedef enum yaml_node_type_e {
695 
703 
705 typedef struct yaml_node_s yaml_node_t;
706 
708 typedef int yaml_node_item_t;
709 
711 typedef struct yaml_node_pair_s {
713  int key;
715  int value;
717 
719 struct yaml_node_s {
720 
722  yaml_node_type_t type;
723 
725  yaml_char_t *tag;
726 
728  union {
729 
731  struct {
733  yaml_char_t *value;
735  size_t length;
737  yaml_scalar_style_t style;
738  } scalar;
739 
741  struct {
743  struct {
745  yaml_node_item_t *start;
747  yaml_node_item_t *end;
749  yaml_node_item_t *top;
750  } items;
752  yaml_sequence_style_t style;
753  } sequence;
754 
756  struct {
758  struct {
765  } pairs;
767  yaml_mapping_style_t style;
768  } mapping;
769 
770  } data;
771 
776 
777 };
778 
780 typedef struct yaml_document_s {
781 
783  struct {
790  } nodes;
791 
794 
796  struct {
801  } tag_directives;
802 
807 
812 
814 
833 YAML_DECLARE(int)
835  yaml_version_directive_t *version_directive,
836  yaml_tag_directive_t *tag_directives_start,
837  yaml_tag_directive_t *tag_directives_end,
838  int start_implicit, int end_implicit);
839 
846 YAML_DECLARE(void)
848 
862 yaml_document_get_node(yaml_document_t *document, int index);
863 
882 
897 YAML_DECLARE(int)
899  const yaml_char_t *tag, const yaml_char_t *value, int length,
900  yaml_scalar_style_t style);
901 
914 YAML_DECLARE(int)
916  const yaml_char_t *tag, yaml_sequence_style_t style);
917 
930 YAML_DECLARE(int)
932  const yaml_char_t *tag, yaml_mapping_style_t style);
933 
944 YAML_DECLARE(int)
946  int sequence, int item);
947 
959 YAML_DECLARE(int)
961  int mapping, int key, int value);
962 
988 typedef int yaml_read_handler_t(void *data, unsigned char *buffer, size_t size,
989  size_t *size_read);
990 
995 typedef struct yaml_simple_key_s {
997  int possible;
998 
1001 
1004 
1008 
1012 typedef enum yaml_parser_state_e {
1023 
1034 
1045 
1066 
1071 typedef struct yaml_alias_data_s {
1073  yaml_char_t *anchor;
1075  int index;
1079 
1087 typedef struct yaml_parser_s {
1088 
1095  yaml_error_type_t error;
1097  const char *problem;
1105  const char *context;
1108 
1120 
1123 
1125  union {
1127  struct {
1129  const unsigned char *start;
1131  const unsigned char *end;
1133  const unsigned char *current;
1134  } string;
1135 
1137  FILE *file;
1138  } input;
1139 
1141  int eof;
1142 
1144  struct {
1146  yaml_char_t *start;
1148  yaml_char_t *end;
1150  yaml_char_t *pointer;
1152  yaml_char_t *last;
1153  } buffer;
1154 
1155  /* The number of unread characters in the buffer. */
1156  size_t unread;
1157 
1159  struct {
1161  unsigned char *start;
1163  unsigned char *end;
1165  unsigned char *pointer;
1167  unsigned char *last;
1168  } raw_buffer;
1169 
1171  yaml_encoding_t encoding;
1172 
1174  size_t offset;
1175 
1178 
1190 
1193 
1196 
1198  struct {
1207  } tokens;
1208 
1211 
1214 
1216  struct {
1218  int *start;
1220  int *end;
1222  int *top;
1223  } indents;
1224 
1226  int indent;
1227 
1230 
1232  struct {
1239  } simple_keys;
1240 
1251  struct {
1253  yaml_parser_state_t *start;
1255  yaml_parser_state_t *end;
1257  yaml_parser_state_t *top;
1258  } states;
1259 
1261  yaml_parser_state_t state;
1262 
1264  struct {
1271  } marks;
1272 
1274  struct {
1281  } tag_directives;
1282 
1293  struct {
1300  } aliases;
1301 
1304 
1309 } yaml_parser_t;
1310 
1322 YAML_DECLARE(int)
1324 
1331 YAML_DECLARE(void)
1333 
1346 YAML_DECLARE(void)
1348  const unsigned char *input, size_t size);
1349 
1360 YAML_DECLARE(void)
1362 
1372 YAML_DECLARE(void)
1374  yaml_read_handler_t *handler, void *data);
1375 
1383 YAML_DECLARE(void)
1384 yaml_parser_set_encoding(yaml_parser_t *parser, yaml_encoding_t encoding);
1385 
1407 YAML_DECLARE(int)
1409 
1431 YAML_DECLARE(int)
1433 
1456 YAML_DECLARE(int)
1457 yaml_parser_load(yaml_parser_t *parser, yaml_document_t *document);
1458 
1482 typedef int yaml_write_handler_t(void *data, unsigned char *buffer, size_t size);
1483 
1485 typedef enum yaml_emitter_state_e {
1496 
1507 
1518 
1526 
1527 
1528 /* This is needed for C++ */
1529 
1530 typedef struct yaml_anchors_s {
1534  int anchor;
1537 } yaml_anchors_t;
1538 
1546 typedef struct yaml_emitter_s {
1547 
1554  yaml_error_type_t error;
1556  const char *problem;
1557 
1569 
1572 
1574  union {
1576  struct {
1578  unsigned char *buffer;
1580  size_t size;
1582  size_t *size_written;
1583  } string;
1584 
1586  FILE *file;
1587  } output;
1588 
1590  struct {
1592  yaml_char_t *start;
1594  yaml_char_t *end;
1596  yaml_char_t *pointer;
1598  yaml_char_t *last;
1599  } buffer;
1600 
1602  struct {
1604  unsigned char *start;
1606  unsigned char *end;
1608  unsigned char *pointer;
1610  unsigned char *last;
1611  } raw_buffer;
1612 
1614  yaml_encoding_t encoding;
1615 
1632  int unicode;
1634  yaml_break_t line_break;
1635 
1637  struct {
1639  yaml_emitter_state_t *start;
1641  yaml_emitter_state_t *end;
1643  yaml_emitter_state_t *top;
1644  } states;
1645 
1647  yaml_emitter_state_t state;
1648 
1650  struct {
1659  } events;
1660 
1662  struct {
1664  int *start;
1666  int *end;
1668  int *top;
1669  } indents;
1670 
1672  struct {
1679  } tag_directives;
1680 
1682  int indent;
1683 
1686 
1695 
1697  int line;
1699  int column;
1706 
1708  struct {
1710  yaml_char_t *anchor;
1714  int alias;
1715  } anchor_data;
1716 
1718  struct {
1720  yaml_char_t *handle;
1724  yaml_char_t *suffix;
1727  } tag_data;
1728 
1730  struct {
1732  yaml_char_t *value;
1734  size_t length;
1746  yaml_scalar_style_t style;
1747  } scalar_data;
1748 
1759  int opened;
1761  int closed;
1762 
1765 
1768 
1771 
1776 } yaml_emitter_t;
1777 
1789 YAML_DECLARE(int)
1791 
1798 YAML_DECLARE(void)
1800 
1816 YAML_DECLARE(void)
1818  unsigned char *output, size_t size, size_t *size_written);
1819 
1830 YAML_DECLARE(void)
1832 
1842 YAML_DECLARE(void)
1844  yaml_write_handler_t *handler, void *data);
1845 
1853 YAML_DECLARE(void)
1854 yaml_emitter_set_encoding(yaml_emitter_t *emitter, yaml_encoding_t encoding);
1855 
1864 YAML_DECLARE(void)
1865 yaml_emitter_set_canonical(yaml_emitter_t *emitter, int canonical);
1866 
1874 YAML_DECLARE(void)
1875 yaml_emitter_set_indent(yaml_emitter_t *emitter, int indent);
1876 
1884 YAML_DECLARE(void)
1885 yaml_emitter_set_width(yaml_emitter_t *emitter, int width);
1886 
1894 YAML_DECLARE(void)
1895 yaml_emitter_set_unicode(yaml_emitter_t *emitter, int unicode);
1896 
1904 YAML_DECLARE(void)
1905 yaml_emitter_set_break(yaml_emitter_t *emitter, yaml_break_t line_break);
1906 
1921 YAML_DECLARE(int)
1923 
1934 YAML_DECLARE(int)
1936 
1947 YAML_DECLARE(int)
1949 
1964 YAML_DECLARE(int)
1965 yaml_emitter_dump(yaml_emitter_t *emitter, yaml_document_t *document);
1966 
1975 YAML_DECLARE(int)
1977 
1980 #ifdef __cplusplus
1981 }
1982 #endif
1983 
1984 #endif /* #ifndef YAML_H */
1985 
Let the emitter choose the style.
Definition: yaml.h:187
yaml_scalar_style_t style
The scalar style.
Definition: yaml.h:310
The double-quoted scalar style.
Definition: yaml.h:176
yaml_tag_directive_t * start
The beginning of the tag directives list.
Definition: yaml.h:408
Use LN for line breaks (Unix style).
Definition: yaml.h:118
unsigned char * buffer
The buffer pointer.
Definition: yaml.h:1578
size_t anchor_length
The anchor length.
Definition: yaml.h:1712
void * write_handler_data
A pointer for passing to the write handler.
Definition: yaml.h:1571
Expect STREAM-START.
Definition: yaml.h:1487
Expect an entry of a flow sequence.
Definition: yaml.h:1047
yaml_char_t * last
The last filled position of the buffer.
Definition: yaml.h:1598
yaml_char_t * last
The last filled position of the buffer.
Definition: yaml.h:1152
yaml_mark_t mark
The anchor mark.
Definition: yaml.h:1077
yaml_char_t * suffix
The tag suffix.
Definition: yaml.h:300
The block mapping style.
Definition: yaml.h:201
struct yaml_anchors_s yaml_anchors_t
yaml_stream_end_event_initialize(yaml_event_t *event)
Create the STREAM-END event.
Definition: ymlApi.c:686
yaml_break_e
Line break types.
Definition: yaml.h:112
A BLOCK-SEQUENCE-START token.
Definition: yaml.h:234
yaml_parser_parse(yaml_parser_t *parser, yaml_event_t *event)
Parse the input stream and produce the next parsing event.
Definition: ymlParser.c:170
yaml_node_pair_t * end
The end of the stack.
Definition: yaml.h:762
The pointer position.
Definition: yaml.h:147
The event structure.
Definition: yaml.h:386
Expect DOCUMENT-START.
Definition: yaml.h:1018
yaml_event_delete(yaml_event_t *event)
Free any memory allocated for an event object.
Definition: ymlApi.c:985
yaml_version_directive_t * version_directive
The version directive.
Definition: yaml.h:793
Expect DOCUMENT-START or STREAM-END.
Definition: yaml.h:1491
int canonical
If the output is in the canonical style?
Definition: yaml.h:1626
yaml_alias_data_t * end
The end of the list.
Definition: yaml.h:1297
yaml_token_t * tail
The tail of the tokens queue.
Definition: yaml.h:1206
yaml_tag_directive_t * start
The beginning of the list.
Definition: yaml.h:1276
const unsigned char * current
The string current position.
Definition: yaml.h:1133
int end_implicit
Is the document end indicator implicit?
Definition: yaml.h:806
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:1688
enum yaml_encoding_e yaml_encoding_t
The stream encoding.
yaml_char_t * end
The end of the buffer.
Definition: yaml.h:1594
yaml_mark_t start_mark
The beginning of the node.
Definition: yaml.h:773
Expect an item of a block sequence.
Definition: yaml.h:1513
The UTF-16-BE encoding with BOM.
Definition: yaml.h:107
yaml_parser_set_encoding(yaml_parser_t *parser, yaml_encoding_t encoding)
Set the source encoding.
Definition: ymlApi.c:342
A FLOW-SEQUENCE-START token.
Definition: yaml.h:241
A VALUE token.
Definition: yaml.h:256
Expect the first key of a block mapping.
Definition: yaml.h:1038
int sequence_context
Is it a sequence context?
Definition: yaml.h:1690
int last_anchor_id
The last assigned anchor id.
Definition: yaml.h:1767
A SEQUENCE-START event.
Definition: yaml.h:375
char ** file
struct yaml_token_s yaml_token_t
The token structure.
Cannot compose a YAML document.
Definition: yaml.h:138
enum yaml_sequence_style_e yaml_sequence_style_t
Sequence styles.
Use CR LN for line breaks (DOS style).
Definition: yaml.h:120
Expect a value of a block mapping.
Definition: yaml.h:1522
Cannot allocate or reallocate a block of memory.
Definition: yaml.h:129
yaml_alias_data_t * top
The top of the list.
Definition: yaml.h:1299
yaml_mark_t end_mark
The end of the token.
Definition: yaml.h:334
Expect the content of a document.
Definition: yaml.h:1493
A BLOCK-END token.
Definition: yaml.h:238
yaml_document_t * document
The currently emitted document.
Definition: yaml.h:1770
int stream_start_produced
Have we started to scan the input stream?
Definition: yaml.h:1189
yaml_parser_set_input_string(yaml_parser_t *parser, const unsigned char *input, size_t size)
Set a string input.
Definition: ymlApi.c:289
int problem_value
The problematic value (-1 is none).
Definition: yaml.h:1101
int yaml_write_handler_t(void *data, unsigned char *buffer, size_t size)
The prototype of a write handler.
Definition: yaml.h:1482
A MAPPING-START event.
Definition: yaml.h:380
size_t unread
Definition: yaml.h:1156
size_t handle_length
The tag handle length.
Definition: yaml.h:1722
yaml_encoding_t encoding
The input encoding.
Definition: yaml.h:1171
const unsigned char * end
The string end pointer.
Definition: yaml.h:1131
enum yaml_node_type_e yaml_node_type_t
Node types.
yaml_node_pair_t * start
The beginning of the stack.
Definition: yaml.h:760
The parser structure.
Definition: yaml.h:1087
Expect a key of a flow mapping.
Definition: yaml.h:1504
A BLOCK-MAPPING-START token.
Definition: yaml.h:236
yaml_emitter_set_output(yaml_emitter_t *emitter, yaml_write_handler_t *handler, void *data)
Set a generic output handler.
Definition: ymlApi.c:495
A scalar node.
Definition: yaml.h:697
yaml_mapping_start_event_initialize(yaml_event_t *event, const yaml_char_t *anchor, const yaml_char_t *tag, int implicit, yaml_mapping_style_t style)
Create a MAPPING-START event.
Definition: ymlApi.c:930
yaml_node_t * end
The end of the stack.
Definition: yaml.h:787
yaml_mapping_style_e
Mapping styles.
Definition: yaml.h:196
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:988
void * read_handler_data
A pointer for passing to the read handler.
Definition: yaml.h:1122
yaml_parser_state_t state
The current parser state.
Definition: yaml.h:1261
yaml_node_type_t type
The node type.
Definition: yaml.h:722
yaml_char_t * handle
The tag handle.
Definition: yaml.h:298
A FLOW-ENTRY token.
Definition: yaml.h:252
yaml_char_t * start
The beginning of the buffer.
Definition: yaml.h:1146
yaml_char_t * suffix
The tag suffix.
Definition: yaml.h:1724
yaml_mark_t end_mark
The end of the event.
Definition: yaml.h:476
yaml_char_t * anchor
The anchor.
Definition: yaml.h:426
yaml_event_t * start
The beginning of the event queue.
Definition: yaml.h:1652
Expect the key of a block mapping.
Definition: yaml.h:1517
yaml_simple_key_t * end
The end of the stack.
Definition: yaml.h:1236
unsigned char yaml_char_t
The character type (UTF-8 octet).
Definition: yaml.h:80
int flow_level
The current flow level.
Definition: yaml.h:1685
Let the parser choose the encoding.
Definition: yaml.h:101
const unsigned char * start
The string start pointer.
Definition: yaml.h:1129
The version directive data.
Definition: yaml.h:83
yaml_char_t * start
The beginning of the buffer.
Definition: yaml.h:1592
yaml_parser_delete(yaml_parser_t *parser)
Destroy a parser.
Definition: ymlApi.c:220
const char * context
The error context.
Definition: yaml.h:1105
yaml_encoding_e
The stream encoding.
Definition: yaml.h:99
char data[7]
Definition: libsheepy.c:19690
yaml_mark_t mark
The position mark.
Definition: yaml.h:1006
int whitespace
If the last character was a whitespace?
Definition: yaml.h:1701
unsigned char * pointer
The current position of the buffer.
Definition: yaml.h:1608
Expect a value for a simple key of a block mapping.
Definition: yaml.h:1520
Expect a key of an ordered mapping.
Definition: yaml.h:1049
int open_ended
If an explicit document end is required?
Definition: yaml.h:1705
yaml_char_t * prefix
The tag prefix.
Definition: yaml.h:95
yaml_sequence_style_e
Sequence styles.
Definition: yaml.h:185
yaml_stream_start_event_initialize(yaml_event_t *event, yaml_encoding_t encoding)
Create the STREAM-START event.
Definition: ymlApi.c:669
yaml_tag_directive_t * top
The top of the list.
Definition: yaml.h:1678
size_t length
The scalar length.
Definition: yaml.h:1734
int indent
The current indentation level.
Definition: yaml.h:1226
yaml_emitter_set_break(yaml_emitter_t *emitter, yaml_break_t line_break)
Set the preferred line break.
Definition: ymlApi.c:572
Expect DOCUMENT-END.
Definition: yaml.h:1495
struct yaml_parser_s yaml_parser_t
The parser structure.
Expect the first key of a flow mapping.
Definition: yaml.h:1502
int minor
The minor version number.
Definition: yaml.h:318
An element of a mapping node.
Definition: yaml.h:711
int major
The major version number.
Definition: yaml.h:316
yaml_char_t * tag
The tag.
Definition: yaml.h:434
struct yaml_tag_directive_s yaml_tag_directive_t
The tag directive data.
yaml_document_add_sequence(yaml_document_t *document, const yaml_char_t *tag, yaml_sequence_style_t style)
Create a SEQUENCE node and attach it to the document.
Definition: ymlApi.c:1245
yaml_event_t * head
The head of the event queue.
Definition: yaml.h:1656
int column
The current column.
Definition: yaml.h:1699
yaml_error_type_t error
Error type.
Definition: yaml.h:1554
yaml_document_delete(yaml_document_t *document)
Delete a YAML document and all its nodes.
Definition: ymlApi.c:1123
yaml_tag_directive_t * start
The beginning of the list.
Definition: yaml.h:1674
yaml_char_t * pointer
The current position of the buffer.
Definition: yaml.h:1150
int yaml_node_item_t
An element of a sequence node.
Definition: yaml.h:708
An ALIAS token.
Definition: yaml.h:259
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.
Definition: ymlApi.c:1363
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:1255
yaml_mark_t mark
The mark of the current position.
Definition: yaml.h:1177
yaml_tag_directive_t * end
The end of the tag directives list.
Definition: yaml.h:410
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:114
The UTF-16-LE encoding with BOM.
Definition: yaml.h:105
The node structure.
Definition: yaml.h:719
size_t * size_written
The number of written bytes.
Definition: yaml.h:1582
yaml_read_handler_t * read_handler
Read handler.
Definition: yaml.h:1119
yaml_document_append_sequence_item(yaml_document_t *document, int sequence, int item)
Add an item to a SEQUENCE node.
Definition: ymlApi.c:1335
yaml_char_t * anchor
The anchor.
Definition: yaml.h:1073
Expect the beginning of an implicit document.
Definition: yaml.h:1016
A FLOW-SEQUENCE-END token.
Definition: yaml.h:243
yaml_emitter_state_t * top
The top of the stack.
Definition: yaml.h:1643
yaml_mark_t * top
The top of the stack.
Definition: yaml.h:1270
yaml_get_version_string(void)
Get the library version as a string.
Definition: ymlApi.c:9
int indent
The current indentation level.
Definition: yaml.h:1682
int token_available
Does the tokens queue contain a token ready for dequeueing.
Definition: yaml.h:1213
Expect the content of a document.
Definition: yaml.h:1020
int alias
Is it an alias?
Definition: yaml.h:1714
int key
The key of the element.
Definition: yaml.h:713
int * start
The beginning of the stack.
Definition: yaml.h:1218
yaml_scalar_style_t style
The scalar style.
Definition: yaml.h:444
yaml_emitter_state_e
The emitter states.
Definition: yaml.h:1485
The folded scalar style.
Definition: yaml.h:181
FILE * file
File output data.
Definition: yaml.h:1586
int indention
If the last character was an indentation character (&#39; &#39;, &#39;-&#39;, &#39;?&#39;, &#39;:&#39;)?
Definition: yaml.h:1703
yaml_emitter_state_t state
The current emitter state.
Definition: yaml.h:1647
yaml_parser_state_e
The states of the parser.
Definition: yaml.h:1012
int * top
The top of the stack.
Definition: yaml.h:1222
yaml_anchors_t * anchors
The information associated with the document nodes.
Definition: yaml.h:1764
Use CR for line breaks (Mac style).
Definition: yaml.h:116
int flow_plain_allowed
Can the scalar be expessed in the flow plain style?
Definition: yaml.h:1738
int required
Is a simple key required?
Definition: yaml.h:1000
A VERSION-DIRECTIVE token.
Definition: yaml.h:225
yaml_tag_directive_t * end
The end of the list.
Definition: yaml.h:1278
The emitter structure.
Definition: yaml.h:1546
yaml_char_t * end
The end of the buffer.
Definition: yaml.h:1148
yaml_emitter_set_encoding(yaml_emitter_t *emitter, yaml_encoding_t encoding)
Set the output encoding.
Definition: ymlApi.c:511
enum yaml_error_type_e yaml_error_type_t
Many bad things could happen with the parser and emitter.
yaml_scalar_style_t style
The scalar style.
Definition: yaml.h:737
int simple_key_allowed
May a simple key occur at the current position?
Definition: yaml.h:1229
size_t size
The buffer size.
Definition: yaml.h:1580
int index
The node id.
Definition: yaml.h:1075
Cannot read or decode the input stream.
Definition: yaml.h:132
A mapping node.
Definition: yaml.h:701
yaml_emitter_close(yaml_emitter_t *emitter)
Finish a YAML stream.
int major
The major version number.
Definition: yaml.h:85
A TAG token.
Definition: yaml.h:263
A STREAM-START token.
Definition: yaml.h:220
int stream_end_produced
Have we reached the end of the input stream?
Definition: yaml.h:1192
yaml_emitter_set_output_string(yaml_emitter_t *emitter, unsigned char *output, size_t size, size_t *size_written)
Set a string output.
Definition: ymlApi.c:457
int serialized
If the node has been emitted?
Definition: yaml.h:1536
yaml_char_t * tag
The node tag.
Definition: yaml.h:725
yaml_alias_data_t * start
The beginning of the list.
Definition: yaml.h:1295
enum yaml_scalar_style_e yaml_scalar_style_t
Scalar styles.
yaml_mark_t end_mark
The end of the node.
Definition: yaml.h:775
yaml_error_type_e
Many bad things could happen with the parser and emitter.
Definition: yaml.h:124
int implicit
Is the document indicator implicit?
Definition: yaml.h:414
Expect a value for a simple key of a flow mapping.
Definition: yaml.h:1506
int quoted_implicit
Is the tag optional for any non-plain style?
Definition: yaml.h:442
An empty node.
Definition: yaml.h:694
Expect an entry of a block sequence.
Definition: yaml.h:1033
A DOCUMENT-START event.
Definition: yaml.h:365
size_t length
The length of the scalar value.
Definition: yaml.h:308
yaml_encoding_t encoding
The stream encoding.
Definition: yaml.h:1614
yaml_token_delete(yaml_token_t *token)
Free any memory allocated for a token object.
Definition: ymlApi.c:584
int line
The current line.
Definition: yaml.h:1697
yaml_document_add_scalar(yaml_document_t *document, const yaml_char_t *tag, const yaml_char_t *value, int length, yaml_scalar_style_t style)
Create a SCALAR node and attach it to the document.
Definition: ymlApi.c:1195
int opened
If the stream was already opened?
Definition: yaml.h:1759
yaml_sequence_style_t style
The sequence style.
Definition: yaml.h:456
yaml_sequence_end_event_initialize(yaml_event_t *event)
Create a SEQUENCE-END event.
Definition: ymlApi.c:914
Cannot emit a YAML stream.
Definition: yaml.h:143
yaml_parser_set_input_file(yaml_parser_t *parser, FILE *file)
Set a file input.
Definition: ymlApi.c:309
yaml_char_t * value
The alias value.
Definition: yaml.h:286
yaml_document_get_node(yaml_document_t *document, int index)
Get a node of a YAML document.
Definition: ymlApi.c:1165
int references
The number of references.
Definition: yaml.h:1532
yaml_tag_directive_t * start
The beginning of the tag directives list.
Definition: yaml.h:798
#define YAML_DECLARE(type)
The public API declaration.
Definition: yaml.h:40
A MAPPING-END event.
Definition: yaml.h:382
A FLOW-MAPPING-START token.
Definition: yaml.h:245
yaml_node_t * top
The top of the stack.
Definition: yaml.h:789
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?
Definition: yaml.h:1694
yaml_event_t * end
The end of the event queue.
Definition: yaml.h:1654
unsigned char * last
The last filled position of the buffer.
Definition: yaml.h:1610
Expect an item of a flow sequence.
Definition: yaml.h:1500
This structure holds aliases data.
Definition: yaml.h:1071
yaml_error_type_t error
Error type.
Definition: yaml.h:1095
yaml_parser_set_input(yaml_parser_t *parser, yaml_read_handler_t *handler, void *data)
Set a generic input handler.
Definition: ymlApi.c:326
struct yaml_event_s yaml_event_t
The event structure.
An empty token.
Definition: yaml.h:217
yaml_scalar_style_e
Scalar styles.
Definition: yaml.h:166
yaml_scalar_style_t style
The output style.
Definition: yaml.h:1746
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: ymlApi.c:1036
Expect the first item of a block sequence.
Definition: yaml.h:1511
int * end
The end of the stack.
Definition: yaml.h:1666
yaml_node_item_t * top
The top of the stack.
Definition: yaml.h:749
yaml_char_t * handle
The tag handle.
Definition: yaml.h:93
int start_implicit
Is the document start indicator implicit?
Definition: yaml.h:804
yaml_char_t * value
The scalar value.
Definition: yaml.h:436
yaml_parser_state_t * top
The top of the stack.
Definition: yaml.h:1257
yaml_version_directive_t * version_directive
The version directive.
Definition: yaml.h:403
yaml_document_end_event_initialize(yaml_event_t *event, int implicit)
Create the DOCUMENT-END event.
Definition: ymlApi.c:781
Expect a block mapping value.
Definition: yaml.h:1042
size_t token_number
The number of the token.
Definition: yaml.h:1003
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: ymlApi.c:548
Let the emitter choose the style.
Definition: yaml.h:198
A SEQUENCE-END event.
Definition: yaml.h:377
yaml_char_t * anchor
The anchor value.
Definition: yaml.h:1710
size_t length
The length of the scalar value.
Definition: yaml.h:735
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.
Definition: ymlApi.c:524
Expect the first item of a flow sequence.
Definition: yaml.h:1498
int value
The value of the element.
Definition: yaml.h:715
yaml_char_t * pointer
The current position of the buffer.
Definition: yaml.h:1596
A STREAM-END token.
Definition: yaml.h:222
enum yaml_token_type_e yaml_token_type_t
Token types.
yaml_node_item_t * start
The beginning of the stack.
Definition: yaml.h:745
unsigned char * start
The beginning of the buffer.
Definition: yaml.h:1604
yaml_simple_key_t * top
The top of the stack.
Definition: yaml.h:1238
struct yaml_document_s yaml_document_t
The document structure.
yaml_token_t * head
The head of the tokens queue.
Definition: yaml.h:1204
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: ymlApi.c:702
The tag directive data.
Definition: yaml.h:91
int * end
The end of the stack.
Definition: yaml.h:1220
An ANCHOR token.
Definition: yaml.h:261
yaml_token_type_t type
The token type.
Definition: yaml.h:272
yaml_mark_t start_mark
The beginning of the document.
Definition: yaml.h:809
yaml_emitter_flush(yaml_emitter_t *emitter)
Flush the accumulated characters to the output.
size_t suffix_length
The tag suffix length.
Definition: yaml.h:1726
Cannot parse the input stream.
Definition: yaml.h:136
struct yaml_emitter_s yaml_emitter_t
The emitter structure.
Expect an empty value of a flow mapping.
Definition: yaml.h:1062
size_t offset
The offset of the current position (in bytes).
Definition: yaml.h:1174
yaml_document_add_mapping(yaml_document_t *document, const yaml_char_t *tag, yaml_mapping_style_t style)
Create a MAPPING node and attach it to the document.
Definition: ymlApi.c:1290
yaml_mark_t context_mark
The context position.
Definition: yaml.h:1107
yaml_tag_directive_t * top
The top of the list.
Definition: yaml.h:1280
yaml_emitter_set_unicode(yaml_emitter_t *emitter, int unicode)
Set if unescaped non-ASCII characters are allowed.
Definition: ymlApi.c:560
FILE * file
File input data.
Definition: yaml.h:1137
The default UTF-8 encoding.
Definition: yaml.h:103
int single_quoted_allowed
Can the scalar be expressed in the single quoted style?
Definition: yaml.h:1742
yaml_char_t * handle
The tag handle.
Definition: yaml.h:1720
int block_plain_allowed
Can the scalar be expressed in the block plain style?
Definition: yaml.h:1740
A FLOW-MAPPING-END token.
Definition: yaml.h:247
yaml_token_t * end
The end of the tokens queue.
Definition: yaml.h:1202
Expect a flow node.
Definition: yaml.h:1029
yaml_mark_t problem_mark
The problem position.
Definition: yaml.h:1103
unsigned char * end
The end of the buffer.
Definition: yaml.h:1163
in value value
A sequence node.
Definition: yaml.h:699
size_t tokens_parsed
The number of tokens fetched from the queue.
Definition: yaml.h:1210
int * start
The beginning of the stack.
Definition: yaml.h:1664
size_t problem_offset
The byte about which the problem occured.
Definition: yaml.h:1099
yaml_char_t * value
The scalar value.
Definition: yaml.h:1732
int closed
If the stream was already closed?
Definition: yaml.h:1761
yaml_write_handler_t * write_handler
Write handler.
Definition: yaml.h:1568
A DOCUMENT-END event.
Definition: yaml.h:367
Expect a value of a flow mapping.
Definition: yaml.h:1509
A DOCUMENT-START token.
Definition: yaml.h:229
int mapping_context
Is it a mapping context?
Definition: yaml.h:1692
yaml_sequence_start_event_initialize(yaml_event_t *event, const yaml_char_t *anchor, const yaml_char_t *tag, int implicit, yaml_sequence_style_t style)
Create a SEQUENCE-START event.
Definition: ymlApi.c:875
Expect the and of an ordered mapping entry.
Definition: yaml.h:1053
No error is produced.
Definition: yaml.h:126
Expect an entry of an indentless sequence.
Definition: yaml.h:1036
Expect a block node or indentless sequence.
Definition: yaml.h:1027
This structure holds information about a potential simple key.
Definition: yaml.h:995
A SCALAR event.
Definition: yaml.h:372
int best_indent
The number of indentation spaces.
Definition: yaml.h:1628
The plain scalar style.
Definition: yaml.h:171
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:1736
Expect the first key of a block mapping.
Definition: yaml.h:1515
yaml_parser_initialize(yaml_parser_t *parser)
Initialize a parser.
Definition: ymlApi.c:177
yaml_encoding_t encoding
The document encoding.
Definition: yaml.h:397
enum yaml_event_type_e yaml_event_type_t
Event types.
yaml_mark_t * start
The beginning of the stack.
Definition: yaml.h:1266
The literal scalar style.
Definition: yaml.h:179
int minor
The minor version number.
Definition: yaml.h:87
A STREAM-END event.
Definition: yaml.h:362
yaml_node_item_t * end
The end of the stack.
Definition: yaml.h:747
Expect the first entry of a flow sequence.
Definition: yaml.h:1044
yaml_node_pair_t * top
The top of the stack.
Definition: yaml.h:764
yaml_alias_event_initialize(yaml_event_t *event, const yaml_char_t *anchor)
Create an ALIAS event.
Definition: ymlApi.c:797
size_t line
The position line.
Definition: yaml.h:152
A DOCUMENT-END token.
Definition: yaml.h:231
yaml_encoding_t encoding
The stream encoding.
Definition: yaml.h:280
yaml_emitter_set_output_file(yaml_emitter_t *emitter, FILE *file)
Set a file output.
Definition: ymlApi.c:478
Expect the first entry of a block sequence.
Definition: yaml.h:1031
Expect the first DOCUMENT-START or STREAM-END.
Definition: yaml.h:1489
A TAG-DIRECTIVE token.
Definition: yaml.h:227
yaml_node_type_e
Node types.
Definition: yaml.h:692
yaml_node_t * start
The beginning of the stack.
Definition: yaml.h:785
yaml_break_t line_break
The preferred line break.
Definition: yaml.h:1634
int anchor
The anchor id.
Definition: yaml.h:1534
Expect nothing.
Definition: yaml.h:1524
yaml_emitter_state_t * start
The beginning of the stack.
Definition: yaml.h:1639
Cannot scan the input stream.
Definition: yaml.h:134
Expect a value of a flow mapping.
Definition: yaml.h:1060
yaml_mapping_style_t style
The mapping style.
Definition: yaml.h:468
yaml_simple_key_t * start
The beginning of the stack.
Definition: yaml.h:1234
Expect DOCUMENT-END.
Definition: yaml.h:1022
int block_allowed
Can the scalar be expressed in the literal or folded styles?
Definition: yaml.h:1744
Expect nothing.
Definition: yaml.h:1064
yaml_document_t * document
The currently parsed document.
Definition: yaml.h:1303
size_t index
The position index.
Definition: yaml.h:149
unsigned char * end
The end of the buffer.
Definition: yaml.h:1606
yaml_mapping_end_event_initialize(yaml_event_t *event)
Create a MAPPING-END event.
Definition: ymlApi.c:969
unsigned char * start
The beginning of the buffer.
Definition: yaml.h:1161
yaml_emitter_dump(yaml_emitter_t *emitter, yaml_document_t *document)
Emit a YAML document.
Expect a key of a flow mapping.
Definition: yaml.h:1058
Cannot write to the output stream.
Definition: yaml.h:141
yaml_parser_scan(yaml_parser_t *parser, yaml_token_t *token)
Scan the input stream and produce the next token.
Definition: ymlScanner.c:743
A SCALAR token.
Definition: yaml.h:265
A STREAM-START event.
Definition: yaml.h:360
Expect the first key of a flow mapping.
Definition: yaml.h:1055
int unicode
Allow unescaped non-ASCII characters?
Definition: yaml.h:1632
yaml_tag_directive_t * end
The end of the tag directives list.
Definition: yaml.h:800
yaml_event_type_e
Event types.
Definition: yaml.h:355
yaml_scalar_event_initialize(yaml_event_t *event, const yaml_char_t *anchor, const yaml_char_t *tag, const yaml_char_t *value, int length, int plain_implicit, int quoted_implicit, yaml_scalar_style_t style)
Create a SCALAR event.
Definition: ymlApi.c:821
yaml_emitter_open(yaml_emitter_t *emitter)
Start a YAML stream.
int best_width
The preferred width of the output lines.
Definition: yaml.h:1630
const char * problem
Error description.
Definition: yaml.h:1097
yaml_emitter_set_indent(yaml_emitter_t *emitter, int indent)
Set the indentation increment.
Definition: ymlApi.c:536
yaml_token_type_e
Token types.
Definition: yaml.h:215
unsigned char * pointer
The current position of the buffer.
Definition: yaml.h:1165
int possible
Is a simple key possible?
Definition: yaml.h:997
yaml_event_t * tail
The tail of the event queue.
Definition: yaml.h:1658
yaml_char_t * value
The scalar value.
Definition: yaml.h:733
The flow mapping style.
Definition: yaml.h:203
Expect a value of an ordered mapping.
Definition: yaml.h:1051
yaml_get_version(int *major, int *minor, int *patch)
Get the library version numbers.
Definition: ymlApi.c:19
enum yaml_mapping_style_e yaml_mapping_style_t
Mapping styles.
Expect a block node.
Definition: yaml.h:1025
A BLOCK-ENTRY token.
Definition: yaml.h:250
yaml_tag_directive_t * end
The end of the list.
Definition: yaml.h:1676
const char * problem
Error description.
Definition: yaml.h:1556
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:1167
Let the emitter choose the style.
Definition: yaml.h:168
yaml_emitter_initialize(yaml_emitter_t *emitter)
Initialize an emitter.
Definition: ymlApi.c:355
size_t column
The position column.
Definition: yaml.h:155
yaml_emitter_delete(yaml_emitter_t *emitter)
Destroy an emitter.
Definition: ymlApi.c:392
The document structure.
Definition: yaml.h:780
yaml_document_get_root_node(yaml_document_t *document)
Get the root of a YAML document node.
Definition: ymlApi.c:1180
A KEY token.
Definition: yaml.h:254
yaml_mapping_style_t style
The mapping style.
Definition: yaml.h:767
yaml_char_t * prefix
The tag prefix.
Definition: yaml.h:326
int flow_level
The number of unclosed &#39;[&#39; and &#39;{&#39; indicators.
Definition: yaml.h:1195
yaml_emitter_state_t * end
The end of the stack.
Definition: yaml.h:1641
yaml_token_t * start
The beginning of the tokens queue.
Definition: yaml.h:1200
Expect a block mapping key.
Definition: yaml.h:1040
yaml_mark_t * end
The end of the stack.
Definition: yaml.h:1268
yaml_event_type_t type
The event type.
Definition: yaml.h:389
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:1014
The token structure.
Definition: yaml.h:269
yaml_mark_t end_mark
The end of the document.
Definition: yaml.h:811
An ALIAS event.
Definition: yaml.h:370
yaml_mark_t start_mark
The beginning of the event.
Definition: yaml.h:474
The flow sequence style.
Definition: yaml.h:192
yaml_sequence_style_t style
The sequence style.
Definition: yaml.h:752
An empty event.
Definition: yaml.h:357
int * top
The top of the stack.
Definition: yaml.h:1668
The block sequence style.
Definition: yaml.h:190
yaml_mark_t start_mark
The beginning of the token.
Definition: yaml.h:332
int eof
EOF flag.
Definition: yaml.h:1141
int plain_implicit
Is the tag optional for the plain style?
Definition: yaml.h:440
The single-quoted scalar style.
Definition: yaml.h:174
yaml_parser_state_t * start
The beginning of the stack.
Definition: yaml.h:1253
size_t length
The length of the scalar value.
Definition: yaml.h:438