1212 {
1313 "include" : " #comment"
1414 },
15+ {
16+ "include" : " #feature-gate"
17+ },
1518 {
1619 "include" : " #package"
1720 },
3437 "comment" : " whitespace token" ,
3538 "match" : " \\ s+"
3639 },
40+ "feature-gate" : {
41+ "name" : " meta.feature-gate.wit" ,
42+ "comment" : " Feature gate annotations like @unstable, @since, @deprecated" ,
43+ "patterns" : [
44+ {
45+ "name" : " meta.annotation.unstable.wit" ,
46+ "begin" : " (@unstable)(\\ ()" ,
47+ "beginCaptures" : {
48+ "1" : {
49+ "name" : " keyword.control.unstable.wit"
50+ },
51+ "2" : {
52+ "name" : " punctuation.brackets.round.begin.wit"
53+ }
54+ },
55+ "patterns" : [
56+ {
57+ "include" : " #feature-gate-content"
58+ }
59+ ],
60+ "end" : " (\\ ))" ,
61+ "endCaptures" : {
62+ "1" : {
63+ "name" : " punctuation.brackets.round.end.wit"
64+ }
65+ }
66+ },
67+ {
68+ "name" : " meta.annotation.since.wit" ,
69+ "begin" : " (@since)(\\ ()" ,
70+ "beginCaptures" : {
71+ "1" : {
72+ "name" : " keyword.control.since.wit"
73+ },
74+ "2" : {
75+ "name" : " punctuation.brackets.round.begin.wit"
76+ }
77+ },
78+ "patterns" : [
79+ {
80+ "include" : " #feature-gate-content"
81+ }
82+ ],
83+ "end" : " (\\ ))" ,
84+ "endCaptures" : {
85+ "1" : {
86+ "name" : " punctuation.brackets.round.end.wit"
87+ }
88+ }
89+ },
90+ {
91+ "name" : " meta.annotation.deprecated.wit" ,
92+ "begin" : " (@deprecated)(\\ ()" ,
93+ "beginCaptures" : {
94+ "1" : {
95+ "name" : " keyword.control.deprecated.wit"
96+ },
97+ "2" : {
98+ "name" : " punctuation.brackets.round.begin.wit"
99+ }
100+ },
101+ "patterns" : [
102+ {
103+ "include" : " #feature-gate-content"
104+ }
105+ ],
106+ "end" : " (\\ ))" ,
107+ "endCaptures" : {
108+ "1" : {
109+ "name" : " punctuation.brackets.round.end.wit"
110+ }
111+ }
112+ }
113+ ]
114+ },
115+ "feature-gate-content" : {
116+ "name" : " meta.feature-gate-content.wit" ,
117+ "comment" : " Content inside feature gate annotations" ,
118+ "patterns" : [
119+ {
120+ "include" : " #comment"
121+ },
122+ {
123+ "name" : " meta.feature-gate-parameter.wit" ,
124+ "match" : " \\ b(feature|version)\\ s*(=)\\ s*([^\\ s,)]+|\" [^\" ]*\" )" ,
125+ "captures" : {
126+ "1" : {
127+ "name" : " variable.parameter.feature-gate.wit"
128+ },
129+ "2" : {
130+ "name" : " keyword.operator.assignment.wit"
131+ },
132+ "3" : {
133+ "name" : " string.quoted.feature-gate.wit"
134+ }
135+ }
136+ },
137+ {
138+ "name" : " punctuation.comma.wit" ,
139+ "match" : " ,"
140+ },
141+ {
142+ "include" : " #whitespace"
143+ }
144+ ]
145+ },
37146 "comment" : {
38147 "patterns" : [
39148 {
320429 "world" : {
321430 "name" : " meta.world-item.wit" ,
322431 "comment" : " Syntax for WIT like `world \" id\" {`" ,
323- "begin" : " ^\\ b(default\\ s+)?(world)\\ s+%?((?<![\\ -\\ w])([a-z][0-9a-z]*|[A-Z][0-9A-Z]*)(([\\ -])([a-z][0-9a-z]*|[A-Z][0-9A-Z]*))*)\\ s*(\\ {)" ,
432+ "begin" : " ^\\ s* \\ b(default\\ s+)?(world)\\ s+%?((?<![\\ -\\ w])([a-z][0-9a-z]*|[A-Z][0-9A-Z]*)(([\\ -])([a-z][0-9a-z]*|[A-Z][0-9A-Z]*))*)\\ s*(\\ {)" ,
324433 "beginCaptures" : {
325434 "1" : {
326435 "name" : " storage.modifier.default.world-item.wit"
339448 {
340449 "include" : " #comment"
341450 },
451+ {
452+ "include" : " #feature-gate"
453+ },
342454 {
343455 "name" : " meta.export-item.wit" ,
344456 "comment" : " Syntax for WIT like `export \" id\" `" ,
510622 "interface" : {
511623 "name" : " meta.interface-item.wit" ,
512624 "comment" : " Syntax for WIT like `interface \" id\" {`" ,
513- "begin" : " ^\\ b(default\\ s+)?(interface)\\ s+%?((?<![\\ -\\ w])([a-z][0-9a-z]*|[A-Z][0-9A-Z]*)(([\\ -])([a-z][0-9a-z]*|[A-Z][0-9A-Z]*))*)\\ s*(\\ {)" ,
625+ "begin" : " ^\\ s* \\ b(default\\ s+)?(interface)\\ s+%?((?<![\\ -\\ w])([a-z][0-9a-z]*|[A-Z][0-9A-Z]*)(([\\ -])([a-z][0-9a-z]*|[A-Z][0-9A-Z]*))*)\\ s*(\\ {)" ,
514626 "beginCaptures" : {
515627 "1" : {
516628 "name" : " storage.modifier.default.interface-item.wit"
529641 {
530642 "include" : " #comment"
531643 },
644+ {
645+ "include" : " #feature-gate"
646+ },
532647 {
533648 "include" : " #interface-items"
534649 },
592707 "interface-items" : {
593708 "name" : " meta.interface-items.wit" ,
594709 "patterns" : [
710+ {
711+ "include" : " #feature-gate"
712+ },
595713 {
596714 "include" : " #typedef-item"
597715 },
606724 "typedef-item" : {
607725 "name" : " meta.typedef-item.wit" ,
608726 "patterns" : [
727+ {
728+ "include" : " #feature-gate"
729+ },
609730 {
610731 "include" : " #resource"
611732 },
12451366 {
12461367 "include" : " #comment"
12471368 },
1369+ {
1370+ "include" : " #feature-gate"
1371+ },
12481372 {
12491373 "name" : " meta.constructor-type.wit" ,
12501374 "begin" : " \\ b(constructor)\\ b" ,
13071431 }
13081432 },
13091433 "patterns" : [
1434+ {
1435+ "include" : " #feature-gate"
1436+ },
13101437 {
13111438 "include" : " #function-definition"
13121439 },
14341561 }
14351562 }
14361563 }
1437- }
1564+ }
0 commit comments