1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-04 08:17:17 -05:00

Improve error detection

This commit is contained in:
Jonas Fonseca 2006-01-07 23:40:21 +01:00 committed by Jonas Fonseca
parent 8f2d4860bc
commit 534a16fff1
2 changed files with 12 additions and 5 deletions

View File

@ -133,16 +133,25 @@ static struct dom_scanner_token *
set_sgml_error(struct dom_scanner *scanner, unsigned char *end)
{
struct dom_scanner_token *token = scanner->current;
struct dom_scanner_token *next;
assert(!scanner->found_error);
scanner->found_error = 1;
if (scanner->current >= scanner->table + DOM_SCANNER_TOKENS) {
scanner->found_error = 1;
next = NULL;
} else {
scanner->current++;
next = scanner->current;
copy_struct(next, token);
}
token->type = SGML_TOKEN_ERROR;
token->lineno = scanner->lineno;
set_dom_string(&token->string, scanner->position, end - scanner->position);
return scanner->found_error ? NULL : scanner->current;
return next;
}
@ -609,7 +618,7 @@ scan_sgml_element_token(struct dom_scanner *scanner, struct dom_scanner_token *t
return;
}
if (check_sgml_error(scanner)) {
if (check_sgml_error(scanner) && string == scanner->end) {
unsigned char *end = string;
switch (type) {

View File

@ -143,7 +143,6 @@ test_output_error \
'
error on line 1: attr...'
cat >/dev/null <<FIXME
test_output_error \
'Check incomplete attribute value.' \
'<element attr=...' \
@ -161,6 +160,5 @@ test_output_error \
"<element attr='..." \
"
error on line 1: '..."
FIXME
test_done