Hubbub $Id$
|
#include <assert.h>
#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include <parserutils/charset/utf8.h>
#include "utils/parserutilserror.h"
#include "utils/utils.h"
#include "hubbub/errors.h"
#include "tokeniser/entities.h"
#include "tokeniser/tokeniser.h"
Classes | |
struct | hubbub_tokeniser_context |
Context for tokeniser. More... | |
struct | hubbub_tokeniser |
Tokeniser data structure. More... | |
Macros | |
#define | state(x) case x: |
#define | START_BUF(str, cptr, length) |
Various macros for manipulating buffers. More... | |
#define | COLLECT(str, cptr, length) |
#define | COLLECT_MS(str, cptr, length) |
#define | DOCTYPE "DOCTYPE" |
#define | DOCTYPE_LEN (SLEN(DOCTYPE) - 1) |
#define | PUBLIC "PUBLIC" |
#define | PUBLIC_LEN (SLEN(PUBLIC) - 1) |
#define | SYSTEM "SYSTEM" |
#define | SYSTEM_LEN (SLEN(SYSTEM) - 1) |
#define | CDATA "[CDATA[" |
#define | CDATA_LEN (SLEN(CDATA) - 1) |
Typedefs | |
typedef enum hubbub_tokeniser_state | hubbub_tokeniser_state |
Tokeniser states. More... | |
typedef struct hubbub_tokeniser_context | hubbub_tokeniser_context |
Context for tokeniser. More... | |
Functions | |
hubbub_error | hubbub_tokeniser_create (parserutils_inputstream *input, hubbub_tokeniser **tokeniser) |
Create a hubbub tokeniser. More... | |
hubbub_error | hubbub_tokeniser_destroy (hubbub_tokeniser *tokeniser) |
Destroy a hubbub tokeniser. More... | |
hubbub_error | hubbub_tokeniser_setopt (hubbub_tokeniser *tokeniser, hubbub_tokeniser_opttype type, hubbub_tokeniser_optparams *params) |
Configure a hubbub tokeniser. More... | |
hubbub_error | hubbub_tokeniser_insert_chunk (hubbub_tokeniser *tokeniser, const uint8_t *data, size_t len) |
Insert a chunk of data into the input stream. More... | |
hubbub_error | hubbub_tokeniser_run (hubbub_tokeniser *tokeniser) |
Process remaining data in the input stream. More... | |
#define CDATA "[CDATA[" |
#define COLLECT | ( | str, | |
cptr, | |||
length | |||
) |
#define COLLECT_MS | ( | str, | |
cptr, | |||
length | |||
) |
#define DOCTYPE "DOCTYPE" |
#define PUBLIC "PUBLIC" |
#define START_BUF | ( | str, | |
cptr, | |||
length | |||
) |
Various macros for manipulating buffers.
make some of these inline functions (type-safety)
document them properly here
#define state | ( | x | ) | case x: |
#define SYSTEM "SYSTEM" |
typedef struct hubbub_tokeniser_context hubbub_tokeniser_context |
Context for tokeniser.
typedef enum hubbub_tokeniser_state hubbub_tokeniser_state |
Tokeniser states.
Tokeniser states.
hubbub_error hubbub_tokeniser_create | ( | parserutils_inputstream * | input, |
hubbub_tokeniser ** | tokeniser | ||
) |
Create a hubbub tokeniser.
input | Input stream instance |
tokeniser | Pointer to location to receive tokeniser instance |
hubbub_error hubbub_tokeniser_destroy | ( | hubbub_tokeniser * | tokeniser | ) |
Destroy a hubbub tokeniser.
tokeniser | The tokeniser instance to destroy |
hubbub_error hubbub_tokeniser_insert_chunk | ( | hubbub_tokeniser * | tokeniser, |
const uint8_t * | data, | ||
size_t | len | ||
) |
Insert a chunk of data into the input stream.
Inserts the given data into the input stream ready for parsing but does not cause any additional processing of the input.
tokeniser | Tokeniser instance |
data | Data to insert (UTF-8 encoded) |
len | Length, in bytes, of data |
hubbub_error hubbub_tokeniser_run | ( | hubbub_tokeniser * | tokeniser | ) |
Process remaining data in the input stream.
tokeniser | The tokeniser instance to invoke |
hubbub_error hubbub_tokeniser_setopt | ( | hubbub_tokeniser * | tokeniser, |
hubbub_tokeniser_opttype | type, | ||
hubbub_tokeniser_optparams * | params | ||
) |
Configure a hubbub tokeniser.
tokeniser | The tokeniser instance to configure |
type | The option type to set |
params | Option-specific parameters |