Changeset 201
- Timestamp:
- 07/04/06 15:39:56 (7 years ago)
- Location:
- libyaml/trunk
- Files:
-
- 1 added
- 3 edited
-
include/yaml.h (modified) (3 diffs)
-
src/Makefile.am (modified) (1 diff)
-
src/api.c (modified) (3 diffs)
-
src/parser.c (added)
Legend:
- Unmodified
- Added
- Removed
-
libyaml/trunk/include/yaml.h
r200 r201 791 791 792 792 /** 793 * The states of the parser. 794 */ 795 typedef enum { 796 YAML_PARSE_END_STATE, 797 YAML_PARSE_STREAM_START_STATE, 798 YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE, 799 YAML_PARSE_DOCUMENT_START_STATE, 800 YAML_PARSE_DOCUMENT_CONTENT_STATE, 801 YAML_PARSE_DOCUMENT_END_STATE, 802 YAML_PARSE_BLOCK_NODE_STATE, 803 YAML_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE, 804 YAML_PARSE_FLOW_NODE_STATE, 805 YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE, 806 YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE, 807 YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE, 808 YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE, 809 YAML_PARSE_BLOCK_MAPPING_KEY_STATE, 810 YAML_PARSE_BLOCK_MAPPING_VALUE_STATE, 811 YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE, 812 YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE, 813 YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE, 814 YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE, 815 YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE, 816 YAML_PARSE_FLOW_MAPPING_FIRST_KEY_STATE, 817 YAML_PARSE_FLOW_MAPPING_KEY_STATE, 818 YAML_PARSE_FLOW_MAPPING_VALUE_STATE, 819 YAML_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE 820 } yaml_parser_state_t; 821 822 /** 793 823 * The parser structure. 794 824 * … … 940 970 */ 941 971 972 /** 973 * @name Parser stuff 974 * @{ 975 */ 976 977 /** The parser states stack. */ 978 yaml_parser_state_t *states; 979 980 /** The size of the parser states stack. */ 981 size_t states_size; 982 983 /** The number of items in the parser states stack. */ 984 size_t states_length; 985 986 /** The current parser state. */ 987 yaml_parser_state_t state; 988 989 /** The stack of marks. */ 990 yaml_mark_t *marks; 991 992 /** The size of the marks stack. */ 993 size_t marks_size; 994 995 /** The number of items in the marks stack. */ 996 size_t marks_length; 997 998 /** The current event. */ 999 yaml_event_t *current_event; 1000 1001 /** The YAML version directive. */ 1002 yaml_version_directive_t *version_directive; 1003 1004 /** The list of TAG directives. */ 1005 yaml_tag_directive_t **tag_directives; 1006 1007 /** The size of the TAG directives list. */ 1008 size_t tag_directives_size; 1009 1010 /** The number of items in the TAG directives list. */ 1011 size_t tag_directives_length; 1012 1013 /** 1014 * @} 1015 */ 1016 942 1017 } yaml_parser_t; 943 1018 … … 1045 1120 yaml_parser_peek_token(yaml_parser_t *parser); 1046 1121 1122 /** 1123 * Get the next event. 1124 * 1125 * The application is responsible for destroing the event object. 1126 * 1127 * @param[in] parser A parser object. 1128 * 1129 * @returns An event object, or @c NULL on error. 1130 */ 1131 1132 YAML_DECLARE(yaml_event_t *) 1133 yaml_parser_get_event(yaml_parser_t *parser); 1134 1135 /** 1136 * Peek the next event. 1137 * 1138 * The event will be returned again on a subsequent call of 1139 * @c yaml_parser_get_event or @c yaml_parser_peek_event. The application 1140 * should not destroy the event object. 1141 * 1142 * @param[in] parser A parser object. 1143 * 1144 * @returns An event object, or @c NULL on error. 1145 */ 1146 1147 YAML_DECLARE(yaml_event_t *) 1148 yaml_parser_peek_event(yaml_parser_t *parser); 1149 1047 1150 /** @} */ 1048 1151 -
libyaml/trunk/src/Makefile.am
r200 r201 1 1 AM_CPPFLAGS = -I$(top_srcdir)/include 2 2 lib_LTLIBRARIES = libyaml.la 3 libyaml_la_SOURCES = api.c reader.c scanner.c 3 libyaml_la_SOURCES = api.c reader.c scanner.c parser.c 4 4 libyaml_la_LDFLAGS = -release $(YAML_LT_RELEASE) -version-info $(YAML_LT_CURRENT):$(YAML_LT_REVISION):$(YAML_LT_AGE) -
libyaml/trunk/src/api.c
r200 r201 115 115 parser->simple_keys_size = YAML_DEFAULT_SIZE; 116 116 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 117 137 /* Done. */ 118 138 … … 125 145 if (!parser) return NULL; 126 146 147 yaml_free(parser->tag_directives); 148 yaml_free(parser->states); 127 149 yaml_free(parser->simple_keys); 128 150 yaml_free(parser->indents); … … 145 167 assert(parser); /* Non-NULL parser object expected. */ 146 168 169 yaml_free(parser->tag_directives); 170 yaml_free(parser->states); 147 171 yaml_free(parser->simple_keys); 148 172 yaml_free(parser->indents);
Note: See TracChangeset
for help on using the changeset viewer.
