mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
Fix parsing of '<a< b>' where the scanner didn't rewind to the proper place
Add test for this tag soup combo.
This commit is contained in:
parent
e5e06764c4
commit
d92a074e40
@ -449,13 +449,13 @@ scan_sgml_element_token(struct dom_scanner *scanner, struct dom_scanner_token *t
|
|||||||
if (scanner->state == SGML_STATE_ELEMENT) {
|
if (scanner->state == SGML_STATE_ELEMENT) {
|
||||||
/* Already inside an element so insert a tag end token
|
/* Already inside an element so insert a tag end token
|
||||||
* and continue scanning in next iteration. */
|
* and continue scanning in next iteration. */
|
||||||
string--;
|
|
||||||
real_length = 0;
|
|
||||||
type = SGML_TOKEN_TAG_END;
|
type = SGML_TOKEN_TAG_END;
|
||||||
scanner_state = SGML_STATE_TEXT;
|
scanner_state = SGML_STATE_TEXT;
|
||||||
|
|
||||||
/* We are creating a 'virtual' that has no source. */
|
/* We are creating a 'virtual' that has no source. */
|
||||||
possibly_incomplete = 0;
|
possibly_incomplete = 0;
|
||||||
|
string = token->string.string;
|
||||||
|
real_length = 0;
|
||||||
|
|
||||||
} else if (is_sgml_ident(*string)) {
|
} else if (is_sgml_ident(*string)) {
|
||||||
token->string.string = string;
|
token->string.string = string;
|
||||||
|
@ -56,7 +56,7 @@ element: root
|
|||||||
#text: a'
|
#text: a'
|
||||||
|
|
||||||
test_output_equals \
|
test_output_equals \
|
||||||
'Parse tag soup elements.' \
|
'Parse tag soup elements. (I)' \
|
||||||
'<parent attr="value" <child:1></><child:2</>a</parent>' \
|
'<parent attr="value" <child:1></><child:2</>a</parent>' \
|
||||||
'
|
'
|
||||||
element: parent
|
element: parent
|
||||||
@ -65,6 +65,14 @@ element: parent
|
|||||||
element: child:2
|
element: child:2
|
||||||
#text: a'
|
#text: a'
|
||||||
|
|
||||||
|
test_output_equals \
|
||||||
|
'Parse tag soup elements. (II)' \
|
||||||
|
'< a >< b < c / >< / >' \
|
||||||
|
'
|
||||||
|
element: a
|
||||||
|
element: b
|
||||||
|
element: c'
|
||||||
|
|
||||||
test_output_equals \
|
test_output_equals \
|
||||||
'Parse an enclosed comment.' \
|
'Parse an enclosed comment.' \
|
||||||
'<root><!-- Hello World! --></root>' \
|
'<root><!-- Hello World! --></root>' \
|
||||||
|
Loading…
Reference in New Issue
Block a user