ELinks 0.18.0
|
Data Structures | |
struct | dom_scanner_token |
DOM scanner token. More... | |
struct | dom_scan_table_info |
struct | dom_scanner_string_mapping |
struct | dom_scanner_info |
DOM scanner info. More... | |
struct | dom_scanner |
DOM scanner. More... | |
Macros | |
#define | skip_dom_scanner_token_char(token) do { (token)->string.string++; (token)->string.length--; } while (0) |
Skip the first charector of a token. | |
#define | dom_scanner_token_contains(token, str) |
Compare the token string to a "static" string. | |
#define | DOM_SCAN_TABLE_SIZE 256 |
#define | DOM_SCAN_TABLE_INFO(type, data1, data2, bits) { (type), INIT_DOM_STRING((data1), (data2)), (bits) } |
#define | DOM_SCAN_TABLE_RANGE(from, to, bits) DOM_SCAN_TABLE_INFO(DOM_SCAN_RANGE, from, to, bits) |
#define | DOM_SCAN_TABLE_STRING(str, bits) DOM_SCAN_TABLE_INFO(DOM_SCAN_STRING, str, sizeof(str) - 1, bits) |
#define | DOM_SCAN_TABLE_END DOM_SCAN_TABLE_INFO(DOM_SCAN_END, NULL, 0, 0) |
#define | DOM_STRING_MAP(str, type, family) { STATIC_DOM_STRING(str), (type), (family) } |
#define | DOM_STRING_MAP_END { INIT_DOM_STRING(NULL, 0), 0, 0 } |
#define | DOM_SCANNER_TOKENS 10 |
The number of tokens in the scanners token table. | |
#define | dom_scanner_has_tokens(scanner) ((scanner)->tokens > 0 && (scanner)->current < (scanner)->table + (scanner)->tokens) |
Check if there are more tokens. | |
#define | check_dom_scanner(scanner) |
#define | check_next_dom_scanner_token(scanner, token_type) |
Check the type of the next token. | |
#define | skip_dom_scanner_token(scanner) get_next_dom_scanner_token(scanner) |
Skip the current token. | |
Enumerations | |
enum | dom_scan_type { DOM_SCAN_RANGE , DOM_SCAN_STRING , DOM_SCAN_END } |
Functions | |
void | init_dom_scanner (struct dom_scanner *scanner, struct dom_scanner_info *scanner_info, struct dom_string *string, int state, int count_lines, int complete, int check_complete, int detect_error) |
Initializes a DOM scanner. | |
static struct dom_scanner_token * | get_dom_scanner_token (struct dom_scanner *scanner) |
Get the current token. | |
static struct dom_scanner_token * | get_next_dom_scanner_token (struct dom_scanner *scanner) |
Get the next token. | |
struct dom_scanner_token * | skip_dom_scanner_tokens (struct dom_scanner *scanner, int skipto, int precedence) |
Conditionally skip tokens. | |
int | map_dom_scanner_string (struct dom_scanner *scanner, char *ident, char *end, int base_type) |
Map a string to internal ID. | |
static struct dom_scanner_token * | begin_dom_token_scanning (struct dom_scanner *scanner) |
static struct dom_scanner_token * | end_dom_token_scanning (struct dom_scanner *scanner, struct dom_scanner_token *end) |
#define check_dom_scanner | ( | scanner | ) |
#define check_next_dom_scanner_token | ( | scanner, | |
token_type ) |
#define DOM_SCAN_TABLE_END DOM_SCAN_TABLE_INFO(DOM_SCAN_END, NULL, 0, 0) |
#define DOM_SCAN_TABLE_INFO | ( | type, | |
data1, | |||
data2, | |||
bits ) { (type), INIT_DOM_STRING((data1), (data2)), (bits) } |
#define DOM_SCAN_TABLE_RANGE | ( | from, | |
to, | |||
bits ) DOM_SCAN_TABLE_INFO(DOM_SCAN_RANGE, from, to, bits) |
#define DOM_SCAN_TABLE_SIZE 256 |
#define DOM_SCAN_TABLE_STRING | ( | str, | |
bits ) DOM_SCAN_TABLE_INFO(DOM_SCAN_STRING, str, sizeof(str) - 1, bits) |
#define dom_scanner_has_tokens | ( | scanner | ) | ((scanner)->tokens > 0 && (scanner)->current < (scanner)->table + (scanner)->tokens) |
Check if there are more tokens.
#define dom_scanner_token_contains | ( | token, | |
str ) |
Compare the token string to a "static" string.
#define DOM_SCANNER_TOKENS 10 |
The number of tokens in the scanners token table.
At best it should be big enough to contain properties with space separated values and function calls with up to 3 variables like rgb(). At worst it should be no less than 2 in order to be able to peek at the next token in the scanner.
#define DOM_STRING_MAP | ( | str, | |
type, | |||
family ) { STATIC_DOM_STRING(str), (type), (family) } |
#define DOM_STRING_MAP_END { INIT_DOM_STRING(NULL, 0), 0, 0 } |
#define skip_dom_scanner_token | ( | scanner | ) | get_next_dom_scanner_token(scanner) |
Skip the current token.
#define skip_dom_scanner_token_char | ( | token | ) | do { (token)->string.string++; (token)->string.length--; } while (0) |
Skip the first charector of a token.
enum dom_scan_type |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Get the current token.
|
inlinestatic |
Get the next token.
Getting the next token might cause a rescan so any token pointers that has been stored in a local variable might not be valid after the call.
void init_dom_scanner | ( | struct dom_scanner * | scanner, |
struct dom_scanner_info * | scanner_info, | ||
struct dom_string * | string, | ||
int | state, | ||
int | count_lines, | ||
int | complete, | ||
int | check_complete, | ||
int | detect_error ) |
Initializes a DOM scanner.
See struct dom_scanner for a description of the int
flags.
int map_dom_scanner_string | ( | struct dom_scanner * | scanner, |
char * | ident, | ||
char * | end, | ||
int | base_type ) |
Map a string to internal ID.
Looks up the string from ident to end to in the scanners string mapping table.
struct dom_scanner_token * skip_dom_scanner_tokens | ( | struct dom_scanner * | scanner, |
int | skipto, | ||
int | precedence ) |
Conditionally skip tokens.
Removes tokens from the scanner until it meets a token of the given type. This token will then also be skipped.