Changeset 266

Show
Ignore:
Timestamp:
01/03/08 22:33:04 (9 months ago)
Author:
xi
Message:

Drop doxygen support, add more API documentation, API changes.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libyaml/trunk/README

    r220 r266  
    11LibYAML - A C library for parsing and emitting YAML. 
    2  
    3 The project is in an early stage of development. 
    42 
    53To build and install the library, run: 
     
    1412# make install 
    1513 
    16 For more information, check the LibYAML homepage: 
     14For the API reference, check the file 'include/yaml.h'.  Examples on how to use 
     15LibYAML could be found in the 'tests' directory. 
     16 
     17Check the LibYAML homepage for more information: 
    1718'http://pyyaml.org/wiki/LibYAML'. 
    1819 
     
    2627under the MIT license.  See the file LICENSE for more details. 
    2728 
    28 This project is developed for Python Software Foundation as a part of 
    29 Google Summer of Code under the mentorship of Clark Evans. 
     29The initial version of this project was developed for Python Software 
     30Foundation under the mentorshipf of Clark Evans as a part of Google Summer of 
     31Code 2006. 
  • libyaml/trunk/include/Makefile.am

    r200 r266  
    11INCLUDES = yaml.h 
    2 DOXYGEN_CFG = $(top_srcdir)/doc/doxygen.cfg 
    32 
    43nobase_include_HEADERS = $(INCLUDES) 
    54 
    6 if DOXYGEN 
    7  
    8 html: $(INCLUDES) $(DOXYGEN_CFG) 
    9         PACKAGE=$(PACKAGE) VERSION=$(VERSION) top_srcdir=$(top_srcdir) top_builddir=$(top_builddir) doxygen $(DOXYGEN_CFG) 
    10  
    11 endif 
    12  
    13 distclean-local: 
    14         -rm -rf $(top_builddir)/doc/html 
    15  
    16 dist-hook: html 
    17         cp -a $(top_builddir)/doc/html $(top_distdir)/doc 
  • libyaml/trunk/include/yaml.h

    r265 r266  
    1 /** 
    2  * @file yaml.h 
    3  * @brief Public interface for libyaml. 
    4  *  
    5  * Include the header file with the code: 
    6  * @code 
    7  * #include <yaml.h> 
    8  * @endcode 
    9  */ 
     1/***************************************************************************** 
     2 * Public Interface for LibYAML 
     3 * 
     4 * Copyright (c) 2006 Kirill Simonov 
     5 * 
     6 * LibYAML is free software; you can use, modify and/or redistribute it under 
     7 * the terms of the MIT license; see the file LICENCE for more details. 
     8 *****************************************************************************/ 
     9 
     10/* 
     11 * General guidelines. 
     12 * 
     13 * Naming conventions: all functions exported by LibYAML starts with the `yaml_` prefix; 
     14 * types starts with `yaml_` and ends with `_t`; macros and enumerations starts 
     15 * with `YAML_`. 
     16 * 
     17 * FIXME: Calling conventions. 
     18 * FIXME: Memory allocation. 
     19 * FIXME: Errors and exceptions. 
     20 * FIXME: And so on, and so forth. 
     21 */ 
     22 
    1023 
    1124#ifndef YAML_H 
     
    2033#include <string.h> 
    2134 
    22 /** 
    23  * @defgroup export Export Definitions 
    24  * @{ 
    25  */ 
    26  
    27 /** The public API declaration. */ 
     35/***************************************************************************** 
     36 * Export Definitions 
     37 *****************************************************************************/ 
     38 
     39/* 
     40 * Public API declarations. 
     41 * 
     42 * The following definitions are relevant only for the Win32 platform.  If you 
     43 * are building LibYAML as a static library or linking your application against 
     44 * LibYAML compiled as a static library, define the macro 
     45 * `YAML_DECLARE_STATIC`.  If you are building LibYAML as a dynamic library 
     46 * (DLL), you need to define `YAML_DECLARE_EXPORT`.  You don't need to define 
     47 * any macros in case you are linking your application against LibYAML compiled 
     48 * as DLL. 
     49 * 
     50 * There is no need to define any macros if you use LibYAML on non-Win32 
     51 * platform. 
     52 */ 
    2853 
    2954#ifdef WIN32 
     
    3964#endif 
    4065 
    41 /** @} */ 
    42  
    43 /** 
    44  * @defgroup version Version Information 
    45  * @{ 
    46  */ 
    47  
    48 /** The major version number. */ 
     66/***************************************************************************** 
     67 * Version Information 
     68 *****************************************************************************/ 
     69 
     70/* 
     71 * The major, minor and patch version numbers of LibYAML. 
     72 */ 
     73 
    4974#define YAML_VERSION_MAJOR  0 
    50  
    51 /** The minor version number. */ 
    5275#define YAML_VERSION_MINOR  2 
    53  
    54 /** The patch version number. */ 
    5576#define YAML_VERSION_PATCH  0 
    5677 
    57 /** The version string generator macro. */ 
    58 #define YAML_VERSION_STRING_GENERATOR(major,minor,patch)                        \ 
    59     (#major "." #minor "." #patch) 
    60  
    61 /** The version string. */ 
    62 #define YAML_VERSION_STRING                                                     \ 
    63     YAML_VERSION_STRING_GENERATOR(YAML_VERSION_MAJOR,YAML_VERSION_MINOR,YAML_VERSION_PATCH) 
    64  
    65 /** 
     78/* 
     79 * The version of LibYAML as a string. 
     80 */ 
     81 
     82#define YAML_VERSION_STRING "0.2.0" 
     83 
     84/* 
    6685 * Get the library version numbers at runtime. 
    6786 * 
    68  * @param[out]      major   Major version number. 
    69  * @param[out]      minor   Minor version number. 
    70  * @param[out]      patch   Patch version number. 
     87 * Arguments: 
     88 * 
     89 * - `major`: a pointer to store the major version number. 
     90 * 
     91 * - `minor`: a pointer to store the minor version number. 
     92 * 
     93 * - `patch`: a pointer to store the patch version number. 
    7194 */ 
    7295 
     
    7497yaml_get_version(int *major, int *minor, int *patch); 
    7598 
    76 /** 
     99/* 
    77100 * Get the library version as a string at runtime. 
    78101 * 
    79  * @returns The function returns the pointer to a static string of the form 
    80  * @c "X.Y.Z", where @c X is the major version number, @c Y is the minor version 
    81  * number, and @c Z is the patch version number. 
     102 * Returns: the version of LibYAML as a static string. 
    82103 */ 
    83104 
     
    85106yaml_get_version_string(void); 
    86107 
    87 /** @} */ 
    88  
    89 /** 
    90  * @defgroup styles Error Handling 
    91  * @{ 
    92  */ 
    93  
    94 /** Many bad things could happen with the parser and the emitter. */ 
     108/***************************************************************************** 
     109 * Error Handling 
     110 *****************************************************************************/ 
     111 
     112/* 
     113 * The type of the error. 
     114 * 
     115 * The YAML parser and emitter reports any error details using the 
     116 * `yaml_error_t` structure.  The error type shows what subsystem generated the 
     117 * error and what additional information about the error is available. 
     118 */ 
     119 
    95120typedef enum yaml_error_type_e { 
    96     /** No error is produced. */ 
     121    /* No error was produced. */ 
    97122    YAML_NO_ERROR, 
    98123 
    99     /** Cannot allocate or reallocate a block of memory. */ 
     124    /* Cannot allocate or reallocate a block of memory. */ 
    100125    YAML_MEMORY_ERROR, 
    101126 
    102     /** Cannot read from the input stream. */ 
     127    /* Cannot read from the input stream. */ 
    103128    YAML_READER_ERROR, 
    104     /** Cannot decode the input stream. */ 
     129    /* Cannot decode a character in the input stream. */ 
    105130    YAML_DECODER_ERROR, 
    106     /** Cannot scan a YAML token. */ 
     131    /* Cannot scan a YAML token. */ 
    107132    YAML_SCANNER_ERROR, 
    108     /** Cannot parse a YAML production. */ 
     133    /* Cannot parse a YAML event. */ 
    109134    YAML_PARSER_ERROR, 
    110     /** Cannot compose a YAML document. */ 
     135    /* Cannot compose a YAML document. */ 
    111136    YAML_COMPOSER_ERROR, 
    112137 
    113     /** Cannot write into the output stream. */ 
     138    /* Cannot write into the output stream. */ 
    114139    YAML_WRITER_ERROR, 
    115     /** Cannot emit a YAML event. */ 
     140    /* Cannot emit a YAML event. */ 
    116141    YAML_EMITTER_ERROR, 
    117     /** Cannot serialize a YAML document. */ 
     142    /* Cannot serialize a YAML document. */ 
    118143    YAML_SERIALIZER_ERROR, 
    119144 
    120     /** Cannot resolve an implicit tag. */ 
     145    /* Cannot resolve an implicit YAML node tag. */ 
    121146    YAML_RESOLVER_ERROR 
    122147} yaml_error_type_t; 
    123148 
    124 /** The pointer position. */ 
     149/* 
     150 * Position in the input stream. 
     151 * 
     152 * Marks are used to indicate the position of YAML tokens, events and documents 
     153 * in the input stream as well as to point to the place where a parser error has 
     154 * occured. 
     155 */ 
     156 
    125157typedef struct yaml_mark_s { 
    126     /** The character number (starting from zero). */ 
     158    /* The number of the character in the input stream (starting from zero). */ 
    127159    size_t index; 
    128  
    129     /** The mark line (starting from zero). */ 
     160    /* The line in the input stream (starting from zero). */ 
    130161    size_t line; 
    131  
    132     /** The mark column (starting from zero). */ 
     162    /* The column in the input stream (starting from zero). */ 
    133163    size_t column; 
    134164} yaml_mark_t; 
    135165 
    136 /** The error details. */ 
     166/* 
     167 * Error details. 
     168 * 
     169 * The structure gives detailed information on any problem that occured during 
     170 * parsing or emitting. 
     171 */ 
     172 
    137173typedef struct yaml_error_s { 
    138174 
    139     /** The error type. */ 
     175    /* The error type. */ 
    140176    yaml_error_type_t type; 
    141177 
    142     /** The detailed error information. */ 
     178    /* The specific information for each error type. */ 
    143179    union { 
    144180 
    145         /** 
    146          * A problem while reading the stream (@c YAML_READER_ERROR or 
    147          * @c YAML_DECODER_ERROR). 
     181        /* 
     182         * A problem occured while reading the input stream (relevant for 
     183         * `YAML_READER_ERROR` and `YAML_DECODER_ERROR`). 
    148184         */ 
    149185        struct { 
    150             /** The problem description. */ 
     186            /* The problem description. */ 
    151187            const char *problem; 
    152             /** The stream offset. */ 
     188            /* The position in the input stream, in bytes. */ 
    153189            size_t offset; 
    154             /** The problematic octet or character (@c -1 if not applicable). */ 
     190            /* The problematic octet or character (`-1` if not applicable). */ 
    155191            int value; 
    156192        } reading; 
    157193 
    158         /** 
    159          * A problem while loading the stream (@c YAML_SCANNER_ERROR, 
    160          * @c YAML_PARSER_ERROR, or @c YAML_COMPOSER_ERROR). 
     194        /* 
     195         * A problem occured while loading YAML data from the input stream 
     196         * (relevant for `YAML_SCANNER_ERROR`, `YAML_PARSER_ERROR`, and 
     197         * `YAML_COMPOSER_ERROR`). 
    161198         */ 
    162199        struct { 
    163             /** The context in which the problem occured 
    164              * (@c NULL if not applicable). 
    165              */ 
     200            /* The description of the context in which the problem occured 
     201               (`NULL` if not applicable). */ 
    166202            const char *context; 
    167             /** The context mark (if @c problem_mark is not @c NULL). **/ 
     203            /* The context mark (if `context` is not `NULL`). */ 
    168204            yaml_mark_t context_mark; 
    169             /** The problem description. */ 
     205            /* The problem description. */ 
    170206            const char *problem; 
    171             /** The problem mark. */ 
     207            /* The problem mark. */ 
    172208            yaml_mark_t problem_mark; 
    173209        } loading; 
    174210 
    175         /** A problem while writing into the stream (@c YAML_WRITER_ERROR). */ 
     211        /* 
     212         * A problem occured while writing into the output stream (relevant for 
     213         * `YAML_WRITER_ERROR`). 
     214         */ 
    176215        struct { 
    177             /** The problem description. */ 
     216            /* The problem description. */ 
    178217            const char *problem; 
    179             /** The stream offset. */ 
     218            /* The position in the output stream, in bytes. */ 
    180219            size_t offset; 
    181220        } writing; 
    182221 
    183         /** A problem while dumping into the stream (@c YAML_EMITTER_ERROR and 
    184          * @c YAML_SERIALIZER_ERROR). 
     222        /* 
     223         * A problem while dumping YAML data into the output stream (relevant 
     224         * for `YAML_EMITTER_ERROR` and `YAML_SERIALIZER_ERROR`). 
    185225         */ 
    186226        struct { 
    187             /** The problem description. */ 
     227            /* The problem description. */ 
    188228            const char *problem; 
    189229        } dumping; 
    190230 
    191         /** A problem while resolving an implicit tag (@c YAML_RESOLVER_ERROR). */ 
     231        /* 
     232         * A problem occured while resolving an implicit YAML node tag 
     233         * (relevant for `YAML_RESOLVER_ERROR`). 
     234         */ 
    192235        struct { 
    193             /** The problem description. */ 
     236            /* The problem description. */ 
    194237            const char *problem; 
    195238        } resolving; 
     
    199242} yaml_error_t; 
    200243 
    201 /** 
    202  * Create an error message. 
    203  * 
    204  * @param[in]   error   An error object. 
    205  * @param[out]  buffer         model   A token to copy. 
    206  * 
    207  * @returns @c 1 if the function succeeded, @c 0 on error.  The function may 
    208  * fail if the buffer is not large enough to contain the whole message. 
     244/* 
     245 * Generate an error message. 
     246 * 
     247 * Given an instance of the `yaml_error_t` structure and a buffer, the function 
     248 * fills the buffer with a message describing the error.  The generated message 
     249 * follows the pattern: `"Error type: error details"`.  If the buffer is not 
     250 * large enough to hold the whole message, the function fails. 
     251 * 
     252 * Arguments: 
     253 * 
     254 * - `error`: an error object obtained using `yaml_parser_get_error()` or 
     255 *   `yaml_emitter_get_error()`. 
     256 * 
     257 * - `buffer`: a pointer to a character buffer to be filled with a generated 
     258 *   error message. 
     259 * 
     260 * - `capacity`: the size of the buffer. 
     261 * 
     262 * Returns: `1` if the function succeeded, `0` on error.  The function may fail 
     263 * if the provided buffer is not large enough to hold the whole buffer, in 
     264 * which case an application may increase the size of the buffer and call the 
     265 * function again.  If the function fails, the content of the buffer is 
     266 * undefined. 
    209267 */ 
    210268 
     
    212270yaml_error_message(yaml_error_t *error, char *buffer, size_t capacity); 
    213271 
    214 /** @} */ 
    215  
    216 /** 
    217  * @defgroup basic Basic Types 
    218  * @{ 
    219  */ 
    220  
    221 /** The character type (UTF-8 octet). */ 
     272/****************************************************************************** 
     273 * Basic Types 
     274 ******************************************************************************/ 
     275 
     276/* 
     277 * The character type (UTF-8 octet). 
     278 * 
     279 * Usage of the string type `(yaml_char_t *)` in the LibYAML API indicates that 
     280 * the string is encoded in UTF-8. 
     281 */ 
     282 
    222283typedef unsigned char yaml_char_t; 
    223284 
    224 /** The version directive data. */ 
     285/* 
     286 * The version directive information. 
     287 * 
     288 * Note that LibYAML only supports YAML 1.1. 
     289 */ 
     290 
    225291typedef struct yaml_version_directive_s { 
    226     /** The major version number. */ 
     292    /* The major version number. */ 
    227293    int major; 
    228     /** The minor version number. */ 
     294    /* The minor version number. */ 
    229295    int minor; 
    230296} yaml_version_directive_t; 
    231297 
    232 /** The tag directive data. */ 
     298/* 
     299 * The tag directive information. 
     300 */ 
     301 
    233302typedef struct yaml_tag_directive_s { 
    234     /** The tag handle. */ 
     303    /* The tag handle. */ 
    235304    yaml_char_t *handle; 
    236     /** The tag prefix. */ 
     305    /* The tag prefix. */ 
    237306    yaml_char_t *prefix; 
    238307} yaml_tag_directive_t; 
    239308 
    240 /** The stream encoding. */ 
     309/* 
     310 * The stream encoding. 
     311 * 
     312 * An application may explicitly specify the encoding in the input stream or 
     313 * let the parser to detect the input stream encoding from a BOM mark.  If the 
     314 * stream does not start with a BOM mark, UTF-8 is assumed. 
     315 * 
     316 * An application may specify the encoding of the output stream or let the 
     317 * emitter to choose a suitable encoding, in which case, UTF-8 is used. 
     318 */ 
     319 
    241320typedef enum yaml_encoding_e { 
    242     /** Let the parser choose the encoding. */ 
     321    /* The default/autodetected encoding. */ 
    243322    YAML_ANY_ENCODING, 
    244     /** The default UTF-8 encoding. */ 
     323    /* The UTF-8 encoding. */ 
    245324    YAML_UTF8_ENCODING, 
    246     /** The UTF-16-LE encoding with BOM. */ 
     325    /* The UTF-16-LE encoding. */ 
    247326    YAML_UTF16LE_ENCODING, 
    248     /** The UTF-16-BE encoding with BOM. */ 
     327    /* The UTF-16-BE encoding. */ 
    249328    YAML_UTF16BE_ENCODING 
    250329} yaml_encoding_t; 
    251330 
    252 /** Line break types. */ 
     331/* 
     332 * Line break types. 
     333 * 
     334 * An application may specify the line break type the emitter should use or 
     335 * leave it to the emitter discretion.  In the latter case, LN (Unix style) is 
     336 * used. 
     337 */ 
     338 
    253339typedef enum yaml_break_e { 
    254     /** Let the parser choose the break type. */ 
     340    /* Let the parser choose the break type. */ 
    255341    YAML_ANY_BREAK, 
    256     /** Use CR for line breaks (Mac style). */ 
     342    /* Use CR for line breaks (Mac style). */ 
    257343    YAML_CR_BREAK, 
    258     /** Use LN for line breaks (Unix style). */ 
     344    /* Use LN for line breaks (Unix style). */ 
    259345    YAML_LN_BREAK, 
    260     /** Use CR LN for line breaks (DOS style). */ 
     346    /* Use CR LN for line breaks (DOS style). */ 
    261347    YAML_CRLN_BREAK 
    262348} yaml_break_t; 
    263349 
    264 /** @} */ 
    265  
    266 /** 
    267  * @defgroup styles Node Styles 
    268  * @{ 
    269  */ 
    270  
    271 /** Scalar styles. */ 
     350/****************************************************************************** 
     351 * Node Styles 
     352 ******************************************************************************/ 
     353 
     354/* 
     355 * Scalar styles. 
     356 * 
     357 * There are two groups of scalar types in YAML: flow and block.  Flow scalars 
     358 * are divided into three styles: plain, single-quoted, and double-quoted; 
     359 * block scalars are divided into two styles: literal and folded. 
     360 * 
     361 * The parser reports the style in which a scalar node is represented, however 
     362 * it is a purely presentation details that must not be used in interpreting 
     363 * the node content. 
     364 * 
     365 * An application may suggest a preferred node style or leave it completely 
     366 * to the emitter discretion.  Note that the emitter may ignore any stylistic 
     367 * suggestions. 
     368 */ 
     369 
    272370typedef enum yaml_scalar_style_e { 
    273     /** Let the emitter choose the style. */ 
     371    /* Let the emitter choose the style. */ 
    274372    YAML_ANY_SCALAR_STYLE, 
    275373 
    276     /** The plain scalar style. */ 
     374    /* The plain flow scalar style. */ 
    277375    YAML_PLAIN_SCALAR_STYLE, 
    278376 
    279     /** The single-quoted scalar style. */ 
     377    /* The single-quoted flow scalar style. */ 
    280378    YAML_SINGLE_QUOTED_SCALAR_STYLE, 
    281     /** The double-quoted scalar style. */ 
     379    /* The double-quoted flow scalar style. */ 
    282380    YAML_DOUBLE_QUOTED_SCALAR_STYLE, 
    283381 
    284     /** The literal scalar style. */ 
     382    /* The literal block scalar style. */ 
    285383    YAML_LITERAL_SCALAR_STYLE, 
    286     /** The folded scalar style. */ 
     384    /* The folded block scalar style. */ 
    287385    YAML_FOLDED_SCALAR_STYLE 
    288386} yaml_scalar_style_t; 
    289387 
    290 /** Sequence styles. */ 
     388/* 
     389 * Sequence styles. 
     390 * 
     391 * YAML supports two sequence styles: flow and block. 
     392 * 
     393 * The parser reports the style of a sequence node, but this information should 
     394 * not be used in interpreting the sequence content. 
     395 * 
     396 * An application may suggest a preferred sequence style or leave it completely 
     397 * to the emitter discretion.  Note that the emitter may ignore any stylistic 
     398 * hints. 
     399 */ 
    291400typedef enum yaml_sequence_style_e { 
    292     /** Let the emitter choose the style. */ 
     401    /* Let the emitter choose the style. */ 
    293402    YAML_ANY_SEQUENCE_STYLE, 
    294403 
    295     /** The block sequence style. */ 
     404    /* The flow sequence style. */ 
     405    YAML_FLOW_SEQUENCE_STYLE 
     406    /* The block sequence style. */ 
    296407    YAML_BLOCK_SEQUENCE_STYLE, 
    297     /** The flow sequence style. */ 
    298     YAML_FLOW_SEQUENCE_STYLE 
    299408} yaml_sequence_style_t; 
    300409 
    301 /** Mapping styles. */ 
     410/* 
     411 * Mapping styles. 
     412 * 
     413 * YAML supports two mapping styles: flow and block. 
     414 * 
     415 * The parser reports the style of a mapping node, but this information should 
     416 * not be used in interpreting the mapping content. 
     417 * 
     418 * An application may suggest a preferred mapping style or leave it completely 
     419 * to the emitter discretion.  Note that the emitter may ignore any stylistic 
     420 * hints. 
     421 */ 
     422 
    302423typedef enum yaml_mapping_style_e { 
    303     /** Let the emitter choose the style. */ 
     424    /* Let the emitter choose the style. */ 
    304425    YAML_ANY_MAPPING_STYLE, 
    305426 
    306     /** The block mapping style. */ 
     427    /* The block mapping style. */ 
    307428    YAML_BLOCK_MAPPING_STYLE, 
    308     /** The flow mapping style. */ 
     429    /* The flow mapping style. */ 
    309430    YAML_FLOW_MAPPING_STYLE 
    310 /*    YAML_FLOW_SET_MAPPING_STYLE   */ 
    311431} yaml_mapping_style_t; 
    312432 
    313 /** @} */ 
    314  
    315 /** 
    316  * @defgroup tokens Tokens 
    317  * @{ 
    318  */ 
    319  
    320 /** Token types. */ 
     433/****************************************************************************** 
     434 * Tokens 
     435 ******************************************************************************/ 
     436 
     437/* 
     438 * Token types. 
     439 * 
     440 * The LibYAML scanner generates the following types of tokens: 
     441 * 
     442 * - STREAM-START: indicates the beginning of the stream. 
     443 * 
     444 * - STREAM-END: indicates the end of the stream. 
     445 * 
     446 * - VERSION-DIRECTIVE: describes the `%YAML` directive. 
     447 * 
     448 * - TAG-DIRECTIVE: describes the `%TAG` directive. 
     449 * 
     450 * - DOCUMENT-START: the indicator `---`. 
     451 * 
     452 * - DOCUMENT-END: the indicator `...`. 
     453 * 
     454 * - BLOCK-SEQUENCE-START: indentation increase indicating the beginning of a 
     455 *   block sequence node. 
     456 * 
     457 * - BLOCK-MAPPING-START: indentation increase indicating the beginning of a 
     458 *   block mapping node. 
     459 * 
     460 * - BLOCK-END: indentation decrease indicating the end of a block collection 
     461 *   node. 
     462 * 
     463 * - FLOW-SEQUENCE-START: the indicator `[`. 
     464 * 
     465 * - FLOW-SEQUENCE-END: the indicator `]`. 
     466 * 
     467 * - FLOW-MAPPING-START: the indicator `{`. 
     468 * 
     469 * - FLOW-MAPPING-END: the indicator `}`. 
     470 * 
     471 * - BLOCK-ENTRY: the beginning of an item of a block sequence. 
     472 * 
     473 * - FLOW-ENTRY: the beginning of an item of a flow sequence. 
     474 * 
     475 * - KEY: the beginning of a simple key, or the indicator `?`. 
     476 * 
     477 * - VALUE: the indicator `:`. 
     478 * 
     479 * - ALIAS: an alias of a node. 
     480 * 
     481 * - ANCHOR: a node anchor. 
     482 * 
     483 * - TAG: a node tag. 
     484 * 
     485 * - SCALAR: the content of a scalar node. 
     486 */ 
     487 
    321488typedef enum yaml_token_type_e { 
    322     /** An empty token. */ 
     489    /* An empty unitialized token. */ 
    323490    YAML_NO_TOKEN, 
    324491 
    325     /** A STREAM-START token. */ 
     492    /* A STREAM-START token. */ 
    326493    YAML_STREAM_START_TOKEN, 
    327     /** A STREAM-END token. */ 
     494    /* A STREAM-END token. */ 
    328495    YAML_STREAM_END_TOKEN, 
    329496 
    330     /** A VERSION-DIRECTIVE token. */ 
     497    /* A VERSION-DIRECTIVE token. */ 
    331498    YAML_VERSION_DIRECTIVE_TOKEN, 
    332     /** A TAG-DIRECTIVE token. */ 
     499    /* A TAG-DIRECTIVE token. */ 
    333500    YAML_TAG_DIRECTIVE_TOKEN, 
    334     /** A DOCUMENT-START token. */ 
     501    /* A DOCUMENT-START token. */ 
    335502    YAML_DOCUMENT_START_TOKEN, 
    336     /** A DOCUMENT-END token. */ 
     503    /* A DOCUMENT-END token. */ 
    337504    YAML_DOCUMENT_END_TOKEN, 
    338505 
    339     /** A BLOCK-SEQUENCE-START token. */ 
     506    /* A BLOCK-SEQUENCE-START token. */ 
    340507    YAML_BLOCK_SEQUENCE_START_TOKEN, 
    341     /** A BLOCK-SEQUENCE-END token. */ 
     508    /* A BLOCK-SEQUENCE-END token. */ 
    342509    YAML_BLOCK_MAPPING_START_TOKEN, 
    343     /** A BLOCK-END token. */ 
     510    /* A BLOCK-END token. */ 
    344511    YAML_BLOCK_END_TOKEN, 
    345512 
    346     /** A FLOW-SEQUENCE-START token. */ 
     513    /* A FLOW-SEQUENCE-START token. */ 
    347514    YAML_FLOW_SEQUENCE_START_TOKEN, 
    348     /** A FLOW-SEQUENCE-END token. */ 
     515    /* A FLOW-SEQUENCE-END token. */ 
    349516    YAML_FLOW_SEQUENCE_END_TOKEN, 
    350     /** A FLOW-MAPPING-START token. */ 
     517    /* A FLOW-MAPPING-START token. */ 
    351518    YAML_FLOW_MAPPING_START_TOKEN, 
    352     /** A FLOW-MAPPING-END token. */ 
     519    /* A FLOW-MAPPING-END token. */ 
    353520    YAML_FLOW_MAPPING_END_TOKEN, 
    354521 
    355     /** A BLOCK-ENTRY token. */ 
     522    /* A BLOCK-ENTRY token. */ 
    356523    YAML_BLOCK_ENTRY_TOKEN, 
    357     /** A FLOW-ENTRY token. */ 
     524    /* A FLOW-ENTRY token. */ 
    358525    YAML_FLOW_ENTRY_TOKEN, 
    359     /** A KEY token. */ 
     526    /* A KEY token. */ 
    360527    YAML_KEY_TOKEN, 
    361     /** A VALUE token. */ 
     528    /* A VALUE token. */ 
    362529    YAML_VALUE_TOKEN, 
    363530 
    364     /** An ALIAS token. */ 
     531    /* An ALIAS token. */ 
    365532    YAML_ALIAS_TOKEN, 
    366     /** An ANCHOR token. */ 
     533    /* An ANCHOR token. */ 
    367534    YAML_ANCHOR_TOKEN, 
    368     /** A TAG token. */ 
     535    /* A TAG token. */ 
    369536    YAML_TAG_TOKEN, 
    370     /** A SCALAR token. */ 
     537    /* A SCALAR token. */ 
    371538    YAML_SCALAR_TOKEN 
    372539} yaml_token_type_t; 
    373540 
    374 /** The token structure. */ 
     541/* 
     542 * The token object. 
     543 * 
     544 * Typically the token API is too low-level to be used directly by 
     545 * applications.  A possible user of the token API is a syntax highlighting 
     546 * application. 
     547 */ 
     548 
    375549typedef struct yaml_token_s { 
    376550 
    377     /** The token type. */ 
     551    /* The token type. */ 
    378552    yaml_token_type_t type; 
    379553 
    380     /** The token data. */ 
     554    /* The token data. */ 
    381555    union { 
    382556 
    383         /** The stream start (for @c YAML_STREAM_START_TOKEN). */ 
     557        /* Extra data associated with a STREAM-START token. */ 
    384558        struct { 
    385             /** The stream encoding. */ 
     559            /* The stream encoding. */ 
    386560            yaml_encoding_t encoding; 
    387561        } stream_start; 
    388562 
    389         /** The version directive (for @c YAML_VERSION_DIRECTIVE_TOKEN). */ 
     563        /* Extra data associated with a VERSION-DIRECTIVE token. */ 
    390564        struct { 
    391             /** The major version number. */ 
     565            /* The major version number. */ 
    392566            int major; 
    393             /** The minor version number. */ 
     567            /* The minor version number. */ 
    394568            int minor; 
    395569        } version_directive; 
    396570 
    397         /** The tag directive (for @c YAML_TAG_DIRECTIVE_TOKEN). */ 
     571        /* Extra data associated with a TAG-DIRECTIVE token. */ 
    398572        struct { 
    399             /** The tag handle. */ 
     573            /* The tag handle. */ 
    400574            yaml_char_t *handle; 
    401             /** The tag prefix. */ 
     575            /* The tag prefix. */ 
    402576            yaml_char_t *prefix; 
    403577        } tag_directive; 
    404578 
    405         /** The alias (for @c YAML_ALIAS_TOKEN). */ 
     579        /* Extra data associated with an ALIAS token. */ 
    406580        struct { 
    407             /** The alias value. */ 
     581            /* The alias value. */ 
    408582            yaml_char_t *value; 
    409583        } alias; 
    410584 
    411         /** The anchor (for @c YAML_ANCHOR_TOKEN). */ 
     585        /* Extra data associated with an ANCHOR token. */ 
    412586        struct { 
    413             /** The anchor value. */ 
     587            /* The anchor value. */ 
    414588            yaml_char_t *value; 
    415589        } anchor; 
    416590 
    417         /** The tag (for @c YAML_TAG_TOKEN). */ 
     591        /* Extra data associated with a TAG token. */ 
    418592        struct { 
    419             /** The tag handle. */ 
     593            /* The tag handle. */ 
    420594            yaml_char_t *handle; 
    421             /** The tag suffix. */ 
     595            /* The tag suffix. */ 
    422596            yaml_char_t *suffix; 
    423597        } tag; 
    424598 
    425         /** The scalar value (for @c YAML_SCALAR_TOKEN). */ 
     599        /* Extra data associated with a SCALAR token. */ 
    426600        struct { 
    427             /** The scalar value. */ 
     601            /* The scalar value. */ 
    428602            yaml_char_t *value; 
    429             /** The length of the scalar value. */ 
     603            /* The length of the scalar value. */ 
    430604            size_t length; 
    431             /** The scalar style. */ 
     605            /* The scalar style. */ 
    432606            yaml_scalar_style_t style; 
    433607        } scalar; 
     
    435609    } data; 
    436610 
    437     /** The beginning of the token. */ 
     611    /* The beginning of the token. */ 
    438612    yaml_mark_t start_mark; 
    439     /** The end of the token. */ 
     613    /* The end of the token. */ 
    440614    yaml_mark_t end_mark; 
    441615 
    442616} yaml_token_t; 
    443617 
    444 /** 
     618/* 
    445619 * Allocate a new empty token object. 
    446620 * 
    447  * @returns a new token object or @c NULL on error. 
     621 * A token object allocated using this function must be deleted with 
     622 * `yaml_token_delete()`. 
     623 * 
     624 * Returns: a new empty token object or `NULL` on error.  The function may fail 
     625 * if it cannot allocate memory for a new token object. 
    448626 */ 
    449627 
     
    451629yaml_token_new(void); 
    452630 
    453 /** 
    454  * Delete and deallocate a token object. 
    455  * 
    456  * @param[in,out]   token   A token object. 
     631/* 
     632 * Deallocate a token object and free the associated data. 
     633 * 
     634 * A token object must be previously allocated with `yaml_token_new()`. 
     635 * 
     636 * Arguments: 
     637 * 
     638 * - `token`: a token object to be deallocated. 
    457639 */ 
    458640 
     
    460642yaml_token_delete(yaml_token_t *token); 
    461643 
    462 /** 
     644/* 
    463645 * Duplicate a token object. 
    464646 * 
    465  * @param[in,out]   token   An empty token object. 
    466  * @param[in]       model   A token to copy. 
    467  * 
    468  * @returns @c 1 if the function succeeded, @c 0 on error. 
     647 * This function creates a deep copy of an existing token object.  It accepts 
     648 * two token objects: an empty token and a model token.  The latter is supposed 
     649 * to be initialized with `yaml_parser_parse_token()`.  The function assigns 
     650 * the type of the model to the empty token as well as duplicates and copies 
     651 * the internal state associated with the model token. 
     652 * 
     653 * Arguments: 
     654 * 
     655 * - `token`: an empty token object. 
     656 * 
     657 * - `model`: a token to be copied. 
     658 * 
     659 * Returns: `1` on success, `0` on error.  The function may fail if it cannot 
     660 * allocate memory for duplicating the state of the model token.  In that case, 
     661 * the token remains empty. 
    469662 */ 
    470663 
     
    472665yaml_token_duplicate(yaml_token_t *token, const yaml_token_t *model); 
    473666 
    474 /** 
    475  * Free any memory allocated for a token object. 
    476  * 
    477  * @param[in,out]   token   A token object. 
     667/* 
     668 * Clear the token state. 
     669 * 
     670 * This function clears the type and the internal state of a token object 
     671 * freeing any associated data.  After applying this function to a token, it 
     672 * becomes empty.  It is supposed that the token was previously initialized 
     673 * using `yaml_parser_parse_token()` or `yaml_token_duplicate()`. 
     674 * 
     675 * Arguments: 
     676 * 
     677 * - `token`: a token object. 
    478678 */ 
    479679 
    480680YAML_DECLARE(void) 
    481 yaml_token_destroy(yaml_token_t *token); 
    482  
    483 /** @} */ 
    484  
    485 /** 
    486  * @defgroup events Events 
    487  * @{ 
    488  */ 
    489  
    490 /** Event types. */ 
     681yaml_token_clear(yaml_token_t *token); 
     682 
     683/****************************************************************************** 
     684 * Events 
     685 ******************************************************************************/ 
     686 
     687/* 
     688 * Event types. 
     689 * 
     690 * The LibYAML parser generates, while the LibYAML emitter accepts, YAML events 
     691 * of the following types: 
     692 * 
     693 * - STREAM-START: indicates the beginning of the stream. 
     694 * 
     695 * - STREAM-END: indicates the end of the stream. 
     696 * 
     697 * - DOCUMENT-START: indicates the beginning of the document. 
     698 * 
     699 * - DOCUMENT-END: indicates the end of the document. 
     700 * 
     701 * - ALIAS: an alias to an already produced node. 
     702 * 
     703 * - SCALAR: a scalar node. 
     704 * 
     705 * - SEQUENCE-START: indicates the beginning of a sequence node. 
     706 * 
     707 * - SEQUENCE-END: indicates the end of a sequence node. 
     708 * 
     709 * - MAPPING-START: indicates the beginning of a mapping node. 
     710 * 
     711 * - MAPPING-END: indicates the end of a mapping node. 
     712 * 
     713 * A valid sequence of events obeys the grammar: 
     714 * 
     715 *      stream ::= STREAM-START document* STREAM-END 
     716 *      document ::= DOCUMENT-START node DOCUMENT-END 
     717 *      node ::= ALIAS | SCALAR | sequence | mapping 
     718 *      sequence ::= SEQUENCE-START node* SEQUENCE-END 
     719 *      mapping ::= MAPPING-START (node node)* MAPPING-END 
     720 */ 
     721 
    491722typedef enum yaml_event_type_e { 
    492     /** An empty event. */ 
     723    /* An empty unitialized event. */ 
    493724    YAML_NO_EVENT, 
    494725 
    495     /** A STREAM-START event. */ 
     726    /* A STREAM-START event. */ 
    496727    YAML_STREAM_START_EVENT, 
    497     /** A STREAM-END event. */ 
     728    /* A STREAM-END event. */ 
    498729    YAML_STREAM_END_EVENT, 
    499730 
    500     /** A DOCUMENT-START event. */ 
     731    /* A DOCUMENT-START event. */ 
    501732    YAML_DOCUMENT_START_EVENT, 
    502     /** A DOCUMENT-END event. */ 
     733    /* A DOCUMENT-END event. */ 
    503734    YAML_DOCUMENT_END_EVENT, 
    504735 
    505     /** An ALIAS event. */ 
     736    /* An ALIAS event. */ 
    506737    YAML_ALIAS_EVENT, 
    507     /** A SCALAR event. */ 
     738    /* A SCALAR event. */ 
    508739    YAML_SCALAR_EVENT, 
    509740 
    510     /** A SEQUENCE-START event. */ 
     741    /* A SEQUENCE-START event. */ 
    511742    YAML_SEQUENCE_START_EVENT, 
    512     /** A SEQUENCE-END event. */ 
     743    /* A SEQUENCE-END event. */ 
    513744    YAML_SEQUENCE_END_EVENT, 
    514745 
    515     /** A MAPPING-START event. */ 
     746    /* A MAPPING-START event. */ 
    516747    YAML_MAPPING_START_EVENT, 
    517     /** A MAPPING-END event. */ 
     748    /* A MAPPING-END event. */ 
    518749    YAML_MAPPING_END_EVENT 
    519750} yaml_event_type_t; 
    520751 
    521 /** The event structure. */ 
     752/* 
     753 * The event object. 
     754 * 
     755 * The event-level API of LibYAML should be used for streaming applications. 
     756 */ 
     757 
    522758typedef struct yaml_event_s { 
    523759 
    524     /** The event type. */ 
     760    /* The event type. */ 
    525761    yaml_event_type_t type; 
    526762 
    527     /** The event data. */ 
     763    /* The event data. */ 
    528764    union { 
    529765         
    530         /** The stream parameters (for @c YAML_STREAM_START_EVENT). */ 
     766        /* The stream parameters (for `YAML_STREAM_START_EVENT`). */ 
    531767        struct { 
    532             /** The document encoding. */ 
     768            /* The document encoding. */ 
    533769            yaml_encoding_t encoding; 
    534770        } stream_start; 
    535771 
    536         /** The document parameters (for @c YAML_DOCUMENT_START_EVENT). */ 
     772        /* The document parameters (for `YAML_DOCUMENT_START_EVENT`). */ 
    537773        struct { 
    538             /** The version directive. */ 
     774            /* The version directive or `NULL` if not present. */ 
    539775            yaml_version_directive_t *version_directive; 
    540776 
    541             /** The list of tag directives. */ 
     777            /* The list of tag directives. */ 
    542778            struct { 
    543                 /** The beginning of the list. */ 
     779                /* The beginning of the list or `NULL`. */ 
    544780                yaml_tag_directive_t *list; 
    545                 /** The length of the list. */ 
     781                /* The length of the list. */ 
    546782                size_t length; 
    547                 /** The capacity of the list. */ 
     783                /* The capacity of the list (used internally). */ 
    548784                size_t capacity; 
    549785            } tag_directives; 
    550786 
    551             /** Is the document indicator implicit? */ 
     787            /* Set if the document indicator is omitted. */ 
    552788            int is_implicit; 
    553789        } document_start; 
    554790 
    555         /** The document end parameters (for @c YAML_DOCUMENT_END_EVENT). */ 
     791        /* The document end parameters (for `YAML_DOCUMENT_END_EVENT`). */ 
    556792        struct { 
    557         &nbs