24 llvm::StringRef suffix) {
31 std::optional<size_t> cursor_pos,
32 llvm::StringRef previous_lines,
35 if (!cursor_pos || *cursor_pos >= line.size()) {
44 size_t column = *cursor_pos;
46 s << line.substr(0, column);
50 s << line.substr(column + 1U);
67 llvm::StringRef path)
const {
76 std::optional<size_t> cursor_pos,
77 llvm::StringRef previous_lines)
const {
79 Highlight(options, line, cursor_pos, previous_lines, s);
static HighlightStyle::ColorStyle GetColor(const char *c)
void Highlight(const HighlightStyle &options, llvm::StringRef line, std::optional< size_t > cursor_pos, llvm::StringRef previous_lines, Stream &s) const override
Highlights the given line.
A pair of strings that should be placed around a certain token.
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.
const Highlighter & getHighlighterFor(lldb::LanguageType language_type, llvm::StringRef path) const
Queries all known highlighter for one that can highlight some source code.
Annotates source code with color attributes.
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.
static Language * FindPlugin(lldb::LanguageType language)
virtual const Highlighter * GetHighlighter() const
void Flush() override
Flush the stream.
llvm::StringRef GetString() const
A stream class that can stream formatted output to a file.
std::string FormatAnsiTerminalCodes(llvm::StringRef format, bool do_color=true)
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 comment
Matches any comments in the language.
static HighlightStyle MakeVimStyle()
Returns a HighlightStyle that is based on vim's default highlight style.
ColorStyle scalar_literal
Matches scalar value literals like '42' or '0.1'.
ColorStyle keyword
Matches all reserved keywords in the language.
ColorStyle selected
The style for the token which is below the cursor of the user.