1 #ifndef CMARK_PARSER_H
2 #define CMARK_PARSER_H
3 
4 #include <stdio.h>
5 #include "node.h"
6 #include "buffer.h"
7 #include "memory.h"
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 #define MAX_LINK_LABEL_LENGTH 1000
14 
15 struct cmark_parser {
16   struct cmark_mem *mem;
17   /* A hashtable of urls in the current document for cross-references */
18   struct cmark_map *refmap;
19   /* The root node of the parser, always a CMARK_NODE_DOCUMENT */
20   struct cmark_node *root;
21   /* The last open block after a line is fully processed */
22   struct cmark_node *current;
23   /* See the documentation for cmark_parser_get_line_number() in cmark.h */
24   int line_number;
25   /* See the documentation for cmark_parser_get_offset() in cmark.h */
26   bufsize_t offset;
27   /* See the documentation for cmark_parser_get_column() in cmark.h */
28   bufsize_t column;
29   /* See the documentation for cmark_parser_get_first_nonspace() in cmark.h */
30   bufsize_t first_nonspace;
31   /* See the documentation for cmark_parser_get_first_nonspace_column() in cmark.h */
32   bufsize_t first_nonspace_column;
33   /* See the documentation for cmark_parser_get_indent() in cmark.h */
34   int indent;
35   /* See the documentation for cmark_parser_is_blank() in cmark.h */
36   bool blank;
37   /* See the documentation for cmark_parser_has_partially_consumed_tab() in cmark.h */
38   bool partially_consumed_tab;
39   /* Contains the currently processed line */
40   cmark_strbuf curline;
41   /* See the documentation for cmark_parser_get_last_line_length() in cmark.h */
42   bufsize_t last_line_length;
43   /* FIXME: not sure about the difference with curline */
44   cmark_strbuf linebuf;
45   /* Options set by the user, see the Options section in cmark.h */
46   int options;
47   bool last_buffer_ended_with_cr;
48   cmark_llist *syntax_extensions;
49   cmark_llist *inline_syntax_extensions;
50   cmark_ispunct_func backslash_ispunct;
51 };
52 
53 #ifdef __cplusplus
54 }
55 #endif
56 
57 #endif
58