9#ifndef LLDB_CORE_HIGHLIGHTER_H
10#define LLDB_CORE_HIGHLIGHTER_H
19#include "llvm/ADT/StringRef.h"
36 ColorStyle(llvm::StringRef prefix, llvm::StringRef suffix) {
48 void Set(llvm::StringRef prefix, llvm::StringRef suffix);
50 explicit operator bool()
const {
121 std::optional<size_t> cursor_pos,
122 llvm::StringRef previous_lines,
Stream &s)
const = 0;
126 std::optional<size_t> cursor_pos,
127 llvm::StringRef previous_lines =
"")
const;
144 llvm::StringRef path)
const;
148 mutable llvm::DenseMap<lldb::LanguageType, std::unique_ptr<Highlighter>>
158template <>
struct DenseMapInfo<
lldb::LanguageType> {
166 return static_cast<unsigned>(language_type);
A pair of strings that should be placed around a certain token.
ColorStyle(llvm::StringRef prefix, llvm::StringRef suffix)
void Set(llvm::StringRef prefix, llvm::StringRef suffix)
Sets the prefix and suffix strings.
void Apply(Stream &s, llvm::StringRef value) const
Applies this style to the given value.
Manages the available highlighters.
const Highlighter & getHighlighterFor(lldb::LanguageType language_type, llvm::StringRef path) const
Queries all known highlighter for one that can highlight some source code.
llvm::DenseMap< lldb::LanguageType, std::unique_ptr< Highlighter > > m_highlighters
Annotates source code with color attributes.
Highlighter(const Highlighter &)=delete
virtual void Highlight(const HighlightStyle &options, llvm::StringRef line, std::optional< size_t > cursor_pos, llvm::StringRef previous_lines, Stream &s) const =0
Highlights the given line.
const Highlighter & operator=(const Highlighter &)=delete
virtual llvm::StringRef GetName() const =0
Returns a human readable name for the selected highlighter.
virtual ~Highlighter()=default
PluginInterface()=default
A stream class that can stream formatted output to a file.
A class that represents a running process on the host machine.
LanguageType
Programming language type.
Represents style that the highlighter should apply to the given source code.
ColorStyle square_brackets
Matches '[' or ']'.
ColorStyle comment
Matches any comments in the language.
ColorStyle semicolons
Matches any semicolon: ';'.
static HighlightStyle MakeVimStyle()
Returns a HighlightStyle that is based on vim's default highlight style.
ColorStyle braces
Matches '{' or '}'.
ColorStyle scalar_literal
Matches scalar value literals like '42' or '0.1'.
ColorStyle comma
Matches commas: ','.
ColorStyle pp_directive
Matches directives to a preprocessor (if the language has any).
ColorStyle operators
Matches operators like '+', '-', '', '&', '='.
ColorStyle string_literal
Matches any string or character literals in the language: "foo" or 'f'.
ColorStyle keyword
Matches all reserved keywords in the language.
ColorStyle parentheses
Matches '(' or ')'.
ColorStyle selected
The style for the token which is below the cursor of the user.
ColorStyle identifier
Matches identifiers to variable or functions.
ColorStyle colon
Matches one colon: ':'.
static lldb::LanguageType getEmptyKey()
static lldb::LanguageType getTombstoneKey()
static unsigned getHashValue(lldb::LanguageType language_type)
static bool isEqual(lldb::LanguageType LHS, lldb::LanguageType RHS)