1// SYNTAX TEST "source.slint" "Simple tmGrammar test"
2
3 // Some comment
4//^^^^^^^^^^^^^^^ comment.line.double-slash.slint
5
6 /* /* Test */ xyz
7// ^^^^^^^^^^^^^^^^^ comment.block.slint
8 */
9//^^^^^ comment.block.slint
10 /* /* Test */
11// ^^^^^^^^^^^ comment.block.slint
12 */
13//^^^^^ comment.block.slint
14 import{}from"std-widgets.slint";
15//^^^^^^ keyword.other.import.slint
16// ^^^^ keyword.other.from.slint
17// ^^^^^^^^^^^^^^^^^^^ string.quoted.double.import-path.slint
18 import { Button}from "std-widgets.slint" ;
19//^^^^^^ keyword.other.import.slint
20// ^^^^^^ entity.name.type.import-list.slint
21// ^^^^ keyword.other.from.slint
22// ^^^^^^^^^^^^^^^^^^^ string.quoted.double.import-path.slint
23 import { Button as Foo, AboutSlint }from "std-widgets.slint" ;
24//^^^^^^ keyword.other.import.slint
25// ^^^^^^ entity.name.type.import-list.slint
26// ^^ keyword.other.as.slint
27// ^^^ entity.name.type.import-list.slint
28// ^^^^^^^^^^ entity.name.type.import-list.slint
29// ^^^^ keyword.other.from.slint
30// ^^^^^^^^^^^^^^^^^^^ string.quoted.double.import-path.slint
31 import {
32//^^^^^^ keyword.other.import.slint
33 Button__ as Foo-- ,
34// ^^^^^^^^ entity.name.type.import-list.slint
35// ^^ keyword.other.as.slint
36// ^^^^^ entity.name.type.import-list.slint
37 AboutSlint
38// ^^^^^^^^^^ entity.name.type.import-list.slint
39 } from "std-widgets.slint" ;
40// ^^^^ keyword.other.from.slint
41// ^^^^^^^^^^^^^^^^^^^ string.quoted.double.import-path.slint
42
43 import "font.ttf";
44//^^^^^^ keyword.other.import.slint
45// ^^^^^^^^^^ string.quoted.double.import-file.slint
46 import "font.ttf" ;
47// ^^^^^^ keyword.other.import.slint
48// ^^^^^^^^^^ string.quoted.double.import-file.slint
49 import"font.ttf" ;
50// ^^^^^^ keyword.other.import.slint
51// ^^^^^^^^^^ string.quoted.double.import-file.slint
52
53 export { Foo as Bar-Ista, AboutSlint }
54//^^^^^^ keyword.other.export.slint
55// ^^^ entity.name.type.export-list.slint
56// ^^ keyword.other.as.slint
57// ^^^^^^^^ entity.name.type.export-list.slint
58// ^^^^^^^^^^ entity.name.type.export-list.slint
59 export {Foo as Bar-Ista,AboutSlint}
60//^^^^^^ keyword.other.export.slint
61// ^^^ entity.name.type.export-list.slint
62// ^^ keyword.other.as.slint
63// ^^^^^^^^ entity.name.type.export-list.slint
64// ^^^^^^^^^^ entity.name.type.export-list.slint
65 struct Foobar { }
66//^^^^^^ keyword.declaration.struct.slint
67// ^^^^^^ entity.name.type.struct.slint
68 struct Foobar { test: bat}
69//^^^^^^ keyword.declaration.struct.slint
70// ^^^^^^ entity.name.type.struct.slint
71// ^^^^ variable.other.struct.field.slint
72// ^^^ entity.name.type.struct.field.slint
73 export struct Foobar {
74//^^^^^^ keyword.other.export.slint
75// ^^^^^^ keyword.declaration.struct.slint
76// ^^^^^^ entity.name.type.struct.slint
77 test : bat , // test
78// ^^^^ variable.other.struct.field.slint
79// ^^^ entity.name.type.struct.field.slint
80// ^^^^^^^^ comment.line.double-slash.slint
81 foo: bar
82// ^^^ variable.other.struct.field.slint
83// ^^^ entity.name.type.struct.field.slint
84 }
85
86 enum Foobar { }
87//^^^^ keyword.declaration.enum.slint
88// ^^^^^^ entity.name.type.enum.slint
89 enum Foobar { enum1, enum2 , enum3}
90//^^^^ keyword.declaration.enum.slint
91// ^^^^^^ entity.name.type.enum.slint
92// ^^^^^ entity.name.type.enum.value.slint
93// ^^^^^ entity.name.type.enum.value.slint
94// ^^^^^ entity.name.type.enum.value.slint
95 enum Foobar { enum1, enum2 , enum3 ,}
96//^^^^ keyword.declaration.enum.slint
97// ^^^^^^ entity.name.type.enum.slint
98// ^^^^^ entity.name.type.enum.value.slint
99// ^^^^^ entity.name.type.enum.value.slint
100// ^^^^^ entity.name.type.enum.value.slint
101 export enum Foobar {
102//^^^^^^ keyword.other.export.slint
103// ^^^^ keyword.declaration.enum.slint
104// ^^^^^^ entity.name.type.enum.slint
105
106 foo-bar , // test
107// ^^^^^^^ entity.name.type.enum.value.slint
108// ^^^^^^^ comment.line.double-slash.slint
109 }
110
111 export global b {}
112//^^^^^^ keyword.other.export.slint
113// ^^^^^^ keyword.other.global.slint
114// ^ entity.name.type.global.slint
115
116 component b {}
117//^^^^^^^^^ keyword.other.component.slint
118// ^ entity.name.type.component.slint
119 component b inherits B_----____ay {}
120//^^^^^^^^^ keyword.other.component.slint
121// ^ entity.name.type.component.slint
122// ^^^^^^^^ keyword.other.inherits.slint
123// ^^^^^^^^^^^ entity.other.inherited-class.component.slint
124 export component b {}
125//^^^^^^ keyword.other.export.slint
126// ^^^^^^^^^ keyword.other.component.slint
127// ^ entity.name.type.component.slint
128 export component b inherits B_----____ay {}
129//^^^^^^ keyword.other.export.slint
130// ^^^^^^^^^ keyword.other.component.slint
131// ^ entity.name.type.component.slint
132// ^^^^^^^^ keyword.other.inherits.slint
133// ^^^^^^^^^^^ entity.other.inherited-class.component.slint
134 export
135//^^^^^^ keyword.other.export.slint
136 component b inherits B_----____ay {
137//^^^^^^^^^ keyword.other.component.slint
138// ^ entity.name.type.component.slint
139// ^^^^^^^^ keyword.other.inherits.slint
140// ^^^^^^^^^^^ entity.other.inherited-class.component.slint
141
142 // comments work here!
143// ^^^^^^^^^^^^^^^^^^^^^^ comment.line.double-slash.slint
144
145 property <color> bar ;
146// ^^^^^^^^ keyword.other.property.slint
147// ^^^^^ entity.name.type.property.slint
148// ^^^ variable.other.property.slint
149 property<color>bar ;
150// ^^^^^^^^ keyword.other.property.slint
151// ^^^^^ entity.name.type.property.slint
152// ^^^ variable.other.property.slint
153 property <color> bar <=> root.baz-feed;
154// ^^^^^^^^ keyword.other.property.slint
155// ^^^^^ entity.name.type.property.slint
156// ^^^ variable.other.property.slint
157// ^^^^ variable.language.special-element.slint
158 /* test */ property <int> foo;
159// ^^^^^^^^^^ comment.block.slint
160// ^^^^^^^^ keyword.other.property.slint
161// ^^^ entity.name.type.property.slint
162// ^^^ variable.other.property.slint
163 in property <color> bar: Colors.aquamarine ;
164// ^^ keyword.other.visibility.slint
165// ^^^^^^^^ keyword.other.property.slint
166// ^^^^^ entity.name.type.property.slint
167// ^^^ variable.other.property.slint
168// ^^^^^^ support.class.colors.slint
169// ^^^^^^^^^^ support.constant.colors.slint
170 out property <color> bar: Colors.aquamarine ;
171// ^^^ keyword.other.visibility.slint
172// ^^^^^^^^ keyword.other.property.slint
173// ^^^^^ entity.name.type.property.slint
174// ^^^ variable.other.property.slint
175// ^^^^^^ support.class.colors.slint
176// ^^^^^^^^^^ support.constant.colors.slint
177 in-out property <color> bar: Colors.aquamarine ;
178// ^^^^^^ keyword.other.visibility.slint
179// ^^^^^^^^ keyword.other.property.slint
180// ^^^^^ entity.name.type.property.slint
181// ^^^ variable.other.property.slint
182// ^^^^^^ support.class.colors.slint
183// ^^^^^^^^^^ support.constant.colors.slint
184 private property <color> bar: Colors.aquamarine ;
185// ^^^^^^^ keyword.other.visibility.slint
186// ^^^^^^^^ keyword.other.property.slint
187// ^^^^^ entity.name.type.property.slint
188// ^^^ variable.other.property.slint
189// ^^^^^^ support.class.colors.slint
190// ^^^^^^^^^^ support.constant.colors.slint
191 property <color> bar: #ff00ff00 ;
192// ^^^^^^^^ keyword.other.property.slint
193// ^^^^^ entity.name.type.property.slint
194// ^^^ variable.other.property.slint
195// ^^^^^^^^^ constant.other.color.slint
196 property <color> bar: -5px;
197// ^^^^^^^^ keyword.other.property.slint
198// ^^^^^ entity.name.type.property.slint
199// ^^^ variable.other.property.slint
200// ^^^^ constant.numeric.slint
201 property <color> bar:+5% ;
202// ^^^^^^^^ keyword.other.property.slint
203// ^^^^^ entity.name.type.property.slint
204// ^^^ variable.other.property.slint
205// ^^^ constant.numeric.slint
206 property <color> bar:5rem; // Foobar
207// ^^^^^^^^ keyword.other.property.slint
208// ^^^^^ entity.name.type.property.slint
209// ^^^ variable.other.property.slint
210// ^^^^ constant.numeric.slint
211// ^^^^^^^^^^ comment.line.double-slash.slint
212
213 callback foo;
214//^^^^^^^^ keyword.other.function.slint
215// ^^^ entity.name.function.slint
216 callback foo-bar();
217//^^^^^^^^ keyword.other.function.slint
218// ^^^^^^^ entity.name.function.slint
219 callback foo-bar() -> return-type;
220//^^^^^^^^ keyword.other.function.slint
221// ^^^^^^^ entity.name.function.slint
222 ^^^^^^^^^^^ entity.name.type.return-type.slint
223 callback foo-bar(name: type) -> return-type;
224//^^^^^^^^ keyword.other.function.slint
225// ^^^^^^^ entity.name.function.slint
226// ^^^^ variable.parameter.function-argument.slint
227// ^^^^ entity.name.type.function-argument.slint
228 ^^^^^^^^^^^ storage.type
229 callback foo-bar(name: type, second: type2) -> return-type;
230//^^^^^^^^ keyword.other.function.slint
231// ^^^^^^^ entity.name.function.slint
232// ^^^^ variable.parameter.function-argument.slint
233// ^^^^ entity.name.type.function-argument.slint
234// ^^^^^^ variable.parameter.function-argument.slint
235// ^^^^^ entity.name.type.function-argument.slint
236 pure callback foo;
237//^^^^ keyword.other.pure.slint
238// ^^^^^^^^ keyword.other.function.slint
239// ^^^ entity.name.function.slint
240 pure callback foo-bar ();
241//^^^^ keyword.other.pure.slint
242// ^^^^^^^^ keyword.other.function.slint
243// ^^^^^^^ entity.name.function.slint
244 pure callback foo-bar ( ) -> return-type;
245//^^^^ keyword.other.pure.slint
246// ^^^^^^^^ keyword.other.function.slint
247// ^^^^^^^ entity.name.function.slint
248 ^^^^^^^^^^^ storage.type
249 pure callback foo-bar ( name: type) -> return-type;
250//^^^^ keyword.other.pure.slint
251// ^^^^^^^^ keyword.other.function.slint
252// ^^^^^^^ entity.name.function.slint
253// ^^^^ variable.parameter.function-argument.slint
254// ^^^^ entity.name.type.function-argument.slint
255// ^^^^^^^^^^^ entity.name.type.return-type.slint
256 pure callback foo-bar ( name: type, second: type2) -> return-type;
257//^^^^ keyword.other.pure.slint
258// ^^^^^^^^ keyword.other.function.slint
259// ^^^^^^^ entity.name.function.slint
260// ^^^^ variable.parameter.function-argument.slint
261// ^^^^ entity.name.type.function-argument.slint
262// ^^^^^^ variable.parameter.function-argument.slint
263// ^^^^^ entity.name.type.function-argument.slint
264// ^^^^^^^^^^^ entity.name.type.return-type.slint
265
266 function foobar(name: type, second) -> boolean {
267//^^^^^^^^ keyword.other.function.slint
268// ^^^^^^ entity.name.function.slint
269// ^^^^ variable.parameter.function-argument.slint
270// ^^^^ entity.name.type.function-argument.slint
271// ^^^^^^ entity.name.type.function-argument.slint
272// ^^^^^^^ entity.name.type.return-type.slint
273 }
274
275 Element {
276// ^^^^^^^ entity.name.type.element.slint
277
278 }
279 element-id:=Element{
280// ^^^^^^^^^^ entity.name.tag.element-id.slint
281// ^^^^^^^ entity.name.type.element.slint
282
283 }
284
285 if true : Something {
286// ^^ keyword.control.conditional-element.slint
287// ^^^^^^^^^ entity.name.type.element.slint
288 foobar: 32;
289// ^^^^^^ variable.other.property.slint
290// ^^ constant.numeric.slint
291 }
292 for var [ i ] in something:Loop {
293// ^^^ keyword.control.repeated-element.slint
294// ^^^ variable.other.iterator.slint
295// ^ variable.other.index.slint
296// ^^ keyword.control.in.slint
297// ^^^^ entity.name.type.element.slint
298 }
299 for var in something:Loop {
300// ^^^ keyword.control.repeated-element.slint
301// ^^^ variable.other.iterator.slint
302// ^^ keyword.control.in.slint
303// ^^^^ entity.name.type.element.slint
304 }
305 }
306