1 #ifndef LIBINJECTION_HTML5
2 #define LIBINJECTION_HTML5
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 /* pull in size_t */
9 
10 #include <stddef.h>
11 
12 enum html5_type {
13     DATA_TEXT
14     , TAG_NAME_OPEN
15     , TAG_NAME_CLOSE
16     , TAG_NAME_SELFCLOSE
17     , TAG_DATA
18     , TAG_CLOSE
19     , ATTR_NAME
20     , ATTR_VALUE
21     , TAG_COMMENT
22     , DOCTYPE
23 };
24 
25 enum html5_flags {
26   DATA_STATE
27   , VALUE_NO_QUOTE
28   , VALUE_SINGLE_QUOTE
29   , VALUE_DOUBLE_QUOTE
30   , VALUE_BACK_QUOTE
31 };
32 
33 struct h5_state;
34 typedef int (*ptr_html5_state)(struct h5_state*);
35 
36 typedef struct h5_state {
37     const char* s;
38     size_t len;
39     size_t pos;
40     int is_close;
41     ptr_html5_state state;
42     const char* token_start;
43     size_t token_len;
44     enum html5_type token_type;
45 } h5_state_t;
46 
47 
48 void libinjection_h5_init(h5_state_t* hs, const char* s, size_t len, enum html5_flags);
49 int libinjection_h5_next(h5_state_t* hs);
50 
51 #ifdef __cplusplus
52 }
53 #endif
54 #endif
55