ELinks 0.18.0
scanner.h File Reference
#include "util/error.h"
#include "util/string.h"
Include dependency graph for scanner.h:
This graph shows which files directly or indirectly include this file:

Data Structures

struct  scanner_token
 The struct scanner_token describes one scanner state. More...
 
union  scan_table_data
 
struct  scan_table_info
 
struct  scanner_string_mapping
 
struct  scanner_info
 
struct  scanner
 The struct scanner describes the current state of the scanner. More...
 

Macros

#define scanner_token_strlcasecmp(token, str, len)    ((token) && !c_strlcasecmp((token)->string, (token)->length, str, len))
 Compare the string of token with str.
 
#define scanner_token_contains(token, str)    scanner_token_strlcasecmp(token, str, sizeof(str) - 1)
 Also compares the token string but using a "static" string.
 
#define SCAN_TABLE_SIZE   256
 
#define SCAN_TABLE_INFO(type, data1, data2, bits)    { (type), { { (data1), (data2) } }, (bits) }
 
#define SCAN_TABLE_RANGE(from, to, bits)   SCAN_TABLE_INFO(SCAN_RANGE, from, to, bits)
 
#define SCAN_TABLE_STRING(str, bits)   SCAN_TABLE_INFO(SCAN_STRING, str, sizeof(str) - 1, bits)
 
#define SCAN_TABLE_END   SCAN_TABLE_INFO(SCAN_END, 0, 0, 0)
 
#define 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().
 
Scanner table accessors and mutators

Enumerations

enum  scan_type { SCAN_RANGE , SCAN_STRING , SCAN_END }
 

Functions

static struct scanner_tokenbegin_token_scanning (struct scanner *scanner)
 
static struct scanner_tokenend_token_scanning (struct scanner *scanner, struct scanner_token *end)
 

Macro Definition Documentation

◆ SCAN_TABLE_END

#define SCAN_TABLE_END   SCAN_TABLE_INFO(SCAN_END, 0, 0, 0)

◆ SCAN_TABLE_INFO

#define SCAN_TABLE_INFO ( type,
data1,
data2,
bits )    { (type), { { (data1), (data2) } }, (bits) }

◆ SCAN_TABLE_RANGE

#define SCAN_TABLE_RANGE ( from,
to,
bits )   SCAN_TABLE_INFO(SCAN_RANGE, from, to, bits)

◆ SCAN_TABLE_SIZE

#define SCAN_TABLE_SIZE   256

◆ SCAN_TABLE_STRING

#define SCAN_TABLE_STRING ( str,
bits )   SCAN_TABLE_INFO(SCAN_STRING, str, sizeof(str) - 1, bits)

◆ scanner_token_contains

#define scanner_token_contains ( token,
str )    scanner_token_strlcasecmp(token, str, sizeof(str) - 1)

Also compares the token string but using a "static" string.

◆ scanner_token_strlcasecmp

#define scanner_token_strlcasecmp ( token,
str,
len )    ((token) && !c_strlcasecmp((token)->string, (token)->length, str, len))

Compare the string of token with str.

◆ SCANNER_TOKENS

#define 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.

Enumeration Type Documentation

◆ scan_type

enum scan_type
Enumerator
SCAN_RANGE 
SCAN_STRING 
SCAN_END 

Function Documentation

◆ begin_token_scanning()

static struct scanner_token * begin_token_scanning ( struct scanner * scanner)
inlinestatic

◆ end_token_scanning()

static struct scanner_token * end_token_scanning ( struct scanner * scanner,
struct scanner_token * end )
inlinestatic