/* Copyright 2006 Garrett Rooney. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef DDL_COMMON_H #define DDL_COMMON_H #include "etl_variables.h" #include "etl_resolver.h" #include "lexer.h" typedef struct etl_ddl_parser_t etl_ddl_parser_t; /* An entry in a linked list, used for storing state while parsing DDL * files. */ typedef struct etl_list_entry_t { char *key; etl_variable_t *value; struct etl_list_entry_t *next; } etl_list_entry_t; /* The state we carry around while parsing the DDL. */ typedef struct { etl_list_entry_t *spare_entries; etl_resolver_t *resolver; etl_error_t *err; etl_hash_t *vars; } etl_ddl_parser_state_t; void *etl_ddl_parser_alloc(void *(*alloc_func) (size_t)); void etl_ddl_parser_parse(void *parser, int token, etl_token_t *data, etl_ddl_parser_state_t *state); void etl_ddl_parser_free(void *parser, void (*free_func)(void *)); /* Force Lemon to produce the kind of symbols I want... */ #define etl_ddl_parser_parseAlloc etl_ddl_parser_alloc #define etl_ddl_parser_parseFree etl_ddl_parser_free #define etl_ddl_parser_parseTokenName etl_ddl_parser_token_name #define etl_ddl_parser_parseTrace etl_ddl_parser_trace #endif /* DDL_COMMON_H */