Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
niltor committed Apr 1, 2024
2 parents 05e1256 + 140efb5 commit 63a153a
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Lib/ColorCode.Core/Common/ScopeName.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,6 @@ public class ScopeName
public const string Brackets = "Brackets";
public const string Continuation = "Continuation";
public const string Variable = "Variable";
public const string Function = "Function";
public const string Symbol = "Symbol";
}
60 changes: 55 additions & 5 deletions Lib/ColorCode.Core/Compilation/Languages/CSharp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,49 @@ public IList<LanguageRule> Rules
{ 2, ScopeName.ClassName }
}),

new LanguageRule(@"[\(\)\[\]\{\}]",
new Dictionary<int, string>
{
{ 0, ScopeName.ControlKeyword },
}),
new LanguageRule(@"\b([A-Z][a-z0-9A-Z]*)<([A-Z][a-z0-9A-Z]*)>",
new Dictionary<int, string>
{
{ 1, ScopeName.ClassName },
{ 2, ScopeName.Symbol},
}),
new LanguageRule(@" +\b([A-Z][a-z0-9A-Z]*) +([a-z][a-z0-9A-Z]*)\b +=",
new Dictionary<int, string>
{
{ 1, ScopeName.ClassName },
{ 2, ScopeName.Variable},
}),
new LanguageRule(@"([A-Z][a-z0-9A-Z]*)\.([A-Z][a-z0-9A-Z]*)[; +]",
new Dictionary<int, string>
{
{ 1, ScopeName.ClassName },
{ 2, ScopeName.Variable},
}),
new LanguageRule(@"\b([A-Z][a-z0-9A-Z]*)\.([A-Z][a-z0-9A-Z]*)(\()",
new Dictionary<int, string>
{
{ 1, ScopeName.ClassName },
{ 2, ScopeName.Function},
{ 3, ScopeName.ControlKeyword },
}),
new LanguageRule(@"\b([a-z][a-z0-9A-Z]*)\.([A-Z][a-z0-9A-Z]*)(\()",
new Dictionary<int, string>
{
{ 1, ScopeName.Variable },
{ 2, ScopeName.Function },
{ 3, ScopeName.ControlKeyword },
}),
new LanguageRule(@"\.([A-Z][a-z0-9A-Z]*)(\()",
new Dictionary<int, string>
{
{ 1, ScopeName.Function },
{ 2, ScopeName.ControlKeyword },
}),
new LanguageRule(
@"\b(int|string|float|double|bool|object|var)\s+([a-zA-Z_][a-zA-Z0-9_]*)\b",
new Dictionary<int, string>
Expand All @@ -86,6 +129,12 @@ public IList<LanguageRule> Rules
{
{ 1, ScopeName.Variable }
}),
new LanguageRule(
@"\b([A-Z][a-zA-Z0-0]*)\b =",
new Dictionary<int, string>
{
{ 1, ScopeName.Variable }
}),
new LanguageRule(
@"\[(assembly|module|type|return|param|method|field|property|event):[^\]""]*(""[^\n]*?(?<!\\)"")?[^\]]*\]",
new Dictionary<int, string>
Expand All @@ -105,18 +154,19 @@ public IList<LanguageRule> Rules
{ 1, ScopeName.Keyword },
{ 2, ScopeName.ClassName },
}),
new LanguageRule(@" +([A-Z][a-z0-9A-Z]*)[<\w+>]*(\()",
new Dictionary<int, string>
{
{ 1, ScopeName.Function },
{ 2, ScopeName.ControlKeyword },
}),
new LanguageRule(
@"\b(abstract|as|ascending|base|bool|break|by|byte|case|catch|char|checked|class|const|continue|decimal|default|delegate|descending|do|double|dynamic|else|enum|equals|event|explicit|extern|false|finally|fixed|float|for|foreach|from|get|goto|group|if|implicit|in|int|into|interface|internal|is|join|let|lock|long|namespace|new|null|object|on|operator|orderby|out|override|params|partial|private|protected|public|readonly|ref|return|sbyte|sealed|select|set|short|sizeof|stackalloc|static|string|struct|switch|this|throw|true|try|typeof|uint|ulong|unchecked|unsafe|ushort|using|var|virtual|void|volatile|where|while|yield|async|await|warning|disable)\b",
new Dictionary<int, string>
{
{ 0, ScopeName.Keyword }
}),

new LanguageRule(@"[\(\)\[\]\{\}]",
new Dictionary<int, string>
{
{ 0, ScopeName.ControlKeyword },
}),

new LanguageRule(
@"(?s)(""[^\n]*?(?<!\\)"")",
Expand Down
11 changes: 11 additions & 0 deletions Lib/ColorCode.Core/Styling/StyleDictionary.DefaultDark.cs
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,17 @@ public static StyleDictionary DefaultDark
Foreground = Teal,
ReferenceName = "variable"
},
new Style(ScopeName.Function)
{
Foreground = Teal,
ReferenceName = "function"
},
new Style(ScopeName.Symbol)
{
Foreground = VSDarkKeyword,
ReferenceName = "symbol"
}

];
}
}
Expand Down
10 changes: 10 additions & 0 deletions Lib/ColorCode.Core/Styling/StyleDictionary.DefaultLight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,16 @@ public static StyleDictionary DefaultLight
Foreground = OrangeRed,
ReferenceName = "variable"
},
new Style(ScopeName.Function)
{
Foreground = Teal,
ReferenceName = "function"
},
new Style(ScopeName.Symbol)
{
Foreground = DarkCyan,
ReferenceName = "symbol"
}
];
}
}
Expand Down
1 change: 0 additions & 1 deletion WebApp/css/markdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ h5 {
height: fit-content;
}

ul.toc {}

ul.toc li {
list-style-type: none;
Expand Down

0 comments on commit 63a153a

Please sign in to comment.