ELinks 0.18.0
|
#include <stdlib.h>
#include <string.h>
#include "elinks.h"
#include "dom/node.h"
#include "dom/sgml/parser.h"
#include "dom/sgml/scanner.h"
#include "dom/sgml/sgml.h"
#include "dom/stack.h"
#include "dom/string.h"
#include "util/error.h"
#include "util/memory.h"
Data Structures | |
struct | sgml_parsing_state |
Macros | |
#define | get_sgml_parser(stack) ((stack)->contexts[0]->data) |
#define | get_sgml_parser_state(stack, state) get_dom_stack_state_data(stack->contexts[0], state) |
Functions | |
static struct dom_node * | add_sgml_document (struct sgml_parser *parser) |
static struct dom_node * | add_sgml_element (struct dom_stack *stack, struct dom_scanner_token *token) |
static struct dom_node * | add_sgml_attribute (struct dom_stack *stack, struct dom_scanner_token *token, struct dom_scanner_token *valtoken) |
static struct dom_node * | add_sgml_proc_instruction (struct dom_stack *stack, struct dom_scanner_token *target, struct dom_scanner_token *data) |
static struct dom_node * | add_sgml_node (struct dom_stack *stack, enum dom_node_type type, struct dom_scanner_token *token) |
static enum dom_code | call_sgml_error_function (struct dom_stack *stack, struct dom_scanner_token *token) |
static enum dom_code | check_sgml_incomplete (struct dom_scanner *scanner, struct dom_scanner_token *start, struct dom_scanner_token *token) |
static enum dom_code | parse_sgml_attributes (struct dom_stack *stack, struct dom_scanner *scanner) |
static enum dom_code | parse_sgml_plain (struct dom_stack *stack, struct dom_scanner *scanner) |
enum dom_code | parse_sgml (struct sgml_parser *parser, char *buf, size_t bufsize, int complete) |
Parse a chunk of SGML source. | |
enum dom_code | sgml_parsing_push (struct dom_stack *stack, struct dom_node *node, void *data) |
enum dom_code | sgml_parsing_pop (struct dom_stack *stack, struct dom_node *node, void *data) |
unsigned int | get_sgml_parser_line_number (struct sgml_parser *parser) |
Get the line position in the source. | |
struct sgml_parser * | init_sgml_parser (enum sgml_parser_type type, enum sgml_document_type doctype, struct dom_string *uri, unsigned int flags) |
Initialise an SGML parser. | |
void | done_sgml_parser (struct sgml_parser *parser) |
Release an SGML parser. | |
Variables | |
static struct dom_stack_context_info | sgml_parsing_context_info |
static struct dom_stack_context_info | sgml_parser_context_info |
#define get_sgml_parser | ( | stack | ) | ((stack)->contexts[0]->data) |
#define get_sgml_parser_state | ( | stack, | |
state ) get_dom_stack_state_data(stack->contexts[0], state) |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
static |
|
static |
void done_sgml_parser | ( | struct sgml_parser * | parser | ) |
Release an SGML parser.
Deallocates all resources, except the root node.
parser | The parser being released. |
unsigned int get_sgml_parser_line_number | ( | struct sgml_parser * | parser | ) |
Get the line position in the source.
parser | A parser created with init_sgml_parser. |
struct sgml_parser * init_sgml_parser | ( | enum sgml_parser_type | type, |
enum sgml_document_type | doctype, | ||
struct dom_string * | uri, | ||
unsigned int | flags ) |
Initialise an SGML parser.
Initialise an SGML parser with the given properties.
type | Stream or tree; one-time or persistant. |
doctype | The document type, this affects what sub type nodes are given. |
uri | The URI of the document root. |
flags | Flags controlling the behaviour of the parser. |
enum dom_code parse_sgml | ( | struct sgml_parser * | parser, |
char * | buf, | ||
size_t | bufsize, | ||
int | complete ) |
Parse a chunk of SGML source.
Parses the given buffer. For incremental rendering the last buffer can be signals through the complete
parameter.
parser | A parser created with init_sgml_parser. |
buf | A buffer containing the chunk to parse. |
bufsize | The size of the buffer given in the buf parameter. |
complete | Whether this is the last chunk to parse. |
|
inlinestatic |
|
static |
|
static |
|
static |