ELinks 0.16.1.1
|
The struct scanner describes the current state of the scanner. More...
#include <scanner.h>
Data Fields | |
const char * | string |
The very start of the scanned string, the position in the string where to scan next and the end of the string. | |
const char * | position |
const char * | end |
struct scanner_token * | current |
The current token and number of scanned tokens in the table. | |
int | tokens |
struct scanner_info * | info |
The 'meta' scanner information. | |
int | state |
Some state indicator only meaningful to the scanner internals. | |
struct scanner_token | table [SCANNER_TOKENS] |
The table contain already scanned tokens. |
Related Symbols | |
(Note that these are not member symbols.) | |
void | init_scanner (struct scanner *scanner, struct scanner_info *scanner_info, const char *string, const char *end) |
Initializes the scanner. | |
#define | scanner_has_tokens(scanner) |
#define | check_scanner(scanner) |
This macro checks if the current scanner state is valid. | |
int | map_scanner_string (struct scanner *scanner, const char *ident, const char *end, int base_type) |
Looks up the string from ident to end to in the scanners string mapping table. | |
Scanner table accessors and mutators | |
#define | check_next_scanner_token(scanner, token_type) |
Checks the type of the next token. | |
static struct scanner_token * | get_scanner_token (struct scanner *scanner) |
Access current and next token. | |
static struct scanner_token * | get_next_scanner_token (struct scanner *scanner) |
Do a scanning if we do not have also have access to next token. | |
#define | skip_scanner_token(scanner) |
This should just make the code more understandable . | |
struct scanner_token * | skip_scanner_tokens (struct scanner *scanner, int skipto, int precedence) |
Removes tokens from the scanner until it meets a token of the given type. |
The struct scanner describes the current state of the scanner.
|
Checks the type of the next token.
|
This macro checks if the current scanner state is valid.
Meaning if the scanners table is full the last token skipping or get_next_scanner_token() call made it possible to get the type of the next token.
|
Do a scanning if we do not have also have access to next token.
|
Access current and 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.
|
Initializes the scanner.
|
Looks up the string from ident to end to in the scanners string mapping table.
|
|
This should just make the code more understandable .
. hopefully
|
Removes tokens from the scanner until it meets a token of the given type.
This token will then also be skipped.
struct scanner_token* scanner::current |
The current token and number of scanned tokens in the table.
If the number of scanned tokens is less than SCANNER_TOKENS it is because there are no more tokens in the string.
const char * scanner::end |
struct scanner_info* scanner::info |
The 'meta' scanner information.
const char * scanner::position |
int scanner::state |
Some state indicator only meaningful to the scanner internals.
const char* scanner::string |
The very start of the scanned string, the position in the string where to scan next and the end of the string.
If position is NULL it means that no more tokens can be retrieved from the string.
struct scanner_token scanner::table[SCANNER_TOKENS] |
The table contain already scanned tokens.
It is maintained in order to optimize the scanning a bit and make it possible to look ahead at the next token. You should always use the accessors (defined below) for getting tokens from the scanner.
int scanner::tokens |