diff --git a/src/eepp/ui/doc/textdocument.cpp b/src/eepp/ui/doc/textdocument.cpp index 4b4af73aa..90868c84e 100644 --- a/src/eepp/ui/doc/textdocument.cpp +++ b/src/eepp/ui/doc/textdocument.cpp @@ -2779,7 +2779,8 @@ TextDocument::SearchResult TextDocument::findTextLast( String text, TextPosition TextDocument::SearchResult TextDocument::find( const String& text, TextPosition from, bool caseSensitive, bool wholeWord, FindReplaceType type, TextRange restrictRange ) { - std::vector textLines = text.split( '\n', true, true ); + std::vector textLines = type == FindReplaceType::Normal ? text.split( '\n', true, true ) + : std::vector{ text }; if ( textLines.empty() || textLines.size() > mLines.size() ) return {}; diff --git a/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/ispc.cpp b/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/ispc.cpp new file mode 100644 index 000000000..e86773eba --- /dev/null +++ b/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/ispc.cpp @@ -0,0 +1,148 @@ +#include +#include + +namespace EE { namespace UI { namespace Doc { namespace Language { + +void addISPC() { + + auto& sd = SyntaxDefinitionManager::instance()->add( + + { "ISPC", + { "%.ispc$", "%.isph$", "%.ih$" }, + { + { { "//.-\n" }, "comment" }, + { { "/%*", "%*/" }, "comment" }, + { { "(#%s*include)%s+([<%\"][%w%d%.%\\%/%_%-]+[>%\"])" }, + { "keyword", "keyword", "literal" } }, + { { "L?\"", "[\"\n]", "\\" }, "string" }, + { { "'", "'", "\\" }, "string" }, + { { "c_number_parser" }, "number", "", SyntaxPatternMatchType::Parser }, + { { "(struct)%s+([%a_][%w_]+)" }, { "keyword", "keyword", "keyword2" } }, + { { "(enum)%s+([%a_][%w_]+)" }, { "keyword", "keyword", "keyword2" } }, + { { "(cdo|cfor|cif|cwhiledo|else|for|foreach|foreach_active|foreach_tiled|foreach_" + "unique|goto|if|switch|while)\\s*(?=\\()" }, + { "normal", "keyword", "keyword" }, + "", + SyntaxPatternMatchType::RegEx }, + { { "[%a_][%w_]*%s*%f[(]" }, "function" }, + { { "@llvm%.[a-zA-Z_0-9%.]*" }, "function" }, + { { "[%+%-=/%*%^%%<>!~|&]" }, "operator" }, + { { "#[%a_][%w_]*" }, "symbol" }, + { { "[%a_][%w_]*" }, "symbol" }, + + }, + { + + { "assert", "keyword" }, + { "break", "keyword" }, + { "case", "keyword" }, + { "cdo", "keyword" }, + { "cfor", "keyword" }, + { "cif", "keyword" }, + { "cwhile", "keyword" }, + { "continue", "keyword" }, + { "default", "keyword" }, + { "do", "keyword" }, + { "else", "keyword" }, + { "for", "keyword" }, + { "foreach", "keyword" }, + { "foreach_active", "keyword" }, + { "foreach_tiled", "keyword" }, + { "foreach_unique", "keyword" }, + { "goto", "keyword" }, + { "if", "keyword" }, + { "in", "keyword" }, + { "return", "keyword" }, + { "switch", "keyword" }, + { "sync", "keyword" }, + { "task", "keyword" }, + { "while", "keyword" }, + { "launch", "keyword" }, + { "invoke_sycl", "keyword" }, + { "delete", "keyword" }, + { "new", "keyword" }, + { "sizeof", "keyword" }, + { "alloca", "keyword" }, + { "const", "keyword" }, + { "extern", "keyword" }, + { "inline", "keyword" }, + { "noinline", "keyword" }, + { "static", "keyword" }, + { "uniform", "keyword" }, + { "unmasked", "keyword" }, + { "varying", "keyword" }, + { "template", "keyword" }, + { "typedef", "keyword" }, + { "typename", "keyword" }, + { "export", "keyword" }, + { "signed", "keyword2" }, + { "unsigned", "keyword2" }, + { "soa", "keyword" }, + { "__vectorcall", "keyword" }, + { "__regcall", "keyword" }, + { "__attribute__", "keyword" }, + { "volatile", "keyword" }, + + { "bool", "keyword2" }, + { "double", "keyword2" }, + { "float", "keyword2" }, + { "float16", "keyword2" }, + { "int", "keyword2" }, + { "uint", "keyword2" }, + { "int8", "keyword2" }, + { "uint8", "keyword2" }, + { "int16", "keyword2" }, + { "uint16", "keyword2" }, + { "int32", "keyword2" }, + { "uint32", "keyword2" }, + { "int64", "keyword2" }, + { "uint64", "keyword2" }, + { "void", "keyword" }, + { "struct", "keyword" }, + { "enum", "keyword" }, + { "size_t", "keyword2" }, + { "ptrdiff_t", "keyword2" }, + { "intptr_t", "keyword2" }, + { "uintptr_t", "keyword2" }, + + { "true", "literal" }, + { "false", "literal" }, + { "NULL", "literal" }, + { "programIndex", "literal" }, + { "programCount", "literal" }, + { "threadIndex", "literal" }, + { "threadIndex0", "literal" }, + { "threadIndex1", "literal" }, + { "threadIndex2", "literal" }, + { "threadCount", "literal" }, + { "taskIndex", "literal" }, + { "taskIndex0", "literal" }, + { "taskIndex1", "literal" }, + { "taskIndex2", "literal" }, + { "taskCount", "literal" }, + + { "#if", "keyword" }, + { "#ifdef", "keyword" }, + { "#ifndef", "keyword" }, + { "#elif", "keyword" }, + { "#else", "keyword" }, + { "#endif", "keyword" }, + { "#define", "keyword" }, + { "#undef", "keyword" }, + { "#include", "keyword" }, + { "#line", "keyword" }, + { "#error", "keyword" }, + { "#pragma", "keyword" }, + { "#warning ", "keyword" }, + { "#elifdef ", "keyword" }, + { "#elifndef ", "keyword" }, + }, + "//", + {} + + } ); + + sd.setFoldRangeType( FoldRangeType::Braces ).setFoldBraces( { { '{', '}' } } ); +} + +}}}} // namespace EE::UI::Doc::Language diff --git a/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/ispc.hpp b/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/ispc.hpp new file mode 100644 index 000000000..871457319 --- /dev/null +++ b/src/modules/languages-syntax-highlighting/src/eepp/ui/doc/languages/ispc.hpp @@ -0,0 +1,10 @@ +#ifndef EE_UI_DOC_ISPC +#define EE_UI_DOC_ISPC + +namespace EE { namespace UI { namespace Doc { namespace Language { + +extern void addISPC(); + +}}}} // 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 67f63002d..5bc450855 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 @@ -151,6 +152,7 @@ void LanguagesSyntaxHighlighting::load() { addHLSL(); addHtaccessFile(); addIgnoreFile(); + addISPC(); addJai(); addJanet(); addJava(); diff --git a/src/tools/ecode/ecode.cpp b/src/tools/ecode/ecode.cpp index 093fd9f67..67b187ec7 100644 --- a/src/tools/ecode/ecode.cpp +++ b/src/tools/ecode/ecode.cpp @@ -3536,7 +3536,7 @@ void App::init( const LogLevel& logLevel, std::string file, const Float& pidelDe mThreadPool->run( [this] { // Load language definitions Clock defClock; - SyntaxDefinitionManager::createSingleton( 123 ); + SyntaxDefinitionManager::createSingleton( 124 ); Language::LanguagesSyntaxHighlighting::load(); SyntaxDefinitionManager::instance()->setLanguageExtensionsPriority( mConfig.languagesExtensions.priorities );