LLDB mainline
SwiftTreeSitterHighlighter.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
15LLDB_PLUGIN_DEFINE_ADV(SwiftTreeSitterHighlighter, HighlighterTreeSitterSwift)
16
17extern "C" {
18const TSLanguage *tree_sitter_swift();
19}
20
21const TSLanguage *SwiftTreeSitterHighlighter::GetLanguage() const {
22 return tree_sitter_swift();
23}
24
26 return highlight_query;
27}
28
31 if (language == lldb::eLanguageTypeSwift)
32 return new SwiftTreeSitterHighlighter();
33 return nullptr;
34}
35
40
#define LLDB_PLUGIN_DEFINE_ADV(ClassName, PluginName)
const TSLanguage * tree_sitter_swift()
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)
llvm::StringRef GetHighlightQuery() const override
Returns the tree-sitter highlight query for this language.
static Highlighter * CreateInstance(lldb::LanguageType 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.
@ eLanguageTypeSwift
Swift.