From 0a4bfb63a6ecea74ad6c24dada27186fb8bdfc82 Mon Sep 17 00:00:00 2001 From: Ika Date: Fri, 4 Oct 2019 20:44:44 +0800 Subject: [PATCH 1/2] test: add tests --- corpus/main.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/corpus/main.txt b/corpus/main.txt index fc78cb5..35eba08 100644 --- a/corpus/main.txt +++ b/corpus/main.txt @@ -145,6 +145,9 @@ Raw text elements + + --- (fragment @@ -157,7 +160,10 @@ Raw text elements (start_tag (tag_name)) (raw_text) (end_tag (tag_name))) - (text)) + (text) + (ERROR + (start_tag (tag_name)) + (raw_text))) ================================== All-caps doctype From 15c9cdb62f49c43dad6e6a05085e8ef2628ddc49 Mon Sep 17 00:00:00 2001 From: Ika Date: Fri, 4 Oct 2019 20:48:11 +0800 Subject: [PATCH 2/2] fix: raw text end tags should be case insensitive --- corpus/main.txt | 6 ++++-- src/scanner.cc | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/corpus/main.txt b/corpus/main.txt index 35eba08..02232f3 100644 --- a/corpus/main.txt +++ b/corpus/main.txt @@ -161,9 +161,11 @@ Raw text elements (raw_text) (end_tag (tag_name))) (text) - (ERROR + (script_element (start_tag (tag_name)) - (raw_text))) + (raw_text) + (end_tag (tag_name))) + (text)) ================================== All-caps doctype diff --git a/src/scanner.cc b/src/scanner.cc index bb2f7ec..515f86e 100644 --- a/src/scanner.cc +++ b/src/scanner.cc @@ -123,12 +123,12 @@ struct Scanner { lexer->mark_end(lexer); const string &end_delimiter = tags.back().type == SCRIPT - ? "lookahead) { - if (lexer->lookahead == end_delimiter[delimiter_index]) { + if (towupper(lexer->lookahead) == end_delimiter[delimiter_index]) { delimiter_index++; if (delimiter_index == end_delimiter.size()) break; lexer->advance(lexer, false);