summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/Parser
diff options
context:
space:
mode:
authorLuke <luke.wilde@live.co.uk>2020-06-12 23:43:06 +0100
committerAndreas Kling <kling@serenityos.org>2020-06-14 13:47:19 +0200
commita1838f676eccdfc2efd67d5fc425628b5ab1c4c7 (patch)
treedbdc11d5a2bb92d5ea3418981102f6ac39ac3077 /Libraries/LibWeb/Parser
parent821312729a5b8c811d5f8a104532263490c10367 (diff)
downloadserenity-a1838f676eccdfc2efd67d5fc425628b5ab1c4c7.zip
LibWeb: Implement all CDATA tokenizer states
Even though we haven't implemented any switches to these states yet, we may as well have them ready for when we do implement the switches.
Diffstat (limited to 'Libraries/LibWeb/Parser')
-rw-r--r--Libraries/LibWeb/Parser/HTMLTokenizer.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/Libraries/LibWeb/Parser/HTMLTokenizer.cpp b/Libraries/LibWeb/Parser/HTMLTokenizer.cpp
index 1f7322e0e7..6cb52a79fe 100644
--- a/Libraries/LibWeb/Parser/HTMLTokenizer.cpp
+++ b/Libraries/LibWeb/Parser/HTMLTokenizer.cpp
@@ -2436,6 +2436,56 @@ _StartOfFunction:
}
END_STATE
+ BEGIN_STATE(CDATASection)
+ {
+ ON(']')
+ {
+ SWITCH_TO(CDATASectionBracket);
+ }
+ ON_EOF
+ {
+ PARSE_ERROR();
+ EMIT_EOF;
+ }
+ ANYTHING_ELSE
+ {
+ EMIT_CURRENT_CHARACTER;
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(CDATASectionBracket)
+ {
+ ON(']')
+ {
+ SWITCH_TO(CDATASectionEnd);
+ }
+ ANYTHING_ELSE
+ {
+ EMIT_CHARACTER_AND_RECONSUME_IN(']', CDATASection);
+ }
+ }
+ END_STATE
+
+ BEGIN_STATE(CDATASectionEnd)
+ {
+ ON(']')
+ {
+ EMIT_CHARACTER(']');
+ }
+ ON('>')
+ {
+ SWITCH_TO(Data);
+ }
+ ANYTHING_ELSE
+ {
+ m_queued_tokens.enqueue(HTMLToken::make_character(']'));
+ m_queued_tokens.enqueue(HTMLToken::make_character(']'));
+ RECONSUME_IN(CDATASection);
+ }
+ }
+ END_STATE
+
default:
TODO();
}