From 67a707a32fdf62242a61303066ef52ce76725ae4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Wed, 19 Mar 2025 13:35:30 -0300 Subject: [PATCH] Added Jule syntax highlighting support (SpartanJ/ecode#398). --- .../src/eepp/ui/doc/languages/jule.cpp | 63 +++++++++++++++++++ .../src/eepp/ui/doc/languages/jule.hpp | 10 +++ .../ui/doc/languagessyntaxhighlighting.cpp | 2 + src/tools/ecode/ecode.cpp | 2 +- 4 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/jule.cpp create mode 100644 src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/jule.hpp diff --git a/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/jule.cpp b/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/jule.cpp new file mode 100644 index 000000000..c855d28b1 --- /dev/null +++ b/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/jule.cpp @@ -0,0 +1,63 @@ +#include +#include + +namespace EE { namespace UI { namespace Doc { namespace Language { + +void addJule() { + + auto& sd = SyntaxDefinitionManager::instance()->add( + + { "Jule", + { "%.jule$" }, + { + { { "//.-\n" }, "comment" }, + { { "/%*", "%*/" }, "comment" }, + { { "\"", "[\"\n]", "\\" }, "string" }, + { { "'", "'", "\\" }, "string" }, + { { "-?0x%x+" }, "number" }, + { { "-?0b[01]+" }, "number" }, + { { "-?%d+[%d%.eE]*f?" }, "number" }, + { { "-?%.?%d+f?" }, "number" }, + { { "[%+%-=/%*%^%%<>!~|&]" }, "operator" }, + { { "(%w+)::([%a_][%w_]*)%(" }, { "normal", "keyword2", "function" } }, + { { "(%w+)::([%a_][%w_]*)" }, { "normal", "keyword2", "keyword2" } }, + { { "(struct)%s+([%a_][%w_]*)" }, { "normal", "keyword", "keyword2" } }, + { { "(impl)%s+([%a_][%w_]*)" }, { "normal", "keyword", "keyword2" } }, + { { "(enum)%s+([%a_][%w_]*)" }, { "normal", "keyword", "keyword2" } }, + { { "(trait)%s+([%a_][%w_]*)" }, { "normal", "keyword", "keyword2" } }, + { { "[%a_][%w_]*%f[(]" }, "function" }, + { { "([%a_][%w_]+)%[([%a_][%w_]*)%]%f[(]" }, { "normal", "function", "keyword2" } }, + { { "[%a_][%w_]*" }, "symbol" }, + + }, + { + { "int", "keyword2" }, { "str", "keyword2" }, { "impl", "keyword" }, + { "continue", "keyword" }, { "i16", "keyword2" }, { "bool", "keyword2" }, + { "uintptr", "keyword2" }, { "integ", "keyword" }, { "fall", "keyword" }, + { "i8", "keyword2" }, { "u32", "keyword2" }, { "any", "keyword2" }, + { "match", "keyword" }, { "i64", "keyword2" }, { "false", "literal" }, + { "for", "keyword" }, { "goto", "keyword" }, { "const", "keyword" }, + { "u64", "keyword2" }, { "select", "keyword" }, { "unsafe", "keyword" }, + { "else", "keyword" }, { "f64", "keyword2" }, { "enum", "keyword" }, + { "cpp", "keyword" }, { "struct", "keyword" }, { "break", "keyword" }, + { "use", "keyword" }, { "if", "keyword" }, { "let", "keyword" }, + { "in", "keyword" }, { "f32", "keyword2" }, { "i32", "keyword2" }, + { "map", "keyword2" }, { "trait", "keyword" }, { "mut", "keyword" }, + { "error", "keyword" }, { "u8", "keyword2" }, { "byte", "keyword2" }, + { "static", "keyword" }, { "defer", "keyword" }, { "co", "keyword" }, + { "uint", "keyword2" }, { "self", "keyword" }, { "true", "literal" }, + { "chan", "keyword" }, { "nil", "literal" }, { "rune", "keyword2" }, + { "ret", "keyword" }, { "fn", "keyword" }, { "u16", "keyword2" }, + { "type", "keyword" }, + + }, + "//", + {} + + } ); + + sd.setFoldRangeType( FoldRangeType::Braces ).setFoldBraces( { { '{', '}' } } ); + +} + +}}}} // namespace EE::UI::Doc::Language diff --git a/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/jule.hpp b/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/jule.hpp new file mode 100644 index 000000000..1accff721 --- /dev/null +++ b/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/jule.hpp @@ -0,0 +1,10 @@ +#ifndef EE_UI_DOC_Jule +#define EE_UI_DOC_Jule + +namespace EE { namespace UI { namespace Doc { namespace Language { + +extern void addJule(); + +}}}} // namespace EE::UI::Doc::Language + +#endif diff --git a/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languagessyntaxhighlighting.cpp b/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languagessyntaxhighlighting.cpp index 387010af2..35f2b99a3 100644 --- a/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languagessyntaxhighlighting.cpp +++ b/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languagessyntaxhighlighting.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -138,6 +139,7 @@ void LanguagesSyntaxHighlighting::load() { addIgnoreFile(); addJai(); addJava(); + addJule(); addJulia(); addJSX(); addKotlin(); diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index cffb4581f..c142edf95 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -3531,7 +3531,7 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe mThreadPool->run( [this] { // Load language definitions Clock defClock; - SyntaxDefinitionManager::createSingleton( 111 ); + SyntaxDefinitionManager::createSingleton( 112 ); Language::LanguagesSyntaxHighlighting::load(); SyntaxDefinitionManager::instance()->setLanguageExtensionsPriority( mConfig.languagesExtensions.priorities );