LLDB  mainline
ClangHighlighter.h
Go to the documentation of this file.
1 //===-- ClangHighlighter.h --------------------------------------*- C++ -*-===//
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 
9 #ifndef liblldb_ClangHighlighter_h_
10 #define liblldb_ClangHighlighter_h_
11 
12 #include "lldb/Utility/Stream.h"
13 #include "llvm/ADT/StringSet.h"
14 
15 #include "lldb/Core/Highlighter.h"
16 
17 namespace lldb_private {
18 
19 class ClangHighlighter : public Highlighter {
20  llvm::StringSet<> keywords;
21 
22 public:
24  llvm::StringRef GetName() const override { return "clang"; }
25 
26  void Highlight(const HighlightStyle &options, llvm::StringRef line,
27  llvm::Optional<size_t> cursor_pos,
28  llvm::StringRef previous_lines, Stream &s) const override;
29 
30  /// Returns true if the given string represents a keywords in any Clang
31  /// supported language.
32  bool isKeyword(llvm::StringRef token) const;
33 };
34 
35 } // namespace lldb_private
36 
37 #endif // liblldb_ClangHighlighter_h_
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
bool isKeyword(llvm::StringRef token) const
Returns true if the given string represents a keywords in any Clang supported language.
llvm::StringRef GetName() const override
Returns a human readable name for the selected highlighter.
Annotates source code with color attributes.
Definition: Highlighter.h:92
Represents style that the highlighter should apply to the given source code.
Definition: Highlighter.h:23
void Highlight(const HighlightStyle &options, llvm::StringRef line, llvm::Optional< size_t > cursor_pos, llvm::StringRef previous_lines, Stream &s) const override
Highlights the given line.