LLDB mainline
RustTreeSitterHighlighter.cpp
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10#include "HighlightQuery.h"
12
13using namespace lldb_private;
14
15extern "C" {
16const TSLanguage *tree_sitter_rust();
17}
18
19LLDB_PLUGIN_DEFINE_ADV(RustTreeSitterHighlighter, HighlighterTreeSitterRust)
20
21const TSLanguage *RustTreeSitterHighlighter::GetLanguage() const {
22 return tree_sitter_rust();
23}
24
26 return highlight_query;
27}
28
31 if (language == lldb::eLanguageTypeRust)
32 return new RustTreeSitterHighlighter();
33 return nullptr;
34}
35
40
#define LLDB_PLUGIN_DEFINE_ADV(ClassName, PluginName)
const TSLanguage * tree_sitter_rust()
Annotates source code with color attributes.
Definition Highlighter.h:96
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static bool UnregisterPlugin(ABICreateInstance create_callback)
static Highlighter * CreateInstance(lldb::LanguageType language)
llvm::StringRef GetHighlightQuery() const override
Returns the tree-sitter highlight query for this language.
const TSLanguage * GetLanguage() const override
Returns the tree-sitter language for this highlighter.
A class that represents a running process on the host machine.
LanguageType
Programming language type.
@ eLanguageTypeRust
Rust.