1 /* grecs - Gray's Extensible Configuration System -*- c -*- 2 Copyright (C) 2007-2016 Sergey Poznyakoff 3 4 Grecs is free software; you can redistribute it and/or modify it 5 under the terms of the GNU General Public License as published by the 6 Free Software Foundation; either version 3 of the License, or (at your 7 option) any later version. 8 9 Grecs is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License along 15 with Grecs. If not, see <http://www.gnu.org/licenses/>. */ 16 17 #ifndef _GRECS_PARSER_H 18 #define _GRECS_PARSER_H 19 20 typedef struct grecs_node *(*grecs_parser_t)(const char *name, int trace); 21 22 #define GRECS_TRACE_GRAM 0x01 23 #define GRECS_TRACE_LEX 0x02 24 25 extern int grecs_trace_flags; 26 extern grecs_parser_t grecs_parser_fun; 27 extern int grecs_default_port; 28 29 extern struct grecs_locus_point grecs_current_locus_point; 30 extern grecs_locus_t grecs_locus; 31 extern int grecs_error_count; 32 33 #define GRECS_OPTION_ADJUST_STRING_LOCATIONS 0x01 34 #define GRECS_OPTION_QUOTED_STRING_CONCAT 0x02 35 extern int grecs_parser_options; 36 37 /* Main entry point */ 38 struct grecs_node *grecs_parse(const char *name); 39 void grecs_gram_trace(int n); 40 void grecs_lex_trace(int n); 41 42 /* Parsers: */ 43 struct grecs_node *grecs_grecs_parser(const char *name, int traceflags); 44 struct grecs_node *grecs_meta1_parser(const char *name, int traceflags); 45 struct grecs_node *grecs_bind_parser(const char *name, int traceflags); 46 struct grecs_node *grecs_dhcpd_parser(const char *name, int traceflags); 47 struct grecs_node *grecs_git_parser(const char *name, int traceflags); 48 struct grecs_node *grecs_path_parser(const char *name, int traceflags); 49 50 51 /* Parser database */ 52 int grecs_enumerate_parsers(int (*fun)(const char *, grecs_parser_t, void *), 53 void *); 54 grecs_parser_t grecs_get_parser_by_type(const char *type); 55 56 #endif 57