mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:47:36 +00:00
LibCMake+LibSyntax: Add a CMake syntax highlighter
This commit is contained in:
parent
3d8cc2257f
commit
9f9ea8ccb5
5 changed files with 148 additions and 0 deletions
30
Userland/Libraries/LibCMake/SyntaxHighlighter.h
Normal file
30
Userland/Libraries/LibCMake/SyntaxHighlighter.h
Normal 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 {
|
||||
|
||||
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::CMake; }
|
||||
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;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue