diff options
Diffstat (limited to 'include/argot/parser.h')
-rw-r--r-- | include/argot/parser.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/include/argot/parser.h b/include/argot/parser.h new file mode 100644 index 0000000..286e42e --- /dev/null +++ b/include/argot/parser.h @@ -0,0 +1,56 @@ +/* argot - Gray's Extensible Configuration System -*- c -*- + Copyright (C) 2007-2016 Sergey Poznyakoff + + Grecs is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3 of the License, or (at your + option) any later version. + + Grecs is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with Grecs. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef _ARGOT_PARSER_H +#define _ARGOT_PARSER_H + +typedef struct argot_node *(*argot_parser_t)(const char *name, int trace); + +#define ARGOT_TRACE_GRAM 0x01 +#define ARGOT_TRACE_LEX 0x02 + +extern int argot_trace_flags; +extern argot_parser_t argot_parser_fun; +extern int argot_default_port; + +extern struct argot_locus_point argot_current_locus_point; +extern argot_locus_t argot_locus; +extern int argot_error_count; + +#define ARGOT_OPTION_ADJUST_STRING_LOCATIONS 0x01 +#define ARGOT_OPTION_QUOTED_STRING_CONCAT 0x02 +extern int argot_parser_options; + +/* Main entry point */ +struct argot_node *argot_parse(const char *name); +void argot_gram_trace(int n); +void argot_lex_trace(int n); + +/* Parsers: */ +struct argot_node *argot_argot_parser(const char *name, int traceflags); +struct argot_node *argot_meta1_parser(const char *name, int traceflags); +struct argot_node *argot_bind_parser(const char *name, int traceflags); +struct argot_node *argot_dhcpd_parser(const char *name, int traceflags); +struct argot_node *argot_git_parser(const char *name, int traceflags); +struct argot_node *argot_path_parser(const char *name, int traceflags); + + +/* Parser database */ +int argot_enumerate_parsers(int (*fun)(const char *, argot_parser_t, void *), + void *); +argot_parser_t argot_get_parser_by_type(const char *type); + +#endif |