1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:07:44 +00:00

LibCMake+LibSyntax: Add a CMakeCache.txt syntax highlighter

This commit is contained in:
Sam Atkins 2023-03-07 20:51:15 +00:00 committed by Linus Groh
parent bb07d678ac
commit 676d75603b
5 changed files with 125 additions and 0 deletions

View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibSyntax/Highlighter.h>
namespace CMake::Cache {
class SyntaxHighlighter final : public Syntax::Highlighter {
public:
SyntaxHighlighter() = default;
virtual ~SyntaxHighlighter() override = default;
virtual bool is_identifier(u64) const override;
virtual Syntax::Language language() const override { return Syntax::Language::CMakeCache; }
virtual Optional<StringView> comment_prefix() const override { return "#"sv; }
virtual Optional<StringView> comment_suffix() const override { return {}; }
virtual void rehighlight(Palette const&) override;
protected:
virtual Vector<MatchingTokenPair> matching_token_pairs_impl() const override;
virtual bool token_types_equal(u64, u64) const override;
};
}