Blame


1 395b9f4e 2021-07-12 op /*
2 395b9f4e 2021-07-12 op * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
3 395b9f4e 2021-07-12 op *
4 395b9f4e 2021-07-12 op * Permission to use, copy, modify, and distribute this software for any
5 395b9f4e 2021-07-12 op * purpose with or without fee is hereby granted, provided that the above
6 395b9f4e 2021-07-12 op * copyright notice and this permission notice appear in all copies.
7 395b9f4e 2021-07-12 op *
8 395b9f4e 2021-07-12 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 395b9f4e 2021-07-12 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 395b9f4e 2021-07-12 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 395b9f4e 2021-07-12 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 395b9f4e 2021-07-12 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 395b9f4e 2021-07-12 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 395b9f4e 2021-07-12 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 395b9f4e 2021-07-12 op */
16 395b9f4e 2021-07-12 op
17 395b9f4e 2021-07-12 op #ifndef PARSER_H
18 395b9f4e 2021-07-12 op #define PARSER_H
19 395b9f4e 2021-07-12 op
20 395b9f4e 2021-07-12 op #include "telescope.h"
21 395b9f4e 2021-07-12 op
22 8c1b0837 2021-07-25 op typedef void (*parserfn)(struct parser *);
23 8c1b0837 2021-07-25 op
24 395b9f4e 2021-07-12 op /* parser.c */
25 1fce2e75 2021-08-14 op int load_page_from_str(struct tab *, const char *);
26 1fce2e75 2021-08-14 op
27 8c1b0837 2021-07-25 op void parser_init(struct tab *, parserfn);
28 8c1b0837 2021-07-25 op int parser_parse(struct tab *, const char *, size_t);
29 8c1b0837 2021-07-25 op int parser_free(struct tab *);
30 8c1b0837 2021-07-25 op
31 395b9f4e 2021-07-12 op int parser_append(struct parser*, const char*, size_t);
32 395b9f4e 2021-07-12 op int parser_set_buf(struct parser*, const char*, size_t);
33 395b9f4e 2021-07-12 op int parser_foreach_line(struct parser*, const char*, size_t, parsechunkfn);
34 395b9f4e 2021-07-12 op
35 7527561b 2021-07-25 op /* parser_gemtext.c */
36 7527561b 2021-07-25 op void gemtext_initparser(struct parser*);
37 7527561b 2021-07-25 op
38 81839fee 2021-07-25 op /* parser_gophermap.c */
39 81839fee 2021-07-25 op void gophermap_initparser(struct parser *);
40 81839fee 2021-07-25 op
41 ba49fdf9 2021-07-30 op /* parser_textpatch.c */
42 ba49fdf9 2021-07-30 op void textpatch_initparser(struct parser *);
43 ba49fdf9 2021-07-30 op
44 7527561b 2021-07-25 op /* parser_textplain.c */
45 395b9f4e 2021-07-12 op void textplain_initparser(struct parser*);
46 395b9f4e 2021-07-12 op
47 395b9f4e 2021-07-12 op #endif