Skip to content

Commit ee53294

Browse files
author
Austin Henriksen
committed
Add syntax highlighting support for enums with associated values.
1 parent 62bab4b commit ee53294

File tree

1 file changed

+36
-16
lines changed

1 file changed

+36
-16
lines changed

syntaxes/slice.tmLanguage.json

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@
630630
"field": {
631631
"name": "meta.field.slice",
632632
"begin": "\\\\?\\w+",
633-
"end": "(?=[,}])|$",
633+
"end": "(?=[,}\\)])|$",
634634
"beginCaptures": {
635635
"0": {
636636
"name": "entity.name.variable.slice",
@@ -641,7 +641,7 @@
641641
{"include": "#standard"},
642642
{
643643
"begin": ":",
644-
"end": "(?=[,}])|$",
644+
"end": "(?=[,}\\)])|$",
645645
"beginCaptures": {
646646
"0": {"name": "punctuation.separator.colon.slice"}
647647
},
@@ -724,26 +724,46 @@
724724
"patterns": [
725725
{"include": "#standard"},
726726
{
727-
"begin": "=",
728-
"end": "(?=[,}])|$",
727+
"begin": "\\(",
728+
"end": "\\)",
729729
"beginCaptures": {
730-
"0": {"name": "keyword.operator.assignment.slice"}
730+
"0": {"name": "punctuation.parenthesis.open.slice"}
731+
},
732+
"endCaptures": {
733+
"0": {"name": "punctuation.parenthesis.close.slice"}
731734
},
732735
"patterns": [
733-
{"include": "#standard"},
736+
{"include": "#tag"},
737+
{"include": "#field"},
734738
{
735-
"begin": "(?=-|\\b)[\\w-]+\\b",
736-
"end": "(?=[,}])|$",
737-
"beginCaptures": {
738-
"0": {"patterns": [{"include": "#integer-literal"}]}
739-
},
740-
"patterns": [
741-
{"include": "#standard"}
742-
]
739+
"name": "punctuation.separator.comma.slice",
740+
"match": ","
743741
},
744-
{"include": "#error"}
742+
{"include": "#slice"}
745743
]
746-
}
744+
},
745+
{"include": "#enumerator-value"}
746+
]
747+
},
748+
"enumerator-value": {
749+
"begin": "=",
750+
"end": "(?=[,}])|$",
751+
"beginCaptures": {
752+
"0": {"name": "keyword.operator.assignment.slice"}
753+
},
754+
"patterns": [
755+
{"include": "#standard"},
756+
{
757+
"begin": "(?=-|\\b)[\\w-]+\\b",
758+
"end": "(?=[,}])|$",
759+
"beginCaptures": {
760+
"0": {"patterns": [{"include": "#integer-literal"}]}
761+
},
762+
"patterns": [
763+
{"include": "#standard"}
764+
]
765+
},
766+
{"include": "#error"}
747767
]
748768
},
749769

0 commit comments

Comments
 (0)