Skip to content

Commit

Permalink
Color themes
Browse files Browse the repository at this point in the history
  • Loading branch information
huntercfreeman committed May 22, 2023
1 parent 8e5755f commit 7b2b180
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,20 @@ public class Keywords
VOLATILE_KEYWORD,
WHILE_KEYWORD,
}.ToImmutableArray();

public static readonly ImmutableArray<string> CONTROL_KEYWORDS = new[]
{
BREAK_KEYWORD,
CASE_KEYWORD,
CONTINUE_KEYWORD,
DO_KEYWORD,
ELSE_KEYWORD,
FOR_KEYWORD,
GOTO_KEYWORD,
IF_KEYWORD,
RETURN_KEYWORD,
SWITCH_KEYWORD,
WHILE_KEYWORD,
}.ToImmutableArray();
}
}
7 changes: 6 additions & 1 deletion BlazorStudio.ClassLib/CodeAnalysis/C/Syntax/LexSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,14 @@ private ISyntaxToken ConsumeIdentifierOrKeyword()

if (CLanguageFacts.Keywords.ALL.Contains(textValue))
{
var decorationByte = (byte)GenericDecorationKind.Keyword;

if (CLanguageFacts.Keywords.CONTROL_KEYWORDS.Contains(textValue))
decorationByte = (byte)GenericDecorationKind.KeywordControl;

textSpan = textSpan with
{
DecorationByte = (byte)GenericDecorationKind.Keyword,
DecorationByte = decorationByte,
};

return new KeywordToken(textSpan);
Expand Down

0 comments on commit 7b2b180

Please sign in to comment.