Ignore:
Timestamp:
07/04/06 15:39:56 (8 years ago)
Author:
xi
Message:

Start working on the parser.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libyaml/trunk/src/api.c

    r200 r201  
    115115    parser->simple_keys_size = YAML_DEFAULT_SIZE; 
    116116 
     117    /* Allocate the stack of parser states. */ 
     118 
     119    parser->states = yaml_malloc(YAML_DEFAULT_SIZE*sizeof(yaml_parser_state_t)); 
     120    if (!parser->states) goto error; 
     121    memset(parser->states, 0, YAML_DEFAULT_SIZE*sizeof(yaml_parser_state_t)); 
     122 
     123    parser->states_size = YAML_DEFAULT_SIZE; 
     124 
     125    /* Set the initial state. */ 
     126 
     127    parser->state = YAML_PARSE_STREAM_START_STATE; 
     128 
     129    /* Allocate the list of TAG directives. */ 
     130 
     131    parser->tag_directives = yaml_malloc(YAML_DEFAULT_SIZE*sizeof(yaml_tag_directive_t *)); 
     132    if (!parser->tag_directives) goto error; 
     133    memset(parser->tag_directives, 0, YAML_DEFAULT_SIZE*sizeof(yaml_tag_directive_t *)); 
     134 
     135    parser->tag_directives_size = YAML_DEFAULT_SIZE; 
     136 
    117137    /* Done. */ 
    118138 
     
    125145    if (!parser) return NULL; 
    126146 
     147    yaml_free(parser->tag_directives); 
     148    yaml_free(parser->states); 
    127149    yaml_free(parser->simple_keys); 
    128150    yaml_free(parser->indents); 
     
    145167    assert(parser); /* Non-NULL parser object expected. */ 
    146168 
     169    yaml_free(parser->tag_directives); 
     170    yaml_free(parser->states); 
    147171    yaml_free(parser->simple_keys); 
    148172    yaml_free(parser->indents); 
Note: See TracChangeset for help on using the changeset viewer.