| 1 | |
|---|
| 2 | #if HAVE_CONFIG_H |
|---|
| 3 | #include <config.h> |
|---|
| 4 | #endif |
|---|
| 5 | |
|---|
| 6 | #include <yaml.h> |
|---|
| 7 | |
|---|
| 8 | #include <assert.h> |
|---|
| 9 | #include <limits.h> |
|---|
| 10 | |
|---|
| 11 | /* |
|---|
| 12 | * Memory management. |
|---|
| 13 | */ |
|---|
| 14 | |
|---|
| 15 | YAML_DECLARE(void *) |
|---|
| 16 | yaml_malloc(size_t size); |
|---|
| 17 | |
|---|
| 18 | YAML_DECLARE(void *) |
|---|
| 19 | yaml_realloc(void *ptr, size_t size); |
|---|
| 20 | |
|---|
| 21 | YAML_DECLARE(void) |
|---|
| 22 | yaml_free(void *ptr); |
|---|
| 23 | |
|---|
| 24 | YAML_DECLARE(yaml_char_t *) |
|---|
| 25 | yaml_strdup(const yaml_char_t *); |
|---|
| 26 | |
|---|
| 27 | /* |
|---|
| 28 | * Error management. |
|---|
| 29 | */ |
|---|
| 30 | |
|---|
| 31 | #define ERROR_INIT(error,error_type) \ |
|---|
| 32 | (memset(&(error), 0, sizeof(error)), \ |
|---|
| 33 | (error).type = (error_type), \ |
|---|
| 34 | 0) |
|---|
| 35 | |
|---|
| 36 | #define READING_ERROR_INIT(error,error_type,error_problem,error_offset,error_value) \ |
|---|
| 37 | (memset(&(error), 0, sizeof(error)), \ |
|---|
| 38 | (error).type = (error_type), \ |
|---|
| 39 | (error).data.reading.problem = (error_problem), \ |
|---|
| 40 | (error).data.reading.offset = (error_offset), \ |
|---|
| 41 | (error).data.reading.value = (error_value), \ |
|---|
| 42 | 0) |
|---|
| 43 | |
|---|
| 44 | #define LOADING_ERROR_INIT(error,error_type,error_problem,error_problem_mark) \ |
|---|
| 45 | (memset(&(error), 0, sizeof(error)), \ |
|---|
| 46 | (error).type = (error_type), \ |
|---|
| 47 | (error).data.loading.context = NULL, \ |
|---|
| 48 | (error).data.loading.context_mark.index = 0, \ |
|---|
| 49 | (error).data.loading.context_mark.line = 0, \ |
|---|
| 50 | (error).data.loading.context_mark.column = 0, \ |
|---|
| 51 | (error).data.loading.problem = (error_problem), \ |
|---|
| 52 | (error).data.loading.problem_mark = (error_problem_mark), \ |
|---|
| 53 | 0) |
|---|
| 54 | |
|---|
| 55 | #define LOADING_ERROR_WITH_CONTEXT_INIT(error,error_type,error_context,error_context_mark,error_problem,error_problem_mark) \ |
|---|
| 56 | (memset(&(error), 0, sizeof(error)), \ |
|---|
| 57 | (error).type = (error_type), \ |
|---|
| 58 | (error).data.loading.context = (error_context), \ |
|---|
| 59 | (error).data.loading.context_mark = (error_context_mark), \ |
|---|
| 60 | (error).data.loading.problem = (error_problem), \ |
|---|
| 61 | (error).data.loading.problem_mark = (error_problem_mark), \ |
|---|
| 62 | 0) |
|---|
| 63 | |
|---|
| 64 | #define WRITING_ERROR_INIT(error,error_type,error_problem,error_offset) \ |
|---|
| 65 | (memset(&(error), 0, sizeof(error)), \ |
|---|
| 66 | (error).type = (error_type), \ |
|---|
| 67 | (error).data.writing.problem = (error_problem), \ |
|---|
| 68 | (error).data.writing.offset = (error_offset), \ |
|---|
| 69 | 0) |
|---|
| 70 | |
|---|
| 71 | #define DUMPING_ERROR_INIT(error,error_type,error_problem) \ |
|---|
| 72 | (memset(&(error), 0, sizeof(error)), \ |
|---|
| 73 | (error).type = (error_type), \ |
|---|
| 74 | (error).type.dumping.problem = (error_problem), \ |
|---|
| 75 | 0) |
|---|
| 76 | |
|---|
| 77 | #define MEMORY_ERROR_INIT(self) \ |
|---|
| 78 | ERROR_INIT((self)->error,YAML_MEMORY_ERROR) |
|---|
| 79 | |
|---|
| 80 | #define READER_ERROR_INIT(self,problem,offset) \ |
|---|
| 81 | READING_ERROR_INIT((self)->error,YAML_READER_ERROR,problem,offset,-1) |
|---|
| 82 | |
|---|
| 83 | #define DECODER_ERROR_INIT(self,problem,offset,value) \ |
|---|
| 84 | READING_ERROR_INIT((self)->error,YAML_DECODER_ERROR,problem,offset,value) |
|---|
| 85 | |
|---|
| 86 | #define SCANNER_ERROR_INIT(self,problem,problem_mark) \ |
|---|
| 87 | LOADING_ERROR_INIT((self)->error,YAML_SCANNER_ERROR,problem,problem_mark) |
|---|
| 88 | |
|---|
| 89 | #define SCANNER_ERROR_WITH_CONTEXT_INIT(self,context,context_mark,problem,problem_mark) \ |
|---|
| 90 | LOADING_ERROR_WITH_CONTEXT_INIT((self)->error,YAML_SCANNER_ERROR,context,context_mark,problem,problem_mark) |
|---|
| 91 | |
|---|
| 92 | #define PARSER_ERROR_INIT(self,problem,problem_mark) \ |
|---|
| 93 | LOADING_ERROR_INIT((self)->error,YAML_PARSER_ERROR,problem,problem_mark) |
|---|
| 94 | |
|---|
| 95 | #define PARSER_ERROR_WITH_CONTEXT_INIT(self,context,context_mark,problem,problem_mark) \ |
|---|
| 96 | LOADING_ERROR_WITH_CONTEXT_INIT((self)->error,YAML_PARSER_ERROR,context,context_mark,problem,problem_mark) |
|---|
| 97 | |
|---|
| 98 | #define COMPOSER_ERROR_INIT(self,problem,problem_mark) \ |
|---|
| 99 | LOADING_ERROR_INIT((self)->error,YAML_COMPOSER_ERROR,problem,problem_mark) |
|---|
| 100 | |
|---|
| 101 | #define COMPOSER_ERROR_WITH_CONTEXT_INIT(self,context,context_mark,problem,problem_mark) \ |
|---|
| 102 | LOADING_ERROR_WITH_CONTEXT_INIT((self)->error,YAML_COMPOSER_ERROR,context,context_mark,problem,problem_mark) |
|---|
| 103 | |
|---|
| 104 | #define WRITER_ERROR_INIT(self,problem,offset) \ |
|---|
| 105 | WRITING_ERROR_INIT((self)->error,YAML_WRITER_ERROR,problem,offset) |
|---|
| 106 | |
|---|
| 107 | #define EMITTER_ERROR_INIT(self,context,problem) \ |
|---|
| 108 | DUMPING_ERROR_INIT((self)->error,YAML_EMITTER_ERROR,problem) |
|---|
| 109 | |
|---|
| 110 | #define SERIALIZER_ERROR_INIT(self,context) \ |
|---|
| 111 | DUMPING_ERROR_INIT((self)->error,YAML_SERIALIZER_ERROR,problem) |
|---|
| 112 | |
|---|
| 113 | /* |
|---|
| 114 | * The size of the input raw buffer. |
|---|
| 115 | */ |
|---|
| 116 | |
|---|
| 117 | #define RAW_INPUT_BUFFER_CAPACITY 16384 |
|---|
| 118 | |
|---|
| 119 | /* |
|---|
| 120 | * The size of the input buffer. |
|---|
| 121 | * |
|---|
| 122 | * The input buffer should be large enough to hold the content of the raw |
|---|
| 123 | * buffer after it is decoded. |
|---|
| 124 | */ |
|---|
| 125 | |
|---|
| 126 | #define INPUT_BUFFER_CAPACITY (RAW_INPUT_BUFFER_CAPACITY*3) |
|---|
| 127 | |
|---|
| 128 | /* |
|---|
| 129 | * The size of the output buffer. |
|---|
| 130 | */ |
|---|
| 131 | |
|---|
| 132 | #define OUTPUT_BUFFER_CAPACITY 16384 |
|---|
| 133 | |
|---|
| 134 | /* |
|---|
| 135 | * The size of the output raw buffer. |
|---|
| 136 | * |
|---|
| 137 | * The raw buffer should be able to hold the content of the output buffer |
|---|
| 138 | * after it is encoded. |
|---|
| 139 | */ |
|---|
| 140 | |
|---|
| 141 | #define RAW_OUTPUT_BUFFER_CAPACITY (OUTPUT_BUFFER_CAPACITY*2+2) |
|---|
| 142 | |
|---|
| 143 | /* |
|---|
| 144 | * The size of other stacks and queues. |
|---|
| 145 | */ |
|---|
| 146 | |
|---|
| 147 | #define INITIAL_STACK_CAPACITY 16 |
|---|
| 148 | #define INITIAL_QUEUE_CAPACITY 16 |
|---|
| 149 | #define INITIAL_STRING_CAPACITY 16 |
|---|
| 150 | |
|---|
| 151 | /* |
|---|
| 152 | * Input/output buffer management. |
|---|
| 153 | */ |
|---|
| 154 | |
|---|
| 155 | #define STORAGE_INIT(self,storage,storage_capacity) \ |
|---|
| 156 | (((storage).buffer = yaml_malloc(storage_capacity)) ? \ |
|---|
| 157 | ((storage).pointer = (storage).length = 0, \ |
|---|
| 158 | (buffer).capacity = (storage_capacity) \ |
|---|
| 159 | 1) : \ |
|---|
| 160 | ((self)->error.type = YAML_MEMORY_ERROR, \ |
|---|
| 161 | 0)) |
|---|
| 162 | |
|---|
| 163 | #define STORAGE_DEL(self,storage) \ |
|---|
| 164 | (yaml_free((storage).buffer), \ |
|---|
| 165 | (storage).pointer = (storage).length = (storage).capacity = 0) |
|---|
| 166 | |
|---|
| 167 | /* |
|---|
| 168 | * String management. |
|---|
| 169 | */ |
|---|
| 170 | |
|---|
| 171 | typedef struct yaml_string_s { |
|---|
| 172 | yaml_char_t *buffer; |
|---|
| 173 | size_t pointer; |
|---|
| 174 | size_t capacity; |
|---|
| 175 | } yaml_string_t; |
|---|
| 176 | |
|---|
| 177 | YAML_DECLARE(int) |
|---|
| 178 | yaml_string_extend(yaml_char_t **buffer, size_t *capacity); |
|---|
| 179 | |
|---|
| 180 | YAML_DECLARE(int) |
|---|
| 181 | yaml_string_join( |
|---|
| 182 | yaml_char_t **base_buffer, size_t *base_pointer, size_t *base_capacity, |
|---|
| 183 | yaml_char_t *adj_buffer, size_t adj_pointer, size_t adj_capacity); |
|---|
| 184 | |
|---|
| 185 | #define NULL_STRING { NULL, NULL, NULL } |
|---|
| 186 | |
|---|
| 187 | #define STRING(string,capacity) { (string), 0, (capacity) } |
|---|
| 188 | |
|---|
| 189 | #define STRING_INIT(self,string,string_capacity) \ |
|---|
| 190 | (((string).buffer = yaml_malloc(string_capacity)) ? \ |
|---|
| 191 | ((string).pointer = 0, \ |
|---|
| 192 | (string).capacity = (string_capacity), \ |
|---|
| 193 | memset((string).buffer, 0, (string_capacity)), \ |
|---|
| 194 | 1) : \ |
|---|
| 195 | ((self)->error.type = YAML_MEMORY_ERROR, \ |
|---|
| 196 | 0)) |
|---|
| 197 | |
|---|
| 198 | #define STRING_DEL(self,string) \ |
|---|
| 199 | (yaml_free((string).buffer), \ |
|---|
| 200 | (string).buffer = NULL, \ |
|---|
| 201 | ((string).pointer = (string).capacity = 0)) |
|---|
| 202 | |
|---|
| 203 | #define STRING_EXTEND(self,string) \ |
|---|
| 204 | ((((string).pointer+5 < (string).capacity) \ |
|---|
| 205 | || yaml_string_extend(&(string).buffer, &(string).capacity)) ? \ |
|---|
| 206 | 1 : \ |
|---|
| 207 | ((self)->error.type = YAML_MEMORY_ERROR, \ |
|---|
| 208 | 0)) |
|---|
| 209 | |
|---|
| 210 | #define CLEAR(self,string) \ |
|---|
| 211 | ((string).pointer = 0, \ |
|---|
| 212 | memset((string).buffer, 0, (string).capacity)) |
|---|
| 213 | |
|---|
| 214 | #define JOIN(self,base_string,adj_string) \ |
|---|
| 215 | ((yaml_string_join(&(base_string).buffer, &(base_string).pointer, \ |
|---|
| 216 | &(base_string).capacity, (adj_string).buffer, \ |
|---|
| 217 | (adj_string).pointer, (adj_string).capacity)) ? \ |
|---|
| 218 | ((adj_string).pointer = 0, \ |
|---|
| 219 | 1) : \ |
|---|
| 220 | ((self)->error.type = YAML_MEMORY_ERROR, \ |
|---|
| 221 | 0)) |
|---|
| 222 | |
|---|
| 223 | /* |
|---|
| 224 | * String check operations. |
|---|
| 225 | */ |
|---|
| 226 | |
|---|
| 227 | /* |
|---|
| 228 | * Get the octet at the specified position. |
|---|
| 229 | */ |
|---|
| 230 | |
|---|
| 231 | #define OCTET_AT(string,offset) \ |
|---|
| 232 | ((string).buffer[(string).pointer+(offset)]) |
|---|
| 233 | |
|---|
| 234 | /* |
|---|
| 235 | * Get the current offset. |
|---|
| 236 | */ |
|---|
| 237 | |
|---|
| 238 | #define OCTET(string) OCTET_AT((string),0) |
|---|
| 239 | |
|---|
| 240 | /* |
|---|
| 241 | * Check the octet at the specified position. |
|---|
| 242 | */ |
|---|
| 243 | |
|---|
| 244 | #define CHECK_AT(string,octet,offset) \ |
|---|
| 245 | (OCTET_AT((string),(offset)) == (yaml_char_t)(octet)) |
|---|
| 246 | |
|---|
| 247 | /* |
|---|
| 248 | * Check the current octet in the buffer. |
|---|
| 249 | */ |
|---|
| 250 | |
|---|
| 251 | #define CHECK(string,octet) CHECK_AT((string),(octet),0) |
|---|
| 252 | |
|---|
| 253 | /* |
|---|
| 254 | * Check if the character at the specified position is an alphabetical |
|---|
| 255 | * character, a digit, '_', or '-'. |
|---|
| 256 | */ |
|---|
| 257 | |
|---|
| 258 | #define IS_ALPHA_AT(string,offset) \ |
|---|
| 259 | ((OCTET_AT((string),(offset)) >= (yaml_char_t) '0' && \ |
|---|
| 260 | OCTET_AT((string),(offset)) <= (yaml_char_t) '9') || \ |
|---|
| 261 | (OCTET_AT((string),(offset)) >= (yaml_char_t) 'A' && \ |
|---|
| 262 | OCTET_AT((string),(offset)) <= (yaml_char_t) 'Z') || \ |
|---|
| 263 | (OCTET_AT((string),(offset)) >= (yaml_char_t) 'a' && \ |
|---|
| 264 | OCTET_AT((string),(offset)) <= (yaml_char_t) 'z') || \ |
|---|
| 265 | OCTET_AT((string),(offset)) == '_' || \ |
|---|
| 266 | OCTET_AT((string),(offset)) == '-') |
|---|
| 267 | |
|---|
| 268 | #define IS_ALPHA(string) IS_ALPHA_AT((string),0) |
|---|
| 269 | |
|---|
| 270 | /* |
|---|
| 271 | * Check if the character at the specified position is a digit. |
|---|
| 272 | */ |
|---|
| 273 | |
|---|
| 274 | #define IS_DIGIT_AT(string,offset) \ |
|---|
| 275 | ((OCTET_AT((string),(offset)) >= (yaml_char_t) '0' && \ |
|---|
| 276 | OCTET_AT((string),(offset)) <= (yaml_char_t) '9')) |
|---|
| 277 | |
|---|
| 278 | #define IS_DIGIT(string) IS_DIGIT_AT((string),0) |
|---|
| 279 | |
|---|
| 280 | /* |
|---|
| 281 | * Get the value of a digit. |
|---|
| 282 | */ |
|---|
| 283 | |
|---|
| 284 | #define AS_DIGIT_AT(string,offset) \ |
|---|
| 285 | (OCTET_AT((string),(offset)) - (yaml_char_t) '0') |
|---|
| 286 | |
|---|
| 287 | #define AS_DIGIT(string) AS_DIGIT_AT((string),0) |
|---|
| 288 | |
|---|
| 289 | /* |
|---|
| 290 | * Check if the character at the specified position is a hex-digit. |
|---|
| 291 | */ |
|---|
| 292 | |
|---|
| 293 | #define IS_HEX_AT(string,offset) \ |
|---|
| 294 | ((OCTET_AT((string),(offset)) >= (yaml_char_t) '0' && \ |
|---|
| 295 | OCTET_AT((string),(offset)) <= (yaml_char_t) '9') || \ |
|---|
| 296 | (OCTET_AT((string),(offset)) >= (yaml_char_t) 'A' && \ |
|---|
| 297 | OCTET_AT((string),(offset)) <= (yaml_char_t) 'F') || \ |
|---|
| 298 | (OCTET_AT((string),(offset)) >= (yaml_char_t) 'a' && \ |
|---|
| 299 | OCTET_AT((string),(offset)) <= (yaml_char_t) 'f')) |
|---|
| 300 | |
|---|
| 301 | #define IS_HEX(string) IS_HEX_AT((string),0) |
|---|
| 302 | |
|---|
| 303 | /* |
|---|
| 304 | * Get the value of a hex-digit. |
|---|
| 305 | */ |
|---|
| 306 | |
|---|
| 307 | #define AS_HEX_AT(string,offset) \ |
|---|
| 308 | ((OCTET_AT((string),(offset)) >= (yaml_char_t) 'A' && \ |
|---|
| 309 | OCTET_AT((string),(offset)) <= (yaml_char_t) 'F') ? \ |
|---|
| 310 | (OCTET_AT((string),(offset)) - (yaml_char_t) 'A' + 10) : \ |
|---|
| 311 | (OCTET_AT((string),(offset)) >= (yaml_char_t) 'a' && \ |
|---|
| 312 | OCTET_AT((string),(offset)) <= (yaml_char_t) 'f') ? \ |
|---|
| 313 | (OCTET_AT((string),(offset)) - (yaml_char_t) 'a' + 10) : \ |
|---|
| 314 | (OCTET_AT((string),(offset)) - (yaml_char_t) '0')) |
|---|
| 315 | |
|---|
| 316 | #define AS_HEX(string) AS_HEX_AT((string),0) |
|---|
| 317 | |
|---|
| 318 | /* |
|---|
| 319 | * Check if the character is ASCII. |
|---|
| 320 | */ |
|---|
| 321 | |
|---|
| 322 | #define IS_ASCII_AT(string,offset) \ |
|---|
| 323 | (OCTET_AT((string),(offset)) <= (yaml_char_t) '\x7F') |
|---|
| 324 | |
|---|
| 325 | #define IS_ASCII(string) IS_ASCII_AT((string),0) |
|---|
| 326 | |
|---|
| 327 | /* |
|---|
| 328 | * Check if the character can be printed unescaped. |
|---|
| 329 | */ |
|---|
| 330 | |
|---|
| 331 | #define IS_PRINTABLE_AT(string,offset) \ |
|---|
| 332 | ((OCTET_AT((string),(offset)) == 0x0A) /* . == #x0A */ \ |
|---|
| 333 | || (OCTET_AT((string),(offset)) >= 0x20 /* #x20 <= . <= #x7E */ \ |
|---|
| 334 | && OCTET_AT((string),(offset)) <= 0x7E) \ |
|---|
| 335 | || (OCTET_AT((string),(offset)) == 0xC2 /* #0xA0 <= . <= #xD7FF */ \ |
|---|
| 336 | && OCTET_AT((string),(offset)+1) >= 0xA0) \ |
|---|
| 337 | || (OCTET_AT((string),(offset)) > 0xC2 \ |
|---|
| 338 | && OCTET_AT((string),(offset)) < 0xED) \ |
|---|
| 339 | || (OCTET_AT((string),(offset)) == 0xED \ |
|---|
| 340 | && OCTET_AT((string),(offset)+1) < 0xA0) \ |
|---|
| 341 | || (OCTET_AT((string),(offset)) == 0xEE) \ |
|---|
| 342 | || (OCTET_AT((string),(offset)) == 0xEF /* #xE000 <= . <= #xFFFD */ \ |
|---|
| 343 | && !(OCTET_AT((string),(offset)+1) == 0xBB /* && . != #xFEFF */ \ |
|---|
| 344 | && OCTET_AT((string),(offset)+2) == 0xBF) \ |
|---|
| 345 | && !(OCTET_AT((string),(offset)+1) == 0xBF \ |
|---|
| 346 | && (OCTET_AT((string),(offset)+2) == 0xBE \ |
|---|
| 347 | || OCTET_AT((string),(offset)+2) == 0xBF)))) |
|---|
| 348 | |
|---|
| 349 | #define IS_PRINTABLE(string) IS_PRINTABLE_AT((string),0) |
|---|
| 350 | |
|---|
| 351 | /* |
|---|
| 352 | * Check if the character at the specified position is NUL. |
|---|
| 353 | */ |
|---|
| 354 | |
|---|
| 355 | #define IS_Z_AT(string,offset) CHECK_AT((string),'\0',(offset)) |
|---|
| 356 | |
|---|
| 357 | #define IS_Z(string) IS_Z_AT((string),0) |
|---|
| 358 | |
|---|
| 359 | /* |
|---|
| 360 | * Check if the character at the specified position is BOM. |
|---|
| 361 | */ |
|---|
| 362 | |
|---|
| 363 | #define IS_BOM_AT(string,offset) \ |
|---|
| 364 | (CHECK_AT((string),'\xEF',(offset)) \ |
|---|
| 365 | && CHECK_AT((string),'\xBB',(offset)+1) \ |
|---|
| 366 | && CHECK_AT((string),'\xBF',(offset)+2)) /* BOM (#xFEFF) */ |
|---|
| 367 | |
|---|
| 368 | #define IS_BOM(string) IS_BOM_AT(string,0) |
|---|
| 369 | |
|---|
| 370 | /* |
|---|
| 371 | * Check if the character at the specified position is space. |
|---|
| 372 | */ |
|---|
| 373 | |
|---|
| 374 | #define IS_SPACE_AT(string,offset) CHECK_AT((string),' ',(offset)) |
|---|
| 375 | |
|---|
| 376 | #define IS_SPACE(string) IS_SPACE_AT((string),0) |
|---|
| 377 | |
|---|
| 378 | /* |
|---|
| 379 | * Check if the character at the specified position is tab. |
|---|
| 380 | */ |
|---|
| 381 | |
|---|
| 382 | #define IS_TAB_AT(string,offset) CHECK_AT((string),'\t',(offset)) |
|---|
| 383 | |
|---|
| 384 | #define IS_TAB(string) IS_TAB_AT((string),0) |
|---|
| 385 | |
|---|
| 386 | /* |
|---|
| 387 | * Check if the character at the specified position is blank (space or tab). |
|---|
| 388 | */ |
|---|
| 389 | |
|---|
| 390 | #define IS_BLANK_AT(string,offset) \ |
|---|
| 391 | (IS_SPACE_AT((string),(offset)) || IS_TAB_AT((string),(offset))) |
|---|
| 392 | |
|---|
| 393 | #define IS_BLANK(string) IS_BLANK_AT((string),0) |
|---|
| 394 | |
|---|
| 395 | /* |
|---|
| 396 | * Check if the character at the specified position is a line break. |
|---|
| 397 | */ |
|---|
| 398 | |
|---|
| 399 | #define IS_BREAK_AT(string,offset) \ |
|---|
| 400 | (CHECK_AT((string),'\r',(offset)) /* CR (#xD)*/ \ |
|---|
| 401 | || CHECK_AT((string),'\n',(offset)) /* LF (#xA) */ \ |
|---|
| 402 | || (CHECK_AT((string),'\xC2',(offset)) \ |
|---|
| 403 | && CHECK_AT((string),'\x85',(offset)+1)) /* NEL (#x85) */ \ |
|---|
| 404 | || (CHECK_AT((string),'\xE2',(offset)) \ |
|---|
| 405 | && CHECK_AT((string),'\x80',(offset)+1) \ |
|---|
| 406 | && CHECK_AT((string),'\xA8',(offset)+2)) /* LS (#x2028) */ \ |
|---|
| 407 | || (CHECK_AT((string),'\xE2',(offset)) \ |
|---|
| 408 | && CHECK_AT((string),'\x80',(offset)+1) \ |
|---|
| 409 | && CHECK_AT((string),'\xA9',(offset)+2))) /* PS (#x2029) */ |
|---|
| 410 | |
|---|
| 411 | #define IS_BREAK(string) IS_BREAK_AT((string),0) |
|---|
| 412 | |
|---|
| 413 | #define IS_CRLF_AT(string,offset) \ |
|---|
| 414 | (CHECK_AT((string),'\r',(offset)) && CHECK_AT((string),'\n',(offset)+1)) |
|---|
| 415 | |
|---|
| 416 | #define IS_CRLF(string) IS_CRLF_AT((string),0) |
|---|
| 417 | |
|---|
| 418 | /* |
|---|
| 419 | * Check if the character is a line break or NUL. |
|---|
| 420 | */ |
|---|
| 421 | |
|---|
| 422 | #define IS_BREAKZ_AT(string,offset) \ |
|---|
| 423 | (IS_BREAK_AT((string),(offset)) || IS_Z_AT((string),(offset))) |
|---|
| 424 | |
|---|
| 425 | #define IS_BREAKZ(string) IS_BREAKZ_AT((string),0) |
|---|
| 426 | |
|---|
| 427 | /* |
|---|
| 428 | * Check if the character is a line break, space, or NUL. |
|---|
| 429 | */ |
|---|
| 430 | |
|---|
| 431 | #define IS_SPACEZ_AT(string,offset) \ |
|---|
| 432 | (IS_SPACE_AT((string),(offset)) || IS_BREAKZ_AT((string),(offset))) |
|---|
| 433 | |
|---|
| 434 | #define IS_SPACEZ(string) IS_SPACEZ_AT((string),0) |
|---|
| 435 | |
|---|
| 436 | /* |
|---|
| 437 | * Check if the character is a line break, space, tab, or NUL. |
|---|
| 438 | */ |
|---|
| 439 | |
|---|
| 440 | #define IS_BLANKZ_AT(string,offset) \ |
|---|
| 441 | (IS_BLANK_AT((string),(offset)) || IS_BREAKZ_AT((string),(offset))) |
|---|
| 442 | |
|---|
| 443 | #define IS_BLANKZ(string) IS_BLANKZ_AT((string),0) |
|---|
| 444 | |
|---|
| 445 | /* |
|---|
| 446 | * Determine the width of the character. |
|---|
| 447 | */ |
|---|
| 448 | |
|---|
| 449 | #define WIDTH_AT(string,offset) \ |
|---|
| 450 | ((OCTET_AT((string),(offset)) & 0x80) == 0x00 ? 1 : \ |
|---|
| 451 | (OCTET_AT((string),(offset)) & 0xE0) == 0xC0 ? 2 : \ |
|---|
| 452 | (OCTET_AT((string),(offset)) & 0xF0) == 0xE0 ? 3 : \ |
|---|
| 453 | (OCTET_AT((string),(offset)) & 0xF8) == 0xF0 ? 4 : 0) |
|---|
| 454 | |
|---|
| 455 | #define WIDTH(string) WIDTH_AT((string),0) |
|---|
| 456 | |
|---|
| 457 | /* |
|---|
| 458 | * Move the string pointer to the next character. |
|---|
| 459 | */ |
|---|
| 460 | |
|---|
| 461 | #define MOVE(string) ((string).pointer += WIDTH((string))) |
|---|
| 462 | |
|---|
| 463 | /* |
|---|
| 464 | * Copy a single octet and bump the pointers. |
|---|
| 465 | */ |
|---|
| 466 | |
|---|
| 467 | #define COPY_OCTET(string_a,string_b) \ |
|---|
| 468 | ((string_a).buffer[(string_a).pointer++] \ |
|---|
| 469 | = (string_b).buffer[(string_b).pointer++]) |
|---|
| 470 | |
|---|
| 471 | /* |
|---|
| 472 | * Copy a character and move the pointers of both strings. |
|---|
| 473 | */ |
|---|
| 474 | |
|---|
| 475 | #define COPY(string_a,string_b) \ |
|---|
| 476 | ((OCTET(string_b) & 0x80) == 0x00 ? \ |
|---|
| 477 | COPY_OCTET((string_a),(string_b)) : \ |
|---|
| 478 | (OCTET(string_b) & 0xE0) == 0xC0 ? \ |
|---|
| 479 | (COPY_OCTET((string_a),(string_b)), \ |
|---|
| 480 | COPY_OCTET((string_a),(string_b))) : \ |
|---|
| 481 | (OCTET(string_b) & 0xF0) == 0xE0 ? \ |
|---|
| 482 | (COPY_OCTET((string_a),(string_b)), \ |
|---|
| 483 | COPY_OCTET((string_a),(string_b)), \ |
|---|
| 484 | COPY_OCTET((string_a),(string_b))) : \ |
|---|
| 485 | (OCTET(string_b) & 0xF8) == 0xF0 ? \ |
|---|
| 486 | (COPY_OCTET((string_a),(string_b)), \ |
|---|
| 487 | COPY_OCTET((string_a),(string_b)), \ |
|---|
| 488 | COPY_OCTET((string_a),(string_b)), \ |
|---|
| 489 | COPY_OCTET((string_a),(string_b))) : 0) \ |
|---|
| 490 | |
|---|
| 491 | /* |
|---|
| 492 | * Stack and queue management. |
|---|
| 493 | */ |
|---|
| 494 | |
|---|
| 495 | YAML_DECLARE(int) |
|---|
| 496 | yaml_stack_extend(void **list, size_t size, size_t *length, size_t *capacity); |
|---|
| 497 | |
|---|
| 498 | YAML_DECLARE(int) |
|---|
| 499 | yaml_queue_extend(void **list, size_t size, |
|---|
| 500 | size_t *head, size_t *tail, size_t *capacity); |
|---|
| 501 | |
|---|
| 502 | #define STACK_INIT(self,stack,stack_capacity) \ |
|---|
| 503 | (((stack).list = yaml_malloc((stack_capacity)*sizeof(*(stack).list))) ? \ |
|---|
| 504 | ((stack).length = 0, \ |
|---|
| 505 | (stack).capacity = (stack_capacity), \ |
|---|
| 506 | 1) : \ |
|---|
| 507 | ((self)->error.type = YAML_MEMORY_ERROR, \ |
|---|
| 508 | 0)) |
|---|
| 509 | |
|---|
| 510 | #define STACK_DEL(self,stack) \ |
|---|
| 511 | (yaml_free((stack).list), \ |
|---|
| 512 | (stack).list = NULL, \ |
|---|
| 513 | (stack).length = (stack).capacity = 0) |
|---|
| 514 | |
|---|
| 515 | #define STACK_EMPTY(self,stack) \ |
|---|
| 516 | ((stack).length == 0) |
|---|
| 517 | |
|---|
| 518 | #define PUSH(self,stack,value) \ |
|---|
| 519 | (((stack).length < (stack).capacity \ |
|---|
| 520 | || yaml_stack_extend((void **)&(stack).list, sizeof(*(stack).list), \ |
|---|
| 521 | &(stack).length, &(stack).capacity)) ? \ |
|---|
| 522 | ((stack).list[(stack).length++] = (value), \ |
|---|
| 523 | 1) : \ |
|---|
| 524 | ((self)->error.type = YAML_MEMORY_ERROR, \ |
|---|
| 525 | 0)) |
|---|
| 526 | |
|---|
| 527 | #define POP(self,stack) \ |
|---|
| 528 | ((stack).list[--(stack).length]) |
|---|
| 529 | |
|---|
| 530 | #define QUEUE_INIT(self,queue,queue_capacity) \ |
|---|
| 531 | (((queue).list = yaml_malloc((queue_capacity)*sizeof(*(queue).list))) ? \ |
|---|
| 532 | ((queue).head = (queue).tail = 0, \ |
|---|
| 533 | (queue).capacity = (queue_capacity), \ |
|---|
| 534 | 1) : \ |
|---|
| 535 | ((self)->error.type = YAML_MEMORY_ERROR, \ |
|---|
| 536 | 0)) |
|---|
| 537 | |
|---|
| 538 | #define QUEUE_DEL(self,queue) \ |
|---|
| 539 | (yaml_free((queue).list), \ |
|---|
| 540 | (queue).list = NULL, \ |
|---|
| 541 | (queue).head = (queue).tail = (queue).capacity = 0) |
|---|
| 542 | |
|---|
| 543 | #define QUEUE_EMPTY(self,queue) \ |
|---|
| 544 | ((queue).head == (queue).tail) |
|---|
| 545 | |
|---|
| 546 | #define ENQUEUE(self,queue,value) \ |
|---|
| 547 | (((queue).tail != (queue).capacity \ |
|---|
| 548 | || yaml_queue_extend((void **)&(queue).list, sizeof(*(queue).list), \ |
|---|
| 549 | &(queue).head, &(queue).tail, &(queue).capacity)) ? \ |
|---|
| 550 | ((queue).list[(queue).tail++] = (value), \ |
|---|
| 551 | 1) : \ |
|---|
| 552 | ((self)->error.type = YAML_MEMORY_ERROR, \ |
|---|
| 553 | 0)) |
|---|
| 554 | |
|---|
| 555 | #define DEQUEUE(self,queue) \ |
|---|
| 556 | ((queue).list[(queue).head++]) |
|---|
| 557 | |
|---|
| 558 | #define QUEUE_INSERT(self,queue,index,value) \ |
|---|
| 559 | (((queue).tail != (queue).capacity \ |
|---|
| 560 | || yaml_queue_extend((void **)&(queue).list, sizeof(*(queue).list), \ |
|---|
| 561 | &(queue).head, &(queue).tail, &(queue).capacity)) ? \ |
|---|
| 562 | (memmove((queue).list+(queue).head+(index)+1, \ |
|---|
| 563 | (queue).list+(queue).head+(index), \ |
|---|
| 564 | ((queue).tail-(queue).head-(index))*sizeof(*(queue).list)), \ |
|---|
| 565 | (queue).list[(queue).head+(index)] = (value), \ |
|---|
| 566 | (queue).tail++, \ |
|---|
| 567 | 1) : \ |
|---|
| 568 | ((self)->error.type = YAML_MEMORY_ERROR, \ |
|---|
| 569 | 0)) |
|---|
| 570 | |
|---|
| 571 | /* |
|---|
| 572 | * Token initializers. |
|---|
| 573 | */ |
|---|
| 574 | |
|---|
| 575 | #define TOKEN_INIT(token,token_type,token_start_mark,token_end_mark) \ |
|---|
| 576 | (memset(&(token), 0, sizeof(yaml_token_t)), \ |
|---|
| 577 | (token).type = (token_type), \ |
|---|
| 578 | (token).start_mark = (token_start_mark), \ |
|---|
| 579 | (token).end_mark = (token_end_mark)) |
|---|
| 580 | |
|---|
| 581 | #define STREAM_START_TOKEN_INIT(token,token_encoding,start_mark,end_mark) \ |
|---|
| 582 | (TOKEN_INIT((token),YAML_STREAM_START_TOKEN,(start_mark),(end_mark)), \ |
|---|
| 583 | (token).data.stream_start.encoding = (token_encoding)) |
|---|
| 584 | |
|---|
| 585 | #define STREAM_END_TOKEN_INIT(token,start_mark,end_mark) \ |
|---|
| 586 | (TOKEN_INIT((token),YAML_STREAM_END_TOKEN,(start_mark),(end_mark))) |
|---|
| 587 | |
|---|
| 588 | #define ALIAS_TOKEN_INIT(token,token_value,start_mark,end_mark) \ |
|---|
| 589 | (TOKEN_INIT((token),YAML_ALIAS_TOKEN,(start_mark),(end_mark)), \ |
|---|
| 590 | (token).data.alias.value = (token_value)) |
|---|
| 591 | |
|---|
| 592 | #define ANCHOR_TOKEN_INIT(token,token_value,start_mark,end_mark) \ |
|---|
| 593 | (TOKEN_INIT((token),YAML_ANCHOR_TOKEN,(start_mark),(end_mark)), \ |
|---|
| 594 | (token).data.anchor.value = (token_value)) |
|---|
| 595 | |
|---|
| 596 | #define TAG_TOKEN_INIT(token,token_handle,token_suffix,start_mark,end_mark) \ |
|---|
| 597 | (TOKEN_INIT((token),YAML_TAG_TOKEN,(start_mark),(end_mark)), \ |
|---|
| 598 | (token).data.tag.handle = (token_handle), \ |
|---|
| 599 | (token).data.tag.suffix = (token_suffix)) |
|---|
| 600 | |
|---|
| 601 | #define SCALAR_TOKEN_INIT(token,token_value,token_length,token_style,start_mark,end_mark) \ |
|---|
| 602 | (TOKEN_INIT((token),YAML_SCALAR_TOKEN,(start_mark),(end_mark)), \ |
|---|
| 603 | (token).data.scalar.value = (token_value), \ |
|---|
| 604 | (token).data.scalar.length = (token_length), \ |
|---|
| 605 | (token).data.scalar.style = (token_style)) |
|---|
| 606 | |
|---|
| 607 | #define VERSION_DIRECTIVE_TOKEN_INIT(token,token_major,token_minor,start_mark,end_mark) \ |
|---|
| 608 | (TOKEN_INIT((token),YAML_VERSION_DIRECTIVE_TOKEN,(start_mark),(end_mark)), \ |
|---|
| 609 | (token).data.version_directive.major = (token_major), \ |
|---|
| 610 | (token).data.version_directive.minor = (token_minor)) |
|---|
| 611 | |
|---|
| 612 | #define TAG_DIRECTIVE_TOKEN_INIT(token,token_handle,token_prefix,start_mark,end_mark) \ |
|---|
| 613 | (TOKEN_INIT((token),YAML_TAG_DIRECTIVE_TOKEN,(start_mark),(end_mark)), \ |
|---|
| 614 | (token).data.tag_directive.handle = (token_handle), \ |
|---|
| 615 | (token).data.tag_directive.prefix = (token_prefix)) |
|---|
| 616 | |
|---|
| 617 | /* |
|---|
| 618 | * Event initializers. |
|---|
| 619 | */ |
|---|
| 620 | |
|---|
| 621 | #define EVENT_INIT(event,event_type,event_start_mark,event_end_mark) \ |
|---|
| 622 | (memset(&(event), 0, sizeof(yaml_event_t)), \ |
|---|
| 623 | (event).type = (event_type), \ |
|---|
| 624 | (event).start_mark = (event_start_mark), \ |
|---|
| 625 | (event).end_mark = (event_end_mark)) |
|---|
| 626 | |
|---|
| 627 | #define STREAM_START_EVENT_INIT(event,event_encoding,start_mark,end_mark) \ |
|---|
| 628 | (EVENT_INIT((event),YAML_STREAM_START_EVENT,(start_mark),(end_mark)), \ |
|---|
| 629 | (event).data.stream_start.encoding = (event_encoding)) |
|---|
| 630 | |
|---|
| 631 | #define STREAM_END_EVENT_INIT(event,start_mark,end_mark) \ |
|---|
| 632 | (EVENT_INIT((event),YAML_STREAM_END_EVENT,(start_mark),(end_mark))) |
|---|
| 633 | |
|---|
| 634 | #define DOCUMENT_START_EVENT_INIT(event,event_version_directive, \ |
|---|
| 635 | event_tag_directives_list,event_tag_directives_length, \ |
|---|
| 636 | event_tag_directives_capacity,event_is_implicit,start_mark,end_mark) \ |
|---|
| 637 | (EVENT_INIT((event),YAML_DOCUMENT_START_EVENT,(start_mark),(end_mark)), \ |
|---|
| 638 | (event).data.document_start.version_directive = (event_version_directive), \ |
|---|
| 639 | (event).data.document_start.tag_directives.list = (event_tag_directives_list), \ |
|---|
| 640 | (event).data.document_start.tag_directives.length = (event_tag_directives_length), \ |
|---|
| 641 | (event).data.document_start.tag_directives.capacity = (event_tag_directives_capacity), \ |
|---|
| 642 | (event).data.document_start.is_implicit = (event_is_implicit)) |
|---|
| 643 | |
|---|
| 644 | #define DOCUMENT_END_EVENT_INIT(event,event_is_implicit,start_mark,end_mark) \ |
|---|
| 645 | (EVENT_INIT((event),YAML_DOCUMENT_END_EVENT,(start_mark),(end_mark)), \ |
|---|
| 646 | (event).data.document_end.is_implicit = (event_is_implicit)) |
|---|
| 647 | |
|---|
| 648 | #define ALIAS_EVENT_INIT(event,event_anchor,start_mark,end_mark) \ |
|---|
| 649 | (EVENT_INIT((event),YAML_ALIAS_EVENT,(start_mark),(end_mark)), \ |
|---|
| 650 | (event).data.alias.anchor = (event_anchor)) |
|---|
| 651 | |
|---|
| 652 | #define SCALAR_EVENT_INIT(event,event_anchor,event_tag,event_value, \ |
|---|
| 653 | event_length,event_is_plain_implicit,event_is_quoted_implicit, \ |
|---|
| 654 | event_style,start_mark,end_mark) \ |
|---|
| 655 | (EVENT_INIT((event),YAML_SCALAR_EVENT,(start_mark),(end_mark)), \ |
|---|
| 656 | (event).data.scalar.anchor = (event_anchor), \ |
|---|
| 657 | (event).data.scalar.tag = (event_tag), \ |
|---|
| 658 | (event).data.scalar.value = (event_value), \ |
|---|
| 659 | (event).data.scalar.length = (event_length), \ |
|---|
| 660 | (event).data.scalar.is_plain_implicit = (event_is_plain_implicit), \ |
|---|
| 661 | (event).data.scalar.is_quoted_implicit = (event_is_quoted_implicit), \ |
|---|
| 662 | (event).data.scalar.style = (event_style)) |
|---|
| 663 | |
|---|
| 664 | #define SEQUENCE_START_EVENT_INIT(event,event_anchor,event_tag, \ |
|---|
| 665 | event_is_implicit,event_style,start_mark,end_mark) \ |
|---|
| 666 | (EVENT_INIT((event),YAML_SEQUENCE_START_EVENT,(start_mark),(end_mark)), \ |
|---|
| 667 | (event).data.sequence_start.anchor = (event_anchor), \ |
|---|
| 668 | (event).data.sequence_start.tag = (event_tag), \ |
|---|
| 669 | (event).data.sequence_start.is_implicit = (event_is_implicit), \ |
|---|
| 670 | (event).data.sequence_start.style = (event_style)) |
|---|
| 671 | |
|---|
| 672 | #define SEQUENCE_END_EVENT_INIT(event,start_mark,end_mark) \ |
|---|
| 673 | (EVENT_INIT((event),YAML_SEQUENCE_END_EVENT,(start_mark),(end_mark))) |
|---|
| 674 | |
|---|
| 675 | #define MAPPING_START_EVENT_INIT(event,event_anchor,event_tag, \ |
|---|
| 676 | event_is_implicit,event_style,start_mark,end_mark) \ |
|---|
| 677 | (EVENT_INIT((event),YAML_MAPPING_START_EVENT,(start_mark),(end_mark)), \ |
|---|
| 678 | (event).data.mapping_start.anchor = (event_anchor), \ |
|---|
| 679 | (event).data.mapping_start.tag = (event_tag), \ |
|---|
| 680 | (event).data.mapping_start.is_implicit = (event_is_implicit), \ |
|---|
| 681 | (event).data.mapping_start.style = (event_style)) |
|---|
| 682 | |
|---|
| 683 | #define MAPPING_END_EVENT_INIT(event,start_mark,end_mark) \ |
|---|
| 684 | (EVENT_INIT((event),YAML_MAPPING_END_EVENT,(start_mark),(end_mark))) |
|---|
| 685 | |
|---|
| 686 | /* |
|---|
| 687 | * Document initializer. |
|---|
| 688 | */ |
|---|
| 689 | |
|---|
| 690 | #define DOCUMENT_INIT(document,document_nodes_start,document_nodes_end, \ |
|---|
| 691 | document_version_directive,document_tag_directives_start, \ |
|---|
| 692 | document_tag_directives_end,document_start_implicit, \ |
|---|
| 693 | document_end_implicit,document_start_mark,document_end_mark) \ |
|---|
| 694 | (memset(&(document), 0, sizeof(yaml_document_t)), \ |
|---|
| 695 | (document).nodes.start = (document_nodes_start), \ |
|---|
| 696 | (document).nodes.end = (document_nodes_end), \ |
|---|
| 697 | (document).nodes.top = (document_nodes_start), \ |
|---|
| 698 | (document).version_directive = (document_version_directive), \ |
|---|
| 699 | (document).tag_directives.start = (document_tag_directives_start), \ |
|---|
| 700 | (document).tag_directives.end = (document_tag_directives_end), \ |
|---|
| 701 | (document).start_implicit = (document_start_implicit), \ |
|---|
| 702 | (document).end_implicit = (document_end_implicit), \ |
|---|
| 703 | (document).start_mark = (document_start_mark), \ |
|---|
| 704 | (document).end_mark = (document_end_mark)) |
|---|
| 705 | |
|---|
| 706 | /* |
|---|
| 707 | * Node initializers. |
|---|
| 708 | */ |
|---|
| 709 | |
|---|
| 710 | #define NODE_INIT(node,node_type,node_tag,node_start_mark,node_end_mark) \ |
|---|
| 711 | (memset(&(node), 0, sizeof(yaml_node_t)), \ |
|---|
| 712 | (node).type = (node_type), \ |
|---|
| 713 | (node).tag = (node_tag), \ |
|---|
| 714 | (node).start_mark = (node_start_mark), \ |
|---|
| 715 | (node).end_mark = (node_end_mark)) |
|---|
| 716 | |
|---|
| 717 | #define SCALAR_NODE_INIT(node,node_tag,node_value,node_length, \ |
|---|
| 718 | node_style,start_mark,end_mark) \ |
|---|
| 719 | (NODE_INIT((node),YAML_SCALAR_NODE,(node_tag),(start_mark),(end_mark)), \ |
|---|
| 720 | (node).data.scalar.value = (node_value), \ |
|---|
| 721 | (node).data.scalar.length = (node_length), \ |
|---|
| 722 | (node).data.scalar.style = (node_style)) |
|---|
| 723 | |
|---|
| 724 | #define SEQUENCE_NODE_INIT(node,node_tag,node_items_start,node_items_end, \ |
|---|
| 725 | node_style,start_mark,end_mark) \ |
|---|
| 726 | (NODE_INIT((node),YAML_SEQUENCE_NODE,(node_tag),(start_mark),(end_mark)), \ |
|---|
| 727 | (node).data.sequence.items.start = (node_items_start), \ |
|---|
| 728 | (node).data.sequence.items.end = (node_items_end), \ |
|---|
| 729 | (node).data.sequence.items.top = (node_items_start), \ |
|---|
| 730 | (node).data.sequence.style = (node_style)) |
|---|
| 731 | |
|---|
| 732 | #define MAPPING_NODE_INIT(node,node_tag,node_pairs_start,node_pairs_end, \ |
|---|
| 733 | node_style,start_mark,end_mark) \ |
|---|
| 734 | (NODE_INIT((node),YAML_MAPPING_NODE,(node_tag),(start_mark),(end_mark)), \ |
|---|
| 735 | (node).data.mapping.pairs.start = (node_pairs_start), \ |
|---|
| 736 | (node).data.mapping.pairs.end = (node_pairs_end), \ |
|---|
| 737 | (node).data.mapping.pairs.top = (node_pairs_start), \ |
|---|
| 738 | (node).data.mapping.style = (node_style)) |
|---|
| 739 | |
|---|
| 740 | /* |
|---|
| 741 | * This structure holds information about a potential simple key. |
|---|
| 742 | */ |
|---|
| 743 | |
|---|
| 744 | typedef struct yaml_simple_key_s { |
|---|
| 745 | /* Is a simple key possible? */ |
|---|
| 746 | int is_possible; |
|---|
| 747 | /* Is a simple key required? */ |
|---|
| 748 | int is_required; |
|---|
| 749 | /* The number of the token. */ |
|---|
| 750 | size_t token_number; |
|---|
| 751 | /* The position mark. */ |
|---|
| 752 | yaml_mark_t mark; |
|---|
| 753 | } yaml_simple_key_t; |
|---|
| 754 | |
|---|
| 755 | /* |
|---|
| 756 | * The states of the parser. |
|---|
| 757 | */ |
|---|
| 758 | |
|---|
| 759 | typedef enum yaml_parser_state_e { |
|---|
| 760 | /* Expect STREAM-START. */ |
|---|
| 761 | YAML_PARSE_STREAM_START_STATE, |
|---|
| 762 | /* Expect the beginning of an implicit document. */ |
|---|
| 763 | YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE, |
|---|
| 764 | /* Expect DOCUMENT-START. */ |
|---|
| 765 | YAML_PARSE_DOCUMENT_START_STATE, |
|---|
| 766 | /* Expect the content of a document. */ |
|---|
| 767 | YAML_PARSE_DOCUMENT_CONTENT_STATE, |
|---|
| 768 | /* Expect DOCUMENT-END. */ |
|---|
| 769 | YAML_PARSE_DOCUMENT_END_STATE, |
|---|
| 770 | /* Expect a block node. */ |
|---|
| 771 | YAML_PARSE_BLOCK_NODE_STATE, |
|---|
| 772 | /* Expect a block node or indentless sequence. */ |
|---|
| 773 | YAML_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE, |
|---|
| 774 | /* Expect a flow node. */ |
|---|
| 775 | YAML_PARSE_FLOW_NODE_STATE, |
|---|
| 776 | /* Expect the first entry of a block sequence. */ |
|---|
| 777 | YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE, |
|---|
| 778 | /* Expect an entry of a block sequence. */ |
|---|
| 779 | YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE, |
|---|
| 780 | /* Expect an entry of an indentless sequence. */ |
|---|
| 781 | YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE, |
|---|
| 782 | /* Expect the first key of a block mapping. */ |
|---|
| 783 | YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE, |
|---|
| 784 | /* Expect a block mapping key. */ |
|---|
| 785 | YAML_PARSE_BLOCK_MAPPING_KEY_STATE, |
|---|
| 786 | /* Expect a block mapping value. */ |
|---|
| 787 | YAML_PARSE_BLOCK_MAPPING_VALUE_STATE, |
|---|
| 788 | /* Expect the first entry of a flow sequence. */ |
|---|
| 789 | YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE, |
|---|
| 790 | /* Expect an entry of a flow sequence. */ |
|---|
| 791 | YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE, |
|---|
| 792 | /* Expect a key of an ordered mapping. */ |
|---|
| 793 | YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE, |
|---|
| 794 | /* Expect a value of an ordered mapping. */ |
|---|
| 795 | YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE, |
|---|
| 796 | /* Expect the and of an ordered mapping entry. */ |
|---|
| 797 | YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE, |
|---|
| 798 | /* Expect the first key of a flow mapping. */ |
|---|
| 799 | YAML_PARSE_FLOW_MAPPING_FIRST_KEY_STATE, |
|---|
| 800 | /* Expect a key of a flow mapping. */ |
|---|
| 801 | YAML_PARSE_FLOW_MAPPING_KEY_STATE, |
|---|
| 802 | /* Expect a value of a flow mapping. */ |
|---|
| 803 | YAML_PARSE_FLOW_MAPPING_VALUE_STATE, |
|---|
| 804 | /* Expect an empty value of a flow mapping. */ |
|---|
| 805 | YAML_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE, |
|---|
| 806 | /* Expect nothing. */ |
|---|
| 807 | YAML_PARSE_END_STATE |
|---|
| 808 | } yaml_parser_state_t; |
|---|
| 809 | |
|---|
| 810 | /* |
|---|
| 811 | * This structure holds aliases data. |
|---|
| 812 | */ |
|---|
| 813 | |
|---|
| 814 | typedef struct yaml_alias_data_s { |
|---|
| 815 | /* The anchor. */ |
|---|
| 816 | yaml_char_t *anchor; |
|---|
| 817 | /* The node id. */ |
|---|
| 818 | int index; |
|---|
| 819 | /* The anchor mark. */ |
|---|
| 820 | yaml_mark_t mark; |
|---|
| 821 | } yaml_alias_data_t; |
|---|
| 822 | |
|---|
| 823 | /* |
|---|
| 824 | * The structure that holds data used by the file and string readers. |
|---|
| 825 | */ |
|---|
| 826 | |
|---|
| 827 | typedef union yaml_standard_reader_data_u { |
|---|
| 828 | /* String input data. */ |
|---|
| 829 | yaml_string_t string; |
|---|
| 830 | /* File input data. */ |
|---|
| 831 | FILE *file; |
|---|
| 832 | } yaml_standard_reader_data_t; |
|---|
| 833 | |
|---|
| 834 | /* |
|---|
| 835 | * The internal parser structure. |
|---|
| 836 | */ |
|---|
| 837 | |
|---|
| 838 | struct yaml_parser_s { |
|---|
| 839 | |
|---|
| 840 | /* |
|---|
| 841 | * Error stuff. |
|---|
| 842 | */ |
|---|
| 843 | |
|---|
| 844 | yaml_error_t error; |
|---|
| 845 | |
|---|
| 846 | /* |
|---|
| 847 | * Reader stuff. |
|---|
| 848 | */ |
|---|
| 849 | |
|---|
| 850 | /* The read handler. */ |
|---|
| 851 | yaml_reader_t *reader; |
|---|
| 852 | |
|---|
| 853 | /* The application data to be passed to the reader. */ |
|---|
| 854 | void *reader_data; |
|---|
| 855 | |
|---|
| 856 | /* Standard (string or file) input data. */ |
|---|
| 857 | yaml_standard_reader_data_t standard_reader_data; |
|---|
| 858 | |
|---|
| 859 | /* EOF flag. */ |
|---|
| 860 | int is_eof; |
|---|
| 861 | |
|---|
| 862 | /* The working buffer. */ |
|---|
| 863 | struct { |
|---|
| 864 | yaml_char_t *buffer; |
|---|
| 865 | size_t pointer; |
|---|
| 866 | size_t length; |
|---|
| 867 | size_t capacity; |
|---|
| 868 | } input; |
|---|
| 869 | |
|---|
| 870 | /* The number of unread characters in the buffer. */ |
|---|
| 871 | size_t unread; |
|---|
| 872 | |
|---|
| 873 | /* The raw buffer. */ |
|---|
| 874 | struct { |
|---|
| 875 | unsigned char *buffer; |
|---|
| 876 | size_t pointer; |
|---|
| 877 | size_t length; |
|---|
| 878 | size_t capacity; |
|---|
| 879 | } raw_input; |
|---|
| 880 | |
|---|
| 881 | /* The input encoding. */ |
|---|
| 882 | yaml_encoding_t encoding; |
|---|
| 883 | |
|---|
| 884 | /* The offset of the current position (in bytes). */ |
|---|
| 885 | size_t offset; |
|---|
| 886 | |
|---|
| 887 | /* The mark of the current position. */ |
|---|
| 888 | yaml_mark_t mark; |
|---|
| 889 | |
|---|
| 890 | /* |
|---|
| 891 | * Scanner stuff. |
|---|
| 892 | */ |
|---|
| 893 | |
|---|
| 894 | /* Have we started to scan the input stream? */ |
|---|
| 895 | int is_stream_start_produced; |
|---|
| 896 | |
|---|
| 897 | /* Have we reached the end of the input stream? */ |
|---|
| 898 | int is_stream_end_produced; |
|---|
| 899 | |
|---|
| 900 | /* The number of unclosed '[' and '{' indicators. */ |
|---|
| 901 | int flow_level; |
|---|
| 902 | |
|---|
| 903 | /* The tokens queue. */ |
|---|
| 904 | struct { |
|---|
| 905 | yaml_token_t *list; |
|---|
| 906 | size_t head; |
|---|
| 907 | size_t tail; |
|---|
| 908 | size_t capacity; |
|---|
| 909 | } tokens; |
|---|
| 910 | |
|---|
| 911 | /* The number of tokens fetched from the queue. */ |
|---|
| 912 | size_t tokens_parsed; |
|---|
| 913 | |
|---|
| 914 | /* Does the tokens queue contain a token ready for dequeueing. */ |
|---|
| 915 | int is_token_available; |
|---|
| 916 | |
|---|
| 917 | /* The indentation levels stack. */ |
|---|
| 918 | struct { |
|---|
| 919 | int *list; |
|---|
| 920 | size_t length; |
|---|
| 921 | size_t capacity; |
|---|
| 922 | } indents; |
|---|
| 923 | |
|---|
| 924 | /* The current indentation level. */ |
|---|
| 925 | int indent; |
|---|
| 926 | |
|---|
| 927 | /* May a simple key occur at the current position? */ |
|---|
| 928 | int is_simple_key_allowed; |
|---|
| 929 | |
|---|
| 930 | /* The stack of simple keys. */ |
|---|
| 931 | struct { |
|---|
| 932 | yaml_simple_key_t *list; |
|---|
| 933 | size_t length; |
|---|
| 934 | size_t capacity; |
|---|
| 935 | } simple_keys; |
|---|
| 936 | |
|---|
| 937 | /* |
|---|
| 938 | * Parser stuff. |
|---|
| 939 | */ |
|---|
| 940 | |
|---|
| 941 | /* The parser states stack. */ |
|---|
| 942 | struct { |
|---|
| 943 | yaml_parser_state_t *list; |
|---|
| 944 | size_t length; |
|---|
| 945 | size_t capacity; |
|---|
| 946 | } states; |
|---|
| 947 | |
|---|
| 948 | /* The current parser state. */ |
|---|
| 949 | yaml_parser_state_t state; |
|---|
| 950 | |
|---|
| 951 | /* The stack of marks. */ |
|---|
| 952 | struct { |
|---|
| 953 | yaml_mark_t *list; |
|---|
| 954 | size_t length; |
|---|
| 955 | size_t capacity; |
|---|
| 956 | } marks; |
|---|
| 957 | |
|---|
| 958 | /* The list of TAG directives. */ |
|---|
| 959 | struct { |
|---|
| 960 | yaml_tag_directive_t *list; |
|---|
| 961 | size_t length; |
|---|
| 962 | size_t capacity; |
|---|
| 963 | } tag_directives; |
|---|
| 964 | |
|---|
| 965 | /* |
|---|
| 966 | * Dumper stuff. |
|---|
| 967 | */ |
|---|
| 968 | |
|---|
| 969 | /* The resolve handler. */ |
|---|
| 970 | yaml_resolver_t *resolver; |
|---|
| 971 | |
|---|
| 972 | /* The application data to be passed to the resolver. */ |
|---|
| 973 | void *resolver_data; |
|---|
| 974 | |
|---|
| 975 | /* The alias data. */ |
|---|
| 976 | struct { |
|---|
| 977 | yaml_alias_data_t *list; |
|---|
| 978 | size_t length; |
|---|
| 979 | size_t capacity; |
|---|
| 980 | } aliases; |
|---|
| 981 | |
|---|
| 982 | /* The currently parsed document. */ |
|---|
| 983 | yaml_document_t *document; |
|---|
| 984 | |
|---|
| 985 | }; |
|---|
| 986 | |
|---|
| 987 | /* |
|---|
| 988 | * The emitter states. |
|---|
| 989 | */ |
|---|
| 990 | |
|---|
| 991 | typedef enum yaml_emitter_state_e { |
|---|
| 992 | /** Expect STREAM-START. */ |
|---|
| 993 | YAML_EMIT_STREAM_START_STATE, |
|---|
| 994 | /** Expect the first DOCUMENT-START or STREAM-END. */ |
|---|
| 995 | YAML_EMIT_FIRST_DOCUMENT_START_STATE, |
|---|
| 996 | /** Expect DOCUMENT-START or STREAM-END. */ |
|---|
| 997 | YAML_EMIT_DOCUMENT_START_STATE, |
|---|
| 998 | /** Expect the content of a document. */ |
|---|
| 999 | YAML_EMIT_DOCUMENT_CONTENT_STATE, |
|---|
| 1000 | /** Expect DOCUMENT-END. */ |
|---|
| 1001 | YAML_EMIT_DOCUMENT_END_STATE, |
|---|
| 1002 | /** Expect the first item of a flow sequence. */ |
|---|
| 1003 | YAML_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE, |
|---|
| 1004 | /** Expect an item of a flow sequence. */ |
|---|
| 1005 | YAML_EMIT_FLOW_SEQUENCE_ITEM_STATE, |
|---|
| 1006 | /** Expect the first key of a flow mapping. */ |
|---|
| 1007 | YAML_EMIT_FLOW_MAPPING_FIRST_KEY_STATE, |
|---|
| 1008 | /** Expect a key of a flow mapping. */ |
|---|
| 1009 | YAML_EMIT_FLOW_MAPPING_KEY_STATE, |
|---|
| 1010 | /** Expect a value for a simple key of a flow mapping. */ |
|---|
| 1011 | YAML_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE, |
|---|
| 1012 | /** Expect a value of a flow mapping. */ |
|---|
| 1013 | YAML_EMIT_FLOW_MAPPING_VALUE_STATE, |
|---|
| 1014 | /** Expect the first item of a block sequence. */ |
|---|
| 1015 | YAML_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE, |
|---|
| 1016 | /** Expect an item of a block sequence. */ |
|---|
| 1017 | YAML_EMIT_BLOCK_SEQUENCE_ITEM_STATE, |
|---|
| 1018 | /** Expect the first key of a block mapping. */ |
|---|
| 1019 | YAML_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE, |
|---|
| 1020 | /** Expect the key of a block mapping. */ |
|---|
| 1021 | YAML_EMIT_BLOCK_MAPPING_KEY_STATE, |
|---|
| 1022 | /** Expect a value for a simple key of a block mapping. */ |
|---|
| 1023 | YAML_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE, |
|---|
| 1024 | /** Expect a value of a block mapping. */ |
|---|
| 1025 | YAML_EMIT_BLOCK_MAPPING_VALUE_STATE, |
|---|
| 1026 | /** Expect nothing. */ |
|---|
| 1027 | YAML_EMIT_END_STATE |
|---|
| 1028 | } yaml_emitter_state_t; |
|---|
| 1029 | |
|---|
| 1030 | /* |
|---|
| 1031 | * The structure that holds data used by the file and string readers. |
|---|
| 1032 | */ |
|---|
| 1033 | |
|---|
| 1034 | typedef union yaml_standard_writer_data_u { |
|---|
| 1035 | /* String output data. */ |
|---|
| 1036 | yaml_string_t string; |
|---|
| 1037 | size_t *length; |
|---|
| 1038 | /* File output data. */ |
|---|
| 1039 | FILE *file; |
|---|
| 1040 | } yaml_standard_writer_data_t; |
|---|
| 1041 | |
|---|
| 1042 | /* |
|---|
| 1043 | * The internals emitter structure. |
|---|
| 1044 | */ |
|---|
| 1045 | |
|---|
| 1046 | struct yaml_emitter_s { |
|---|
| 1047 | |
|---|
| 1048 | /* |
|---|
| 1049 | * Error stuff. |
|---|
| 1050 | */ |
|---|
| 1051 | |
|---|
| 1052 | yaml_error_t error; |
|---|
| 1053 | |
|---|
| 1054 | /* |
|---|
| 1055 | * Writer stuff. |
|---|
| 1056 | */ |
|---|
| 1057 | |
|---|
| 1058 | /* Write handler. */ |
|---|
| 1059 | yaml_writer_t *writer; |
|---|
| 1060 | |
|---|
| 1061 | /* A pointer for passing to the white handler. */ |
|---|
| 1062 | void *writer_data; |
|---|
| 1063 | |
|---|
| 1064 | /* Standard (string or file) output data. */ |
|---|
| 1065 | yaml_standard_writer_data_t standard_writer_data; |
|---|
| 1066 | |
|---|
| 1067 | /* The working buffer. */ |
|---|
| 1068 | struct { |
|---|
| 1069 | yaml_char_t *buffer; |
|---|
| 1070 | size_t pointer; |
|---|
| 1071 | size_t length; |
|---|
| 1072 | size_t capacity; |
|---|
| 1073 | } output; |
|---|
| 1074 | |
|---|
| 1075 | /* The raw buffer. */ |
|---|
| 1076 | struct { |
|---|
| 1077 | yaml_char_t *buffer; |
|---|
| 1078 | size_t pointer; |
|---|
| 1079 | size_t length; |
|---|
| 1080 | size_t capacity; |
|---|
| 1081 | } raw_output; |
|---|
| 1082 | |
|---|
| 1083 | /* The stream encoding. */ |
|---|
| 1084 | yaml_encoding_t encoding; |
|---|
| 1085 | |
|---|
| 1086 | /* |
|---|
| 1087 | * Emitter stuff. |
|---|
| 1088 | */ |
|---|
| 1089 | |
|---|
| 1090 | /* If the output is in the canonical style? */ |
|---|
| 1091 | int is_canonical; |
|---|
| 1092 | /* The number of indentation spaces. */ |
|---|
| 1093 | int best_indent; |
|---|
| 1094 | /* The preferred width of the output lines. */ |
|---|
| 1095 | int best_width; |
|---|
| 1096 | /* Allow unescaped non-ASCII characters? */ |
|---|
| 1097 | int is_unicode; |
|---|
| 1098 | /* The preferred line break. */ |
|---|
| 1099 | yaml_break_t line_break; |
|---|
| 1100 | |
|---|
| 1101 | /* The stack of states. */ |
|---|
| 1102 | struct { |
|---|
| 1103 | yaml_emitter_state_t *list; |
|---|
| 1104 | size_t length; |
|---|
| 1105 | size_t capacity; |
|---|
| 1106 | } states; |
|---|
| 1107 | |
|---|
| 1108 | /* The current emitter state. */ |
|---|
| 1109 | yaml_emitter_state_t state; |
|---|
| 1110 | |
|---|
| 1111 | /* The event queue. */ |
|---|
| 1112 | struct { |
|---|
| 1113 | yaml_event_t *list; |
|---|
| 1114 | size_t head; |
|---|
| 1115 | size_t tail; |
|---|
| 1116 | size_t capacity; |
|---|
| 1117 | } events; |
|---|
| 1118 | |
|---|
| 1119 | /* The stack of indentation levels. */ |
|---|
| 1120 | struct { |
|---|
| 1121 | int *list; |
|---|
| 1122 | size_t length; |
|---|
| 1123 | size_t capacity; |
|---|
| 1124 | } indents; |
|---|
| 1125 | |
|---|
| 1126 | /* The list of tag directives. */ |
|---|
| 1127 | struct { |
|---|
| 1128 | yaml_tag_directive_t *list; |
|---|
| 1129 | size_t length; |
|---|
| 1130 | size_t capacity; |
|---|
| 1131 | } tag_directives; |
|---|
| 1132 | |
|---|
| 1133 | /* The current indentation level. */ |
|---|
| 1134 | int indent; |
|---|
| 1135 | |
|---|
| 1136 | /* The current flow level. */ |
|---|
| 1137 | int flow_level; |
|---|
| 1138 | |
|---|
| 1139 | /* Is it the document root context? */ |
|---|
| 1140 | int is_root_context; |
|---|
| 1141 | /* Is it a sequence context? */ |
|---|
| 1142 | int is_sequence_context; |
|---|
| 1143 | /* Is it a mapping context? */ |
|---|
| 1144 | int is_mapping_context; |
|---|
| 1145 | /* Is it a simple mapping key context? */ |
|---|
| 1146 | int is_simple_key_context; |
|---|
| 1147 | |
|---|
| 1148 | /* The current line. */ |
|---|
| 1149 | int line; |
|---|
| 1150 | /* The current column. */ |
|---|
| 1151 | int column; |
|---|
| 1152 | /* If the last character was a whitespace? */ |
|---|
| 1153 | int whitespace; |
|---|
| 1154 | /* If the last character was an indentation character (' ', '-', '?', ':')? */ |
|---|
| 1155 | int indention; |
|---|
| 1156 | |
|---|
| 1157 | /* Anchor analysis. */ |
|---|
| 1158 | struct { |
|---|
| 1159 | /* The anchor value. */ |
|---|
| 1160 | yaml_char_t *anchor; |
|---|
| 1161 | /* The anchor length. */ |
|---|
| 1162 | size_t anchor_length; |
|---|
| 1163 | /* Is it an alias? */ |
|---|
| 1164 | int is_alias; |
|---|
| 1165 | } anchor_data; |
|---|
| 1166 | |
|---|
| 1167 | /* Tag analysis. */ |
|---|
| 1168 | struct { |
|---|
| 1169 | /* The tag handle. */ |
|---|
| 1170 | yaml_char_t *handle; |
|---|
| 1171 | /* The tag handle length. */ |
|---|
| 1172 | size_t handle_length; |
|---|
| 1173 | /* The tag suffix. */ |
|---|
| 1174 | yaml_char_t *suffix; |
|---|
| 1175 | /* The tag suffix length. */ |
|---|
| 1176 | size_t suffix_length; |
|---|
| 1177 | } tag_data; |
|---|
| 1178 | |
|---|
| 1179 | /* Scalar analysis. */ |
|---|
| 1180 | struct { |
|---|
| 1181 | /* The scalar value. */ |
|---|
| 1182 | yaml_char_t *value; |
|---|
| 1183 | /* The scalar length. */ |
|---|
| 1184 | size_t length; |
|---|
| 1185 | /* Does the scalar contain line breaks? */ |
|---|
| 1186 | int is_multiline; |
|---|
| 1187 | /* Can the scalar be expessed in the flow plain style? */ |
|---|
| 1188 | int is_flow_plain_allowed; |
|---|
| 1189 | /* Can the scalar be expressed in the block plain style? */ |
|---|
| 1190 | int is_block_plain_allowed; |
|---|
| 1191 | /* Can the scalar be expressed in the single quoted style? */ |
|---|
| 1192 | int is_single_quoted_allowed; |
|---|
| 1193 | /* Can the scalar be expressed in the literal or folded styles? */ |
|---|
| 1194 | int is_block_allowed; |
|---|
| 1195 | /* The output style. */ |
|---|
| 1196 | yaml_scalar_style_t style; |
|---|
| 1197 | } scalar_data; |
|---|
| 1198 | |
|---|
| 1199 | /* |
|---|
| 1200 | * Dumper stuff. |
|---|
| 1201 | */ |
|---|
| 1202 | |
|---|
| 1203 | /* If the stream was already opened? */ |
|---|
| 1204 | int is_opened; |
|---|
| 1205 | /* If the stream was already closed? */ |
|---|
| 1206 | int is_closed; |
|---|
| 1207 | |
|---|
| 1208 | /* The information associated with the document nodes. */ |
|---|
| 1209 | struct { |
|---|
| 1210 | /* The number of references. */ |
|---|
| 1211 | size_t references; |
|---|
| 1212 | /* The anchor id. */ |
|---|
| 1213 | int anchor; |
|---|
| 1214 | /* If the node has been emitted? */ |
|---|
| 1215 | int is_serialized; |
|---|
| 1216 | } *anchors; |
|---|
| 1217 | |
|---|
| 1218 | /* The last assigned anchor id. */ |
|---|
| 1219 | int last_anchor_id; |
|---|
| 1220 | |
|---|
| 1221 | /* The currently emitted document. */ |
|---|
| 1222 | yaml_document_t *document; |
|---|
| 1223 | |
|---|
| 1224 | }; |
|---|
| 1225 | |
|---|
| 1226 | /* |
|---|
| 1227 | * Reader: Ensure that the buffer contains at least `length` characters. |
|---|
| 1228 | */ |
|---|
| 1229 | |
|---|
| 1230 | YAML_DECLARE(int) |
|---|
| 1231 | yaml_parser_update_buffer(yaml_parser_t *parser, size_t length); |
|---|
| 1232 | |
|---|
| 1233 | /* |
|---|
| 1234 | * Scanner: Ensure that the token stack contains at least one token ready. |
|---|
| 1235 | */ |
|---|
| 1236 | |
|---|
| 1237 | YAML_DECLARE(int) |
|---|
| 1238 | yaml_parser_fetch_more_tokens(yaml_parser_t *parser); |
|---|
| 1239 | |
|---|