1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:07:35 +00:00

LibWeb: Add a super basic HTML syntax highlighter

This can currently highlight tag names and attribute names/values.
This commit is contained in:
Ali Mohammad Pur 2021-05-20 23:15:33 +04:30 committed by Andreas Kling
parent aa7939bc6c
commit 97a230e4ef
6 changed files with 194 additions and 4 deletions

View file

@ -0,0 +1,32 @@
/*
* Copyright (c) 2021, Ali Mohammad Pur <mpfard@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibSyntax/Highlighter.h>
namespace Web::HTML {
class SyntaxHighlighter : public Syntax::Highlighter {
public:
SyntaxHighlighter() = default;
virtual ~SyntaxHighlighter() override = default;
virtual bool is_identifier(void*) const override;
virtual bool is_navigatable(void*) const override;
virtual Syntax::Language language() const override { return Syntax::Language::HTML; }
virtual void rehighlight(const Palette&) override;
protected:
virtual Vector<MatchingTokenPair> matching_token_pairs() const override;
virtual bool token_types_equal(void*, void*) const override;
size_t m_line { 1 };
size_t m_column { 0 };
};
}