Skip to content

Commit 5202516

Browse files
committed
TM: Fix named args, inline enum param
1 parent b1d1c2b commit 5202516

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

syntaxes/c3.tmLanguage.json

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,10 @@
398398
{
399399
"include": "#comments"
400400
},
401+
{
402+
"match": "\\binline\\b",
403+
"name": "storage.modifier.c3"
404+
},
401405
{
402406
"include": "#parameters"
403407
}
@@ -1560,22 +1564,30 @@
15601564
"include": "#comments"
15611565
},
15621566
{
1563-
"match": "([$#]?(?:\\b_*[a-z][_a-zA-Z0-9]*\\b)|\\$(?:\\b_*[A-Z][_A-Z0-9]*[a-z][_a-zA-Z0-9]*\\b))\\s*(:)(?!:)",
1564-
"captures": {
1567+
"begin": "([$#]?(?:\\b_*[a-z][_a-zA-Z0-9]*\\b)|\\$(?:\\b_*[A-Z][_A-Z0-9]*[a-z][_a-zA-Z0-9]*\\b))\\s*(:)(?!:)",
1568+
"beginCaptures": {
15651569
"1": {
15661570
"name": "variable.parameter.c3"
15671571
},
15681572
"2": {
15691573
"name": "punctuation.separator.c3"
15701574
}
1571-
}
1575+
},
1576+
"end": "(?=\\))|([;,])",
1577+
"endCaptures": {
1578+
"1": {
1579+
"name": "punctuation.separator.c3"
1580+
}
1581+
},
1582+
"patterns": [
1583+
{
1584+
"include": "#expression"
1585+
}
1586+
]
15721587
},
15731588
{
15741589
"include": "#expression"
15751590
},
1576-
{
1577-
"include": "#punctuation"
1578-
},
15791591
{
15801592
"match": ";",
15811593
"name": "punctuation.separator.c3"

syntaxes/c3.tmLanguage.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ repository:
196196
patterns:
197197
- include: "#comments"
198198
- match: '\binline\b'
199-
name: storage.modifier.c3 # TODO
199+
name: storage.modifier.c3
200200
- include: "#type_no_generics"
201201
# Enum parameters
202202
- begin: '\('
@@ -208,6 +208,8 @@ repository:
208208
contentName: meta.group.c3
209209
patterns:
210210
- include: "#comments"
211+
- match: '\binline\b'
212+
name: storage.modifier.c3
211213
- include: "#parameters"
212214
- include: "#attribute"
213215
# Enum body
@@ -793,12 +795,16 @@ repository:
793795
patterns:
794796
- include: "#comments"
795797
# Named argument
796-
- match: '([$#]?{{IDENT}}|\${{TYPE}})\s*(:)(?!:)' # TODO using \s* doesn't match over multiple lines
797-
captures:
798+
- begin: '([$#]?{{IDENT}}|\${{TYPE}})\s*(:)(?!:)'
799+
beginCaptures:
798800
1: { name: variable.parameter.c3 }
799801
2: { name: punctuation.separator.c3 }
802+
end: '(?=\))|([;,])'
803+
endCaptures:
804+
1: { name: punctuation.separator.c3 }
805+
patterns:
806+
- include: "#expression"
800807
- include: "#expression"
801-
- include: "#punctuation"
802808
- match: ';'
803809
name: punctuation.separator.c3
804810

0 commit comments

Comments
 (0)