Fix syntax highlighting unicode support (#475)

* convert BasicParser to a template

* fix syntax hightlighting with unicode characters
This commit is contained in:
MihailRis
2025-02-22 01:01:20 +03:00
committed by GitHub
parent b61f594495
commit 8a8c1525fd
19 changed files with 644 additions and 509 deletions
+2 -2
View File
@@ -16,11 +16,11 @@ namespace devtools {
struct Token {
TokenTag tag;
std::string text;
std::wstring text;
Location start;
Location end;
Token(TokenTag tag, std::string text, Location start, Location end)
Token(TokenTag tag, std::wstring text, Location start, Location end)
: tag(tag),
text(std::move(text)),
start(std::move(start)),
+1 -1
View File
@@ -56,7 +56,7 @@ static std::unique_ptr<FontStylesScheme> build_styles(
}
std::unique_ptr<FontStylesScheme> devtools::syntax_highlight(
const std::string& lang, std::string_view source
const std::string& lang, std::wstring_view source
) {
try {
if (lang == "lua") {
+1 -1
View File
@@ -11,6 +11,6 @@ namespace devtools {
};
std::unique_ptr<FontStylesScheme> syntax_highlight(
const std::string& lang, std::string_view source
const std::string& lang, std::wstring_view source
);
}