| [162] | 1 | |
|---|
| [169] | 2 | #ifndef YAML_H |
|---|
| 3 | #define YAML_H |
|---|
| [162] | 4 | |
|---|
| 5 | #ifdef __cplusplus |
|---|
| 6 | extern "C" { |
|---|
| 7 | #endif |
|---|
| 8 | |
|---|
| [169] | 9 | #include <stdlib.h> |
|---|
| [162] | 10 | |
|---|
| [169] | 11 | #include "yaml_version.h" |
|---|
| 12 | #include "yaml_error.h" |
|---|
| 13 | |
|---|
| [162] | 14 | typedef enum { |
|---|
| [169] | 15 | YAML_DETECT_ENCODING, |
|---|
| [162] | 16 | YAML_UTF8_ENCODING, |
|---|
| 17 | YAML_UTF16LE_ENCODING, |
|---|
| 18 | YAML_UTF16BE_ENCODING |
|---|
| 19 | } yaml_encoding_t; |
|---|
| 20 | |
|---|
| 21 | typedef enum { |
|---|
| [169] | 22 | YAML_ANY_SCALAR_STYLE, |
|---|
| [162] | 23 | YAML_PLAIN_SCALAR_STYLE, |
|---|
| 24 | YAML_SINGLE_QUOTED_SCALAR_STYLE, |
|---|
| 25 | YAML_DOUBLE_QUOTED_SCALAR_STYLE, |
|---|
| 26 | YAML_LITERAL_SCALAR_STYLE, |
|---|
| 27 | YAML_FOLDED_SCALAR_STYLE |
|---|
| 28 | } yaml_scalar_style_t; |
|---|
| 29 | |
|---|
| 30 | typedef enum { |
|---|
| [169] | 31 | YAML_ANY_SEQUENCE_STYLE, |
|---|
| [162] | 32 | YAML_BLOCK_SEQUENCE_STYLE, |
|---|
| 33 | YAML_FLOW_SEQUENCE_STYLE |
|---|
| 34 | } yaml_sequence_style_t; |
|---|
| 35 | |
|---|
| 36 | typedef enum { |
|---|
| [169] | 37 | YAML_ANY_MAPPING_STYLE, |
|---|
| [162] | 38 | YAML_BLOCK_MAPPING_STYLE, |
|---|
| 39 | YAML_FLOW_MAPPING_STYLE |
|---|
| 40 | } yaml_mapping_style_t; |
|---|
| 41 | |
|---|
| 42 | typedef enum { |
|---|
| 43 | YAML_STREAM_START_TOKEN, |
|---|
| 44 | YAML_STREAM_END_TOKEN, |
|---|
| [169] | 45 | |
|---|
| [162] | 46 | YAML_VERSION_DIRECTIVE_TOKEN, |
|---|
| 47 | YAML_TAG_DIRECTIVE_TOKEN, |
|---|
| 48 | YAML_DOCUMENT_START_TOKEN, |
|---|
| 49 | YAML_DOCUMENT_END_TOKEN, |
|---|
| [169] | 50 | |
|---|
| [162] | 51 | YAML_BLOCK_SEQUENCE_START_TOKEN, |
|---|
| 52 | YAML_BLOCK_MAPPING_START_TOKEN, |
|---|
| 53 | YAML_BLOCK_END_TOKEN, |
|---|
| [169] | 54 | |
|---|
| [162] | 55 | YAML_FLOW_SEQUENCE_START_TOKEN, |
|---|
| 56 | YAML_FLOW_SEQUENCE_END_TOKEN, |
|---|
| 57 | YAML_FLOW_MAPPING_START_TOKEN, |
|---|
| 58 | YAML_FLOW_MAPPING_END_TOKEN, |
|---|
| [169] | 59 | |
|---|
| [162] | 60 | YAML_BLOCK_ENTRY_TOKEN, |
|---|
| 61 | YAML_FLOW_ENTRY_TOKEN, |
|---|
| 62 | YAML_KEY_TOKEN, |
|---|
| 63 | YAML_VALUE_TOKEN, |
|---|
| [169] | 64 | |
|---|
| [162] | 65 | YAML_ALIAS_TOKEN, |
|---|
| 66 | YAML_ANCHOR_TOKEN, |
|---|
| 67 | YAML_TAG_TOKEN, |
|---|
| 68 | YAML_SCALAR_TOKEN |
|---|
| 69 | } yaml_token_type_t; |
|---|
| 70 | |
|---|
| 71 | typedef enum { |
|---|
| 72 | YAML_STREAM_START_EVENT, |
|---|
| 73 | YAML_STREAM_END_EVENT, |
|---|
| [169] | 74 | |
|---|
| [162] | 75 | YAML_DOCUMENT_START_EVENT, |
|---|
| 76 | YAML_DOCUMENT_END_EVENT, |
|---|
| [169] | 77 | |
|---|
| [162] | 78 | YAML_ALIAS_EVENT, |
|---|
| [169] | 79 | YAML_SCALAR_EVENT, |
|---|
| 80 | |
|---|
| [162] | 81 | YAML_SEQUENCE_START_EVENT, |
|---|
| 82 | YAML_SEQUENCE_END_EVENT, |
|---|
| [169] | 83 | |
|---|
| [162] | 84 | YAML_MAPPING_START_EVENT, |
|---|
| [169] | 85 | YAML_MAPPING_END_EVENT |
|---|
| [162] | 86 | } yaml_event_type_t; |
|---|
| 87 | |
|---|
| 88 | typedef struct { |
|---|
| [169] | 89 | size_t offset; |
|---|
| [162] | 90 | size_t index; |
|---|
| 91 | size_t line; |
|---|
| 92 | size_t column; |
|---|
| 93 | } yaml_mark_t; |
|---|
| 94 | |
|---|
| 95 | typedef struct { |
|---|
| 96 | yaml_error_type_t type; |
|---|
| 97 | char *context; |
|---|
| 98 | yaml_mark_t context_mark; |
|---|
| 99 | char *problem; |
|---|
| 100 | yaml_mark_t problem_mark; |
|---|
| 101 | } yaml_error_t; |
|---|
| 102 | |
|---|
| 103 | typedef struct { |
|---|
| 104 | yaml_token_type_t type; |
|---|
| 105 | union { |
|---|
| 106 | yaml_encoding_t encoding; |
|---|
| [169] | 107 | char *anchor; |
|---|
| 108 | char *tag; |
|---|
| [162] | 109 | struct { |
|---|
| [169] | 110 | char *value; |
|---|
| 111 | size_t length; |
|---|
| [162] | 112 | yaml_scalar_style_t style; |
|---|
| 113 | } scalar; |
|---|
| 114 | struct { |
|---|
| 115 | int major; |
|---|
| 116 | int minor; |
|---|
| 117 | } version; |
|---|
| 118 | struct { |
|---|
| [169] | 119 | char *handle; |
|---|
| 120 | char *prefix; |
|---|
| [162] | 121 | } tag_pair; |
|---|
| 122 | } data; |
|---|
| 123 | yaml_mark_t start_mark; |
|---|
| 124 | yaml_mark_t end_mark; |
|---|
| 125 | } yaml_token_t; |
|---|
| 126 | |
|---|
| 127 | typedef struct { |
|---|
| 128 | yaml_event_type_t type; |
|---|
| 129 | union { |
|---|
| 130 | struct { |
|---|
| 131 | yaml_encoding_t encoding; |
|---|
| 132 | } stream_start; |
|---|
| 133 | struct { |
|---|
| 134 | struct { |
|---|
| 135 | int major; |
|---|
| 136 | int minor; |
|---|
| 137 | } version; |
|---|
| 138 | struct { |
|---|
| [169] | 139 | char *handle; |
|---|
| 140 | char *prefix; |
|---|
| [162] | 141 | } **tag_pairs; |
|---|
| 142 | int implicit; |
|---|
| 143 | } document_start; |
|---|
| 144 | struct { |
|---|
| 145 | int implicit; |
|---|
| 146 | } document_end; |
|---|
| 147 | struct { |
|---|
| [169] | 148 | char *anchor; |
|---|
| [162] | 149 | } alias; |
|---|
| 150 | struct { |
|---|
| [169] | 151 | char *anchor; |
|---|
| 152 | char *tag; |
|---|
| 153 | char *value; |
|---|
| 154 | size_t length; |
|---|
| [162] | 155 | int plain_implicit; |
|---|
| 156 | int quoted_implicit; |
|---|
| 157 | yaml_scalar_style_t style; |
|---|
| 158 | } scalar; |
|---|
| 159 | struct { |
|---|
| [169] | 160 | char *anchor; |
|---|
| 161 | char *tag; |
|---|
| [162] | 162 | int implicit; |
|---|
| 163 | yaml_sequence_style_t style; |
|---|
| 164 | } sequence_start; |
|---|
| 165 | struct { |
|---|
| [169] | 166 | char *anchor; |
|---|
| 167 | char *tag; |
|---|
| [162] | 168 | int implicit; |
|---|
| 169 | yaml_mapping_style_t style; |
|---|
| 170 | } mapping_start; |
|---|
| 171 | } data; |
|---|
| 172 | yaml_mark_t start_mark; |
|---|
| 173 | yaml_mark_t end_mark; |
|---|
| 174 | } yaml_event_t; |
|---|
| 175 | |
|---|
| [169] | 176 | /* |
|---|
| [162] | 177 | typedef struct { |
|---|
| 178 | } yaml_parser_t; |
|---|
| 179 | |
|---|
| 180 | typedef struct { |
|---|
| 181 | } yaml_emitter_t; |
|---|
| [169] | 182 | */ |
|---|
| [162] | 183 | |
|---|
| 184 | #ifdef __cplusplus |
|---|
| 185 | } |
|---|
| 186 | #endif |
|---|
| 187 | |
|---|
| [169] | 188 | #endif /* #ifndef YAML_H */ |
|---|
| [162] | 189 | |
|---|