diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2008-07-30 20:05:15 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2008-07-30 20:05:15 +0000 |
commit | a324baae03e4018c2c1aa8e4692505f8fcbe7172 (patch) | |
tree | 1c0ee3e41d2284347c87a12682f023d9c83416dc /src/parse/parse.h | |
parent | e697509c239a4dd22e4543aca5308b57b248e4f3 (diff) | |
download | libcss-a324baae03e4018c2c1aa8e4692505f8fcbe7172.tar.gz libcss-a324baae03e4018c2c1aa8e4692505f8fcbe7172.tar.bz2 |
Implement the first-stage parser.
Things missing:
1) Recovery after parse errors
2) Event emission (the locations of DEBUG_EVENTS are about right for this)
3) A second-stage parser
4) Any kind of testsuite
svn path=/trunk/libcss/; revision=4825
Diffstat (limited to 'src/parse/parse.h')
-rw-r--r-- | src/parse/parse.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/parse/parse.h b/src/parse/parse.h new file mode 100644 index 0000000..d4ae3c4 --- /dev/null +++ b/src/parse/parse.h @@ -0,0 +1,45 @@ +/* + * This file is part of LibCSS. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org> + */ + +#ifndef css_parse_parse_h_ +#define css_parse_parse_h_ + +#include <libcss/functypes.h> +#include <libcss/types.h> + +typedef struct css_parser css_parser; + +/** + * Parser option types + */ +typedef enum css_parser_opttype { + CSS_PARSER_QUIRKS, +} css_parser_opttype; + +/** + * Parser option parameters + */ +typedef union css_parser_optparams { + bool quirks; +} css_parser_optparams; + +css_parser *css_parser_create(css_stylesheet *sheet, const char *charset, + css_charset_source cs_source, css_alloc alloc, void *pw); +void css_parser_destroy(css_parser *parser); + +css_error css_parser_setopt(css_parser *parser, css_parser_opttype type, + css_parser_optparams *params); + +css_error css_parser_parse_chunk(css_parser *parser, const uint8_t *data, + size_t len); +css_error css_parser_completed(css_parser *parser); + +const char *css_parser_read_charset(css_parser *parser, + css_charset_source *source); + +#endif + |