Add syntax highlighting for if-else (#4090)

* Add syntax highlighting for if-else

* A snapshot a day keeps the bugs away! 📷🐛 (OS: windows-latest)

* Confirm

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Jonathan Tran
2024-10-04 08:34:09 -04:00
committed by GitHub
parent d7bc92afd9
commit 074c285e04
4 changed files with 2 additions and 0 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View File

@ -2,6 +2,7 @@ import { styleTags, tags as t } from '@lezer/highlight'
export const kclHighlight = styleTags({
'fn var let const': t.definitionKeyword,
'if else': t.controlKeyword,
return: t.controlKeyword,
'true false': t.bool,
nil: t.null,

View File

@ -40,6 +40,7 @@ expression[@isGroup=Expression] {
} |
UnaryExpression { UnaryOp expression } |
ParenthesizedExpression { "(" expression ")" } |
IfExpression { kw<"if"> expression Body kw<"else"> Body } |
CallExpression { expression !call ArgumentList } |
ArrayExpression { "[" commaSep<expression | IntegerRange { expression !range ".." expression }> "]" } |
ObjectExpression { "{" commaSep<ObjectProperty> "}" } |