1 | /****************** 2 | Copyright (c) 2002 RIPE NCC 3 | 4 | All Rights Reserved 5 | 6 | Permission to use, copy, modify, and distribute this software and its 7 | documentation for any purpose and without fee is hereby granted, 8 | provided that the above copyright notice appear in all copies and that 9 | both that copyright notice and this permission notice appear in 10 | supporting documentation, and that the name of the author not be 11 | used in advertising or publicity pertaining to distribution of the 12 | software without specific, written prior permission. 13 | 14 | THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 15 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL 16 | AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 17 | DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 18 | AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 19 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20 | ***************************************/ 21 | 22 | #ifndef SYNTAX_H 23 | #define SYNTAX_H 24 | 25 | #include <glib.h> 26 | #include <sys/types.h> 27 | #include <regex.h> 28 | 29 | typedef struct { 30 | char *name; 31 | char *core_regex_pattern; 32 | regex_t *core_regex; 33 | char *core_reserved_regex_pattern; 34 | regex_t *core_reserved_regex; 35 | void (*core_parser_reset)(); 36 | int (*core_parser)(); 37 | char *front_end_regex_pattern; 38 | regex_t *front_end_regex; 39 | char *front_end_reserved_regex_pattern; 40 | regex_t *front_end_reserved_regex; 41 | void (*front_end_parser_reset)(); 42 | int (*front_end_parser)(); 43 | } syntax_t; 44 | 45 | /* types of checks */ 46 | typedef enum { 47 | SYNTAX_CHECK_CORE = 1, 48 | SYNTAX_CHECK_FRONT_END = 2 49 | } syntax_check_t; 50 | 51 | /* functions */ 52 | GPtrArray *syntax_check_by_offset(int offset, 53 | syntax_check_t type, 54 | const char *s); 55 | GPtrArray *syntax_check_by_name(const char *name, 56 | syntax_check_t type, 57 | const char *s); 58 | 59 | #endif /* SYNTAX_H */