Go to the documentation of this file.
9 #ifndef LLDB_CORE_HIGHLIGHTER_H
10 #define LLDB_CORE_HIGHLIGHTER_H
17 #include "llvm/ADT/StringRef.h"
34 ColorStyle(llvm::StringRef prefix, llvm::StringRef suffix) {
46 void Set(llvm::StringRef prefix, llvm::StringRef suffix);
98 virtual llvm::StringRef
GetName()
const = 0;
115 llvm::Optional<size_t> cursor_pos,
116 llvm::StringRef previous_lines,
Stream &s)
const = 0;
120 llvm::Optional<size_t> cursor_pos,
121 llvm::StringRef previous_lines =
"")
const;
128 llvm::StringRef
GetName()
const override {
return "none"; }
131 llvm::Optional<size_t> cursor_pos,
132 llvm::StringRef previous_lines,
Stream &s)
const override;
150 llvm::StringRef path)
const;
156 #endif // LLDB_CORE_HIGHLIGHTER_H
static HighlightStyle MakeVimStyle()
Returns a HighlightStyle that is based on vim's default highlight style.
void Set(llvm::StringRef prefix, llvm::StringRef suffix)
Sets the prefix and suffix strings.
const Highlighter & getHighlighterFor(lldb::LanguageType language_type, llvm::StringRef path) const
Queries all known highlighter for one that can highlight some source code.
const Highlighter & getDefaultHighlighter() const
LanguageType
Programming language type.
A default highlighter that only highlights the user cursor, but doesn't do any other highlighting.
ColorStyle selected
The style for the token which is below the cursor of the user.
ColorStyle square_brackets
Matches '[' or ']'.
ColorStyle scalar_literal
Matches scalar value literals like '42' or '0.1'.
ColorStyle braces
Matches '{' or '}'.
DefaultHighlighter m_default
Annotates source code with color attributes.
Manages the available highlighters.
ColorStyle keyword
Matches all reserved keywords in the language.
ColorStyle colon
Matches one colon: ':'.
ColorStyle comment
Matches any comments in the language.
ColorStyle parentheses
Matches '(' or ')'.
string(SUBSTRING ${p} 10 -1 pStripped) if($
ColorStyle string_literal
Matches any string or character literals in the language: "foo" or 'f'.
llvm::StringRef GetName() const override
Returns a human readable name for the selected highlighter.
ColorStyle(llvm::StringRef prefix, llvm::StringRef suffix)
ColorStyle identifier
Matches identifiers to variable or functions.
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.
Represents style that the highlighter should apply to the given source code.
virtual llvm::StringRef GetName() const =0
Returns a human readable name for the selected highlighter.
const Highlighter & operator=(const Highlighter &)=delete
A class that represents a running process on the host machine.
A pair of strings that should be placed around a certain token.
virtual ~Highlighter()=default
ColorStyle pp_directive
Matches directives to a preprocessor (if the language has any).
ColorStyle semicolons
Matches any semicolon: ';'.
ColorStyle comma
Matches commas: ','.
void Apply(Stream &s, llvm::StringRef value) const
Applies this style to the given value.
ColorStyle operators
Matches operators like '+', '-', '', '&', '='.
virtual void Highlight(const HighlightStyle &options, llvm::StringRef line, llvm::Optional< size_t > cursor_pos, llvm::StringRef previous_lines, Stream &s) const =0
Highlights the given line.