ELinks 0.16.1.1
scanner.c File Reference
#include <stdio.h>
#include <string.h>
#include "elinks.h"
#include "dom/scanner.h"
#include "dom/sgml/scanner.h"
#include "dom/string.h"
#include "util/error.h"
Include dependency graph for scanner.c:

Macros

#define SGML_STRING_MAP(str, type, family)
#define check_sgml_table(c, bit)
#define scan_sgml(scanner, s, bit)
#define is_sgml_ident(c)
#define is_sgml_entity(c)
#define is_sgml_space(c)
#define is_sgml_newline(c)
#define is_sgml_text(c)
#define is_sgml_token_start(c)
#define is_sgml_attribute(c)
#define check_sgml_incomplete(scanner, string)
#define foreach_sgml_cdata(scanner, str)
#define scan_sgml_attribute(scanner, str)

Enumerations

enum  sgml_char_group {
  SGML_CHAR_ENTITY = (1 << 1) , SGML_CHAR_IDENT = (1 << 2) , SGML_CHAR_NEWLINE = (1 << 3) , SGML_CHAR_WHITESPACE = (1 << 4) ,
  SGML_CHAR_NOT_TEXT = (1 << 5) , SGML_CHAR_NOT_ATTRIBUTE = (1 << 6)
}

Functions

static struct dom_scanner_tokenscan_sgml_tokens (struct dom_scanner *scanner)
static void skip_sgml_space (struct dom_scanner *scanner, char **string)
static void set_sgml_incomplete (struct dom_scanner *scanner, struct dom_scanner_token *token)
static int check_sgml_error (struct dom_scanner *scanner)
static char * get_sgml_error_end (struct dom_scanner *scanner, unsigned int type, char *end)
static struct dom_scanner_tokenset_sgml_error (struct dom_scanner *scanner, char *end)
static void scan_sgml_text_token (struct dom_scanner *scanner, struct dom_scanner_token *token)
static int check_sgml_precedence (int type, int skipto)
static char * skip_sgml_chars (struct dom_scanner *scanner, char *string, unsigned char skipto)
static char * skip_sgml (struct dom_scanner *scanner, char **string, unsigned char skipto, int check_quoting)
static int skip_sgml_comment (struct dom_scanner *scanner, char **string, int *possibly_incomplete)
static int skip_sgml_cdata_section (struct dom_scanner *scanner, char **string, int *possibly_incomplete)
static void scan_sgml_element_token (struct dom_scanner *scanner, struct dom_scanner_token *token)
static void scan_sgml_proc_inst_token (struct dom_scanner *scanner, struct dom_scanner_token *token)

Variables

static struct dom_scan_table_info sgml_scan_table_info []
static struct dom_scanner_string_mapping sgml_string_mappings []
struct dom_scanner_info sgml_scanner_info

Macro Definition Documentation

◆ check_sgml_incomplete

#define check_sgml_incomplete ( scanner,
string )
Value:
((scanner)->check_complete \
&& (scanner)->incomplete \
&& (string) == (scanner)->end)
The struct scanner describes the current state of the scanner.
Definition scanner.h:107
Definition string.h:155

◆ check_sgml_table

#define check_sgml_table ( c,
bit )
Value:
(sgml_scanner_info.scan_table[(unsigned char)(c)] & (bit))
struct dom_scanner_info sgml_scanner_info
Definition scanner.c:64

◆ foreach_sgml_cdata

#define foreach_sgml_cdata ( scanner,
str )
Value:
for (; ((str) < (scanner)->end && *(str) != '<' && *(str) != '&'); (str)++)

◆ is_sgml_attribute

#define is_sgml_attribute ( c)
Value:
@ SGML_CHAR_NOT_ATTRIBUTE
Definition scanner.c:26
@ SGML_CHAR_WHITESPACE
Definition scanner.c:24
#define check_sgml_table(c, bit)
Definition scanner.c:70

◆ is_sgml_entity

#define is_sgml_entity ( c)
Value:
@ SGML_CHAR_ENTITY
Definition scanner.c:21

◆ is_sgml_ident

#define is_sgml_ident ( c)
Value:
@ SGML_CHAR_IDENT
Definition scanner.c:22

◆ is_sgml_newline

#define is_sgml_newline ( c)
Value:
@ SGML_CHAR_NEWLINE
Definition scanner.c:23

◆ is_sgml_space

#define is_sgml_space ( c)

◆ is_sgml_text

#define is_sgml_text ( c)
Value:
@ SGML_CHAR_NOT_TEXT
Definition scanner.c:25

◆ is_sgml_token_start

#define is_sgml_token_start ( c)
Value:
check_sgml_table(c, SGML_CHAR_TOKEN_START)

◆ scan_sgml

#define scan_sgml ( scanner,
s,
bit )
Value:
while ((s) < (scanner)->end && check_sgml_table(*(s), bit)) (s)++;
const char * s
Definition general.c:826

◆ scan_sgml_attribute

#define scan_sgml_attribute ( scanner,
str )
Value:
while ((str) < (scanner)->end && is_sgml_attribute(*(str))) \
(str)++;
#define is_sgml_attribute(c)
Definition scanner.c:81

◆ SGML_STRING_MAP

#define SGML_STRING_MAP ( str,
type,
family )
Value:
{ STATIC_DOM_STRING(str), SGML_TOKEN_##type, SGML_TOKEN_##family }
#define STATIC_DOM_STRING(strvalue)
Definition string.h:25
const char * type
Definition download.c:1812

Enumeration Type Documentation

◆ sgml_char_group

Enumerator
SGML_CHAR_ENTITY 
SGML_CHAR_IDENT 
SGML_CHAR_NEWLINE 
SGML_CHAR_WHITESPACE 
SGML_CHAR_NOT_TEXT 
SGML_CHAR_NOT_ATTRIBUTE 

Function Documentation

◆ check_sgml_error()

int check_sgml_error ( struct dom_scanner * scanner)
inlinestatic

◆ check_sgml_precedence()

int check_sgml_precedence ( int type,
int skipto )
inlinestatic

◆ get_sgml_error_end()

char * get_sgml_error_end ( struct dom_scanner * scanner,
unsigned int type,
char * end )
static

◆ scan_sgml_element_token()

void scan_sgml_element_token ( struct dom_scanner * scanner,
struct dom_scanner_token * token )
inlinestatic

◆ scan_sgml_proc_inst_token()

void scan_sgml_proc_inst_token ( struct dom_scanner * scanner,
struct dom_scanner_token * token )
inlinestatic

◆ scan_sgml_text_token()

void scan_sgml_text_token ( struct dom_scanner * scanner,
struct dom_scanner_token * token )
inlinestatic

◆ scan_sgml_tokens()

struct dom_scanner_token * scan_sgml_tokens ( struct dom_scanner * scanner)
static

◆ set_sgml_error()

struct dom_scanner_token * set_sgml_error ( struct dom_scanner * scanner,
char * end )
static

◆ set_sgml_incomplete()

void set_sgml_incomplete ( struct dom_scanner * scanner,
struct dom_scanner_token * token )
static

◆ skip_sgml()

char * skip_sgml ( struct dom_scanner * scanner,
char ** string,
unsigned char skipto,
int check_quoting )
inlinestatic

◆ skip_sgml_cdata_section()

int skip_sgml_cdata_section ( struct dom_scanner * scanner,
char ** string,
int * possibly_incomplete )
inlinestatic

◆ skip_sgml_chars()

char * skip_sgml_chars ( struct dom_scanner * scanner,
char * string,
unsigned char skipto )
inlinestatic

◆ skip_sgml_comment()

int skip_sgml_comment ( struct dom_scanner * scanner,
char ** string,
int * possibly_incomplete )
inlinestatic

◆ skip_sgml_space()

void skip_sgml_space ( struct dom_scanner * scanner,
char ** string )
inlinestatic

Variable Documentation

◆ sgml_scan_table_info

struct dom_scan_table_info sgml_scan_table_info[]
static

◆ sgml_scanner_info

struct dom_scanner_info sgml_scanner_info
Initial value:
= {
}
static struct dom_scan_table_info sgml_scan_table_info[]
Definition scanner.c:29
static struct dom_scanner_token * scan_sgml_tokens(struct dom_scanner *scanner)
Definition scanner.c:783
static struct dom_scanner_string_mapping sgml_string_mappings[]
Definition scanner.c:49

◆ sgml_string_mappings

struct dom_scanner_string_mapping sgml_string_mappings[]
static
Initial value:
= {
SGML_STRING_MAP("--", NOTATION_COMMENT, NOTATION),
SGML_STRING_MAP("ATTLIST", NOTATION_ATTLIST, NOTATION),
SGML_STRING_MAP("DOCTYPE", NOTATION_DOCTYPE, NOTATION),
SGML_STRING_MAP("ELEMENT", NOTATION_ELEMENT, NOTATION),
SGML_STRING_MAP("ENTITY", NOTATION_ENTITY, NOTATION),
SGML_STRING_MAP("xml", PROCESS_XML, PROCESS),
SGML_STRING_MAP("xml-stylesheet", PROCESS_XML_STYLESHEET, PROCESS),
}
#define DOM_STRING_MAP_END
Definition scanner.h:75
#define SGML_STRING_MAP(str, type, family)
Definition scanner.c:46