From 45450c7edc99f7c2440a33ad9f3374949d8aaccc Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 23 May 2020 14:04:53 +0200 Subject: [PATCH] LibWeb: Make BEGIN_STATE and END_STATE include some {{{ and }}} This makes it a compile error to omit the END_STATE. Also add some more missing END_STATE's exposed by this (nice!) Thanks to @predmond for suggesting the multi-pair trick! :^) --- Libraries/LibWeb/Parser/HTMLTokenizer.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Libraries/LibWeb/Parser/HTMLTokenizer.cpp b/Libraries/LibWeb/Parser/HTMLTokenizer.cpp index 82c933ce86..eace42d309 100644 --- a/Libraries/LibWeb/Parser/HTMLTokenizer.cpp +++ b/Libraries/LibWeb/Parser/HTMLTokenizer.cpp @@ -66,11 +66,16 @@ #define BEGIN_STATE(state) \ state: \ - case State::state: + case State::state: { \ + { \ + { #define END_STATE \ ASSERT_NOT_REACHED(); \ - break; + break; \ + } \ + } \ + } namespace Web { @@ -494,6 +499,7 @@ void HTMLTokenizer::run() continue; } } + END_STATE BEGIN_STATE(CommentEnd) { @@ -562,6 +568,7 @@ void HTMLTokenizer::run() RECONSUME_IN(Comment); } } + END_STATE BEGIN_STATE(CommentLessThanSign) {