diff options
Diffstat (limited to 'include/argot/lex.h')
-rw-r--r-- | include/argot/lex.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/include/argot/lex.h b/include/argot/lex.h new file mode 100644 index 0000000..f0699d2 --- /dev/null +++ b/include/argot/lex.h @@ -0,0 +1,52 @@ +/* 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_LEX_H +#define _ARGOT_LEX_H + +int argot_lex_begin(const char*, int); +void argot_lex_end(int err); + +char *argot_install_text(const char *str); +void argot_destroy_text(void); +struct argot_symtab *argot_text_table(void); + +void argot_parse_line_directive(char *text, argot_locus_t *ploc, + struct argot_locus_point *ppoint, + size_t *pxlines); +void argot_parse_line_directive_cpp(char *text, argot_locus_t *ploc, + struct argot_locus_point *ppoint, + size_t *pxlines); + +void argot_line_acc_create(void); +void argot_line_acc_free(void); +void argot_line_acc_grow_char(int c); +int argot_line_acc_grow_char_unescape(int c); +void argot_line_acc_grow(const char *text, size_t len); +void argot_line_acc_grow_unescape_last(char *text, size_t len, + argot_locus_t const *loc); + +void argot_line_begin(void); +#define argot_line_add argot_line_acc_grow +char *argot_line_finish(void); + +int argot_str_is_ipv4(const char *addr); +int argot_str_is_num(const char *s); +int argot_str_is_ipv6(const char *addr); +int argot_str_is_num(const char *s); +int argot_str_is_ipaddr(const char *addr); + +#endif |