Built-in generic highlighter for C-like and scripting languages. More...
#include <Malena/Graphics/Text/CodeEditor.h>
Public Member Functions | |
| BasicSyntaxHighlighter (CodeLanguage lang=CodeLanguage::Cpp) | |
| CodeLanguage | language () const |
| void | setLanguage (CodeLanguage lang) |
| std::vector< SyntaxToken > | tokenize (const std::string &text) const override |
Public Attributes | |
| sf::Color | commentColor { 106, 153, 85 } |
| sf::Color | keywordColor { 197, 134, 192 } |
| sf::Color | numberColor { 181, 206, 168 } |
| sf::Color | stringColor { 206, 145, 120 } |
Built-in generic highlighter for C-like and scripting languages.
Recognizes line comments (// and, for Python, #), block comments, single/double-quoted strings, numbers, and a per-language keyword set. Colors are public and tweakable (defaults approximate a dark theme).
Definition at line 54 of file CodeEditor.h.
|
explicit |
|
inlinenodiscard |
Definition at line 60 of file CodeEditor.h.
| void ml::BasicSyntaxHighlighter::setLanguage | ( | CodeLanguage | lang | ) |
|
nodiscardoverridevirtual |
Return colored spans for text (only the spans that need coloring; everything else is left at the editor's default text color).
Implements ml::SyntaxHighlighter.
| sf::Color ml::BasicSyntaxHighlighter::commentColor { 106, 153, 85 } |
Definition at line 67 of file CodeEditor.h.
| sf::Color ml::BasicSyntaxHighlighter::keywordColor { 197, 134, 192 } |
Definition at line 65 of file CodeEditor.h.
| sf::Color ml::BasicSyntaxHighlighter::numberColor { 181, 206, 168 } |
Definition at line 68 of file CodeEditor.h.
| sf::Color ml::BasicSyntaxHighlighter::stringColor { 206, 145, 120 } |
Definition at line 66 of file CodeEditor.h.