Fix some issues with RegEx captures.

Added Janet syntax highlighting (SpartanJ/ecode#394).
Fixes in syntax highlighter to C++ converter.
This commit is contained in:
Martín Lucas Golini
2025-04-12 17:55:05 -03:00
parent be30ee67bc
commit d0f4a2eeea
9 changed files with 272 additions and 26 deletions

View File

@@ -58,9 +58,12 @@ class EE_API RegEx : public PatternMatcher {
ExtendedMore = 0x01000000u, // C
Literal = 0x02000000u, // C
MatchInvalidUtf = 0x04000000u, // J M D
FilterOutCaptures =
0x08000000u, // It will filter out repeated captures and same range captures
};
RegEx( const std::string_view& pattern, Options options = Options::Utf, bool useCache = true );
RegEx( const std::string_view& pattern,
Uint32 options = Options::Utf | Options::FilterOutCaptures, bool useCache = true );
virtual ~RegEx();
@@ -83,6 +86,7 @@ class EE_API RegEx : public PatternMatcher {
int mCaptureCount;
bool mValid{ false };
bool mCached{ false };
bool mFilterOutCaptures{ false };
};
}} // namespace EE::System

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 14.0.1, 2024-09-28T00:59:35. -->
<!-- Written by QtCreator 16.0.0, 2025-04-12T17:50:49. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@@ -13,8 +13,8 @@
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoDetect">true</value>
<value type="bool" key="EditorConfiguration.AutoIndent">false</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
@@ -39,6 +39,7 @@
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.LineEndingBehavior">0</value>
<value type="int" key="EditorConfiguration.MarginColumn">100</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
@@ -1035,17 +1036,18 @@
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph dwarf,4096 -F 250</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}../../../bin/eeiv-debug</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eeiv-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eeiv-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">false</value>
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">true</value>
<value type="int" key="RunConfiguration.UseCppDebugger">0</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
<value type="int" key="RunConfiguration.UsePythonDebugger">1</value>
<value type="int" key="RunConfiguration.UseQmlDebugger">1</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseTerminal">false</value>
<value type="QString" key="RunConfiguration.WorkingDirectory">%{buildDir}../../../bin/</value>
<value type="QString" key="RunConfiguration.WorkingDirectory">%{buildDir}/../../bin</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.13">
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
@@ -1107,7 +1109,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">true</value>
<value type="QString" key="RunConfiguration.Arguments">-u --xml /home/downloads/untitled_1.xml</value>
<value type="QString" key="RunConfiguration.Arguments">-u</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="int" key="RunConfiguration.UseQmlDebugger">1</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
@@ -1197,7 +1199,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">true</value>
<value type="QString" key="RunConfiguration.Arguments">--css=/root/.config/ecode/style.css</value>
<value type="QString" key="RunConfiguration.Arguments">/home/downloads/files/svn/janet</value>
<value type="int" key="RunConfiguration.UseCppDebugger">0</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
<value type="int" key="RunConfiguration.UseQmlDebugger">1</value>
@@ -1425,6 +1427,29 @@
<value type="bool" key="RunConfiguration.UseTerminal">false</value>
<value type="QString" key="RunConfiguration.WorkingDirectory">%{buildDir}/../../bin</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.29">
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="qlonglong" key="Analyzer.QmlProfiler.FlushInterval">0</value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph dwarf,4096 -F 250</value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">%{buildDir}/../../bin/eepp-ui-custom-widget-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-ui-custom-widget-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">true</value>
<value type="int" key="RunConfiguration.UseCppDebugger">0</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
<value type="int" key="RunConfiguration.UsePythonDebugger">1</value>
<value type="int" key="RunConfiguration.UseQmlDebugger">1</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseTerminal">false</value>
<value type="QString" key="RunConfiguration.WorkingDirectory">%{buildDir}../../../bin/</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.3">
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="qlonglong" key="Analyzer.QmlProfiler.FlushInterval">0</value>
@@ -1524,10 +1549,12 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">eepp-sprites-debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">false</value>
<value type="int" key="RunConfiguration.UseCppDebugger">1</value>
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">true</value>
<value type="int" key="RunConfiguration.UseCppDebugger">0</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="int" key="RunConfiguration.UsePythonDebugger">1</value>
<value type="int" key="RunConfiguration.UseQmlDebugger">1</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
<value type="bool" key="RunConfiguration.UseTerminal">false</value>
<value type="QString" key="RunConfiguration.WorkingDirectory">%{buildDir}../../../bin/</value>
</valuemap>
@@ -1574,7 +1601,7 @@
<value type="bool" key="RunConfiguration.UseTerminal">false</value>
<value type="QString" key="RunConfiguration.WorkingDirectory">%{buildDir}../../../bin/</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">29</value>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">30</value>
</valuemap>
</data>
<data>
@@ -1666,9 +1693,98 @@
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.2</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Python 2.7.18</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Python 2.7.18</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{0790f8fd-ca23-4e38-9ab1-4094ae2bb99e}</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/programming/eepp/projects/linux</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
<value type="QString">all</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<valuelist type="QVariantList" key="GenericProjectManager.GenericMakeStep.BuildTargets">
<value type="QString">clean</value>
</valuelist>
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericMakeStep</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Default</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">GenericProjectManager.GenericBuildConfiguration</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Valgrind.Callgrind.CostFormat">0</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CycleDetection">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.ShortenTemplates">false</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">false</value>
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">/usr/bin/kcachegrind</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">2</value>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">2</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">/usr/bin/valgrind</value>
<value type="QList&lt;int&gt;" key="Analyzer.Valgrind.VisibleErrorKinds"></value>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
<value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph dwarf,4096 -F 250</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="qlonglong">2</value>
<value type="qlonglong">3</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>

View File

@@ -25,17 +25,21 @@ void RegExCache::clear() {
mCache.clear();
}
RegEx::RegEx( const std::string_view& pattern, Options options, bool useCache ) :
RegEx::RegEx( const std::string_view& pattern, Uint32 options, bool useCache ) :
PatternMatcher( PatternType::PCRE ),
mPattern( pattern ),
mMatchNum( 0 ),
mCompiledPattern( nullptr ),
mCaptureCount( 0 ),
mValid( true ) {
mValid( true ),
mFilterOutCaptures( ( options & Options::FilterOutCaptures ) != 0 ) {
int errornumber;
PCRE2_SIZE erroroffset;
PCRE2_SPTR pattern_sptr = reinterpret_cast<PCRE2_SPTR>( pattern.data() );
if ( mFilterOutCaptures )
options &= ~Options::FilterOutCaptures;
if ( useCache && RegExCache::instance()->isEnabled() &&
( mCompiledPattern = RegExCache::instance()->find( pattern, options ) ) ) {
mValid = true;
@@ -108,17 +112,23 @@ bool RegEx::matches( const char* stringSearch, int stringStartOffset,
mMatchNum = rc;
if ( matchList != nullptr ) {
if ( matchList != nullptr && mMatchNum > 0 ) {
PCRE2_SIZE* ovector = pcre2_get_ovector_pointer( match_data );
int curCap = 0;
for ( size_t i = 0; i < static_cast<size_t>( rc ); ++i ) {
matchList[i].start = stringStartOffset + static_cast<int>( ovector[2 * i] );
matchList[i].end = stringStartOffset + static_cast<int>( ovector[2 * i + 1] );
if ( matchList[i].start >= matchList[i].end ) {
matchList[i].start = matchList[i].end = -1;
mMatchNum--;
break;
int start = stringStartOffset + static_cast<int>( ovector[2 * i] );
int end = stringStartOffset + static_cast<int>( ovector[2 * i + 1] );
if ( !mFilterOutCaptures ||
( !( start == 0 && end == 0 ) && start != end &&
( curCap == 0 || !( matchList[curCap - 1].start == start &&
matchList[curCap - 1].end == end ) ) ) ) {
matchList[curCap].start = start;
matchList[curCap].end = end;
curCap++;
}
}
mMatchNum = curCap;
}
pcre2_match_data_free( match_data );

View File

@@ -283,14 +283,14 @@ namespace EE { namespace UI { namespace Doc { namespace Language {
break;
}
if ( !fdtn.empty() )
buf += String::format( ".setFoldRangeType( \"%s\" )\n", fdtn );
buf += String::format( ".setFoldRangeType( %s )\n", fdtn );
}
if ( !def.getFoldBraces().empty() ) {
buf += ".setFoldBraces( { ";
for ( const auto& brace : def.getFoldBraces() ) {
buf += String::format(
"{ '%s', '%s' }",
"{ '%s', '%s' },",
String( static_cast<String::StringBaseType>( brace.first ) ).toUtf8(),
String( static_cast<String::StringBaseType>( brace.second ) ).toUtf8() );
}

View File

@@ -373,7 +373,7 @@ _tokenize( const SyntaxDefinition& syntax, const std::string& text, const Syntax
for ( size_t curMatch = 1; curMatch < numMatches; curMatch++ ) {
start = matches[curMatch].start;
end = matches[curMatch].end;
if ( start == end && matches[curMatch - 1].end == start )
if ( start == end || start < 0 || end < 0 )
continue;
if ( pattern.patterns.size() >= 3 && i > 0 &&
text[i - 1] == pattern.patterns[2][0] )

View File

@@ -0,0 +1,104 @@
#include <eepp/ui/doc/languages/janet.hpp>
#include <eepp/ui/doc/syntaxdefinitionmanager.hpp>
namespace EE { namespace UI { namespace Doc { namespace Language {
void addJanet() {
SyntaxDefinitionManager::instance()
->add(
{ "Janet",
{ "%.janet$" },
{
{ { "(@?)```", "```", "\\" }, "string" },
{ { "(@?)``", "``", "\\" }, "string" },
{ { "(@?)`", "`", "\\" }, "string" },
{ { "\"", "\"", "\\" }, "string" },
{ { "0x[%da-fA-F]+" }, "number" },
{ { "-?%d+[%d%.eE]*f?" }, "number" },
{ { "#.-\n" }, "comment" },
{ { "^\\((def|defglobal|defdyn)\\-?\\s+([a-zA-Z0-9!$%&*+-./:<?=>@^_\"]+)" },
std::vector<std::string>{ "operator", "keyword", "literal" },
"",
SyntaxPatternMatchType::RegEx },
{ { "[';~,|]*\\((defn|defmacro)\\-?\\s+([a-zA-Z0-9!$%&*+-./:<?=>@^_\"]+)" },
std::vector<std::string>{ "operator", "keyword", "literal" },
"",
SyntaxPatternMatchType::RegEx },
{ { "[';~,|]*\\(([';~,|]*)(break|def|do|fn|if|quasiquote|quote|set|splice|"
"unquote|upscope|var|while|call|maker|array|tuple|tablector|bufferctor|asm|"
"disasm|compile|dyn|setdyn|native|describe|string|symbol|keyword|buffer|"
"abstract\\?|scan-number|tuple|array|slice|table|getproto|struct|gensym|"
"gccollect|gcsetinterval|gcinterval|type|hash|getline|trace|untrace|int\\?|"
"nat\\?|signal|memcmp|sandbox|print|prin|eprint|eprin|xprint|xprin|printf|"
"prinf|eprintf|eprinf|xprintf|xprinf|flush|eflush|env-lookup|marshal|"
"unmarshal|not|debug|error|apply|yield|resume|in|put|length|add|sub|mul|div|"
"band|bor|bxor|lshift|rshift|rshiftu|bnot|gt|lt|gte|lte|eq|neq|propagate|get|"
"next|modulo|remainder|cmp|cancel|mod|sandbox|defmacro|defglobal|varglobal|"
"nan\\?|number\\?|fiber\\?|string\\?|symbol\\?|keyword\\?|buffer\\?|"
"function\\?|cfunction\\?|table\\?|struct\\?|array\\?|tuple\\?|boolean\\?|"
"bytes\\?|dictionary\\?|indexed\\?|truthy\\?|true\\?|false\\?|nil\\?|empty\\?"
"|odd\\?|inc|dec|errorf|return|sum|mean|product|comp|identity|complement|"
"extreme|max|min|max-of|min-of|first|last|compare|compare=|compare<|compare<="
"|compare>|compare>=|zero\\?|pos\\?|neg\\?|one\\?|even\\?|odd\\?|sort|sort-"
"by|sorted|sorted-by|reduce|reduce2|accumulate|accumulate2|map|mapcat|filter|"
"count|keep|range|find-index|find|index-of|take|take-until|take-while|drop|"
"drop-until|drop-while|juxt\\*|walk|postwalk|prewalk|partial|every\\?|any\\?|"
"reverse!|reverse|invert|zipcoll|get-in|update-in|put-in|update|merge-into|"
"merge|keys|values|pairs|frequencies|group-by|partition-by|interleave|"
"distinct|flatten-into|flatten|kvs|from-pairs|interpose|partition|slurp|spit|"
"pp|maclintf|macex1|all|some|not=|deep-not=|deep=|freeze|macex|make-env|bad-"
"parse|warn-compile|bad-compile|curenv|run-context|quit|eval|parse|parse-all|"
"eval-string|make-image|load-image|debugger|debugger-on-status|dofile|"
"require|merge-module|import\\*|all-bindings|all-dynamics|doc-format|doc\\*|"
"doc-of|\\.fiber|\\.signal|\\.stack|\\.frame|\\.locals|\\.fn|\\.slots|\\."
"slot|\\.source|\\.break|\\.clear|\\.next|\\.nextc|\\.step|\\.locals|repl|"
"flycheck|cli-main|as-macro|defmacro-|defn-|def-|var-|toggle|assert|default|"
"comment|if-not|when|unless|cond|case|let|try|protect|and|or|with-syms|defer|"
"edefer|prompt|chr|label|with|when-with|if-with|forv|for|eachk|eachp|repeat|"
"forever|each|loop|seq|catseq|tabseq|generate|coro|fiber-fn|if-let|when-let|"
"juxt|defdyn|tracev|with-dyns|with-vars|match|varfn|short-fn|comptime|compif|"
"compwhen|import|use|doc|delay|keep-syntax|keep-syntax!|->|->>|-?>|-?>>|as->|"
"as?->|--|\\+=|\\+\\+|-=|\\*=|/=|%=|\\+|-|\\*|%|/"
"|>=|<=|=|<|>)((?=$|[\\s,()\\[\\]{}\\\";])+)" },
std::vector<std::string>{ "operator", "keyword", "literal" },
"",
SyntaxPatternMatchType::RegEx },
{ { "%(?(%:[%a_][%w_]*)" }, { "operator", "keyword3", "keyword3" } },
{ { "[';~,|]*\\(([a-zA-Z!$%&*+-./:<?=>@^_\"]+/?[a-zA-Z!$%&*+-./:<?=>@^_\"]+)" },
std::vector<std::string>{ "operator", "function", "literal" },
"",
SyntaxPatternMatchType::RegEx },
{ { "(nil|true|false)(?=$|[\\s,()\\[\\]{}\";])+" },
"literal",
"",
SyntaxPatternMatchType::RegEx },
{ { "[a-zA-Z0-9!$%&*+-./:<?=>@^_\"]+" },
"keyword2",
"",
SyntaxPatternMatchType::RegEx },
{ { "([';~,|]*)@?(\\()" },
std::vector<std::string>{ "operator", "operator", "operator" },
"",
SyntaxPatternMatchType::RegEx },
{ { "[%)%[%]%{%}]" }, "operator" },
},
{
},
"#",
{}
} )
.setFoldRangeType( FoldRangeType::Markdown )
.setFoldBraces( {
{ '(', ')' },
{ '{', '}' },
{ '[', ']' },
} );
;
}
}}}} // namespace EE::UI::Doc::Language

View File

@@ -0,0 +1,10 @@
#ifndef EE_UI_DOC_Janet
#define EE_UI_DOC_Janet
namespace EE { namespace UI { namespace Doc { namespace Language {
extern void addJanet();
}}}} // namespace EE::UI::Doc::Language
#endif

View File

@@ -40,6 +40,7 @@
#include <eepp/ui/doc/languages/htaccess.hpp>
#include <eepp/ui/doc/languages/ignorefile.hpp>
#include <eepp/ui/doc/languages/jai.hpp>
#include <eepp/ui/doc/languages/janet.hpp>
#include <eepp/ui/doc/languages/java.hpp>
#include <eepp/ui/doc/languages/jsx.hpp>
#include <eepp/ui/doc/languages/jule.hpp>
@@ -151,6 +152,7 @@ void LanguagesSyntaxHighlighting::load() {
addHtaccessFile();
addIgnoreFile();
addJai();
addJanet();
addJava();
addJule();
addJulia();

View File

@@ -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( 122 );
SyntaxDefinitionManager::createSingleton( 123 );
Language::LanguagesSyntaxHighlighting::load();
SyntaxDefinitionManager::instance()->setLanguageExtensionsPriority(
mConfig.languagesExtensions.priorities );