Commit 7eccea5c7d45d9039b576c28e2714bd4c843b9d3

Michael Schmidt 2019-01-22T00:49:40

Improve C language (#1697) This PR adds support for [hexadecimal floating-point literals](http://www.cplusplus.com/doc/tutorial/structures/), and [`enum`](https://www.geeksforgeeks.org/enumeration-enum-c/) and [`struct`](https://www.tutorialspoint.com/cprogramming/c_structures.htm) class names.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
diff --git a/components/prism-c.js b/components/prism-c.js
index ea2452d..faa6c49 100644
--- a/components/prism-c.js
+++ b/components/prism-c.js
@@ -1,7 +1,11 @@
 Prism.languages.c = Prism.languages.extend('clike', {
+	'class-name': {
+		pattern: /(\b(?:enum|struct)\s+)\w+/,
+		lookbehind: true
+	},
 	'keyword': /\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,
 	'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/,
-	'number': /(?:\b0x[\da-f]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i
+	'number': /(?:\b0x(?:[\da-f]+\.?[\da-f]*|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i
 });
 
 Prism.languages.insertBefore('c', 'string', {
@@ -29,5 +33,4 @@ Prism.languages.insertBefore('c', 'string', {
 	'constant': /\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/
 });
 
-delete Prism.languages.c['class-name'];
 delete Prism.languages.c['boolean'];
diff --git a/components/prism-c.min.js b/components/prism-c.min.js
index 78b49c9..2516c04 100644
--- a/components/prism-c.min.js
+++ b/components/prism-c.min.js
@@ -1 +1 @@
-Prism.languages.c=Prism.languages.extend("clike",{keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*\/%&|^!=<>]=?/,number:/(?:\b0x[\da-f]+|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i}),Prism.languages.insertBefore("c","string",{macro:{pattern:/(^\s*)#\s*[a-z]+(?:[^\r\n\\]|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,alias:"property",inside:{string:{pattern:/(#\s*include\s*)(?:<.+?>|("|')(?:\\?.)+?\2)/,lookbehind:!0},directive:{pattern:/(#\s*)\b(?:define|defined|elif|else|endif|error|ifdef|ifndef|if|import|include|line|pragma|undef|using)\b/,lookbehind:!0,alias:"keyword"}}},constant:/\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/}),delete Prism.languages.c["class-name"],delete Prism.languages.c["boolean"];
\ No newline at end of file
+Prism.languages.c=Prism.languages.extend("clike",{"class-name":{pattern:/(\b(?:enum|struct)\s+)\w+/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*\/%&|^!=<>]=?/,number:/(?:\b0x(?:[\da-f]+\.?[\da-f]*|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?)[ful]*/i}),Prism.languages.insertBefore("c","string",{macro:{pattern:/(^\s*)#\s*[a-z]+(?:[^\r\n\\]|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,alias:"property",inside:{string:{pattern:/(#\s*include\s*)(?:<.+?>|("|')(?:\\?.)+?\2)/,lookbehind:!0},directive:{pattern:/(#\s*)\b(?:define|defined|elif|else|endif|error|ifdef|ifndef|if|import|include|line|pragma|undef|using)\b/,lookbehind:!0,alias:"keyword"}}},constant:/\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/}),delete Prism.languages.c["boolean"];
\ No newline at end of file
diff --git a/components/prism-cpp.js b/components/prism-cpp.js
index 3d66ba2..ba709be 100644
--- a/components/prism-cpp.js
+++ b/components/prism-cpp.js
@@ -1,16 +1,13 @@
 Prism.languages.cpp = Prism.languages.extend('c', {
+	'class-name': {
+		pattern: /(\b(?:class|enum|struct)\s+)\w+/,
+		lookbehind: true
+	},
 	'keyword': /\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,
 	'boolean': /\b(?:true|false)\b/,
 	'operator': />>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/
 });
 
-Prism.languages.insertBefore('cpp', 'keyword', {
-	'class-name': {
-		pattern: /(class\s+)\w+/i,
-		lookbehind: true
-	}
-});
-
 Prism.languages.insertBefore('cpp', 'string', {
 	'raw-string': {
 		pattern: /R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,
diff --git a/components/prism-cpp.min.js b/components/prism-cpp.min.js
index c0c6a00..3b7a981 100644
--- a/components/prism-cpp.min.js
+++ b/components/prism-cpp.min.js
@@ -1 +1 @@
-Prism.languages.cpp=Prism.languages.extend("c",{keyword:/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,"boolean":/\b(?:true|false)\b/,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*\/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/}),Prism.languages.insertBefore("cpp","keyword",{"class-name":{pattern:/(class\s+)\w+/i,lookbehind:!0}}),Prism.languages.insertBefore("cpp","string",{"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}});
\ No newline at end of file
+Prism.languages.cpp=Prism.languages.extend("c",{"class-name":{pattern:/(\b(?:class|enum|struct)\s+)\w+/,lookbehind:!0},keyword:/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|class|compl|const|constexpr|const_cast|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|float|for|friend|goto|if|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|mutable|namespace|new|noexcept|nullptr|operator|private|protected|public|register|reinterpret_cast|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,"boolean":/\b(?:true|false)\b/,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*\/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/}),Prism.languages.insertBefore("cpp","string",{"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}});
\ No newline at end of file
diff --git a/components/prism-objectivec.js b/components/prism-objectivec.js
index a9cf698..b2ccb87 100644
--- a/components/prism-objectivec.js
+++ b/components/prism-objectivec.js
@@ -3,3 +3,5 @@ Prism.languages.objectivec = Prism.languages.extend('c', {
 	'string': /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|@"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,
 	'operator': /-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/
 });
+
+delete Prism.languages.objectivec['class-name'];
diff --git a/components/prism-objectivec.min.js b/components/prism-objectivec.min.js
index 4805fc9..d80cfb3 100644
--- a/components/prism-objectivec.min.js
+++ b/components/prism-objectivec.min.js
@@ -1 +1 @@
-Prism.languages.objectivec=Prism.languages.extend("c",{keyword:/\b(?:asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while|in|self|super)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,string:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|@"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/});
\ No newline at end of file
+Prism.languages.objectivec=Prism.languages.extend("c",{keyword:/\b(?:asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while|in|self|super)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,string:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1|@"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,operator:/-[->]?|\+\+?|!=?|<<?=?|>>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete Prism.languages.objectivec["class-name"];
\ No newline at end of file
diff --git a/tests/languages/c/class-name_feature.test b/tests/languages/c/class-name_feature.test
new file mode 100644
index 0000000..356fd0f
--- /dev/null
+++ b/tests/languages/c/class-name_feature.test
@@ -0,0 +1,17 @@
+struct foo
+enum bar
+
+struct foo var;
+
+----------------------------------------------------
+
+[
+	["keyword", "struct"], ["class-name", "foo"],
+	["keyword", "enum"], ["class-name", "bar"],
+
+	["keyword", "struct"], ["class-name", "foo"], " var", ["punctuation", ";"]
+]
+
+----------------------------------------------------
+
+Checks for structs and enums.
diff --git a/tests/languages/c/keyword_feature.test b/tests/languages/c/keyword_feature.test
index feb9ff9..29077e8 100644
--- a/tests/languages/c/keyword_feature.test
+++ b/tests/languages/c/keyword_feature.test
@@ -3,27 +3,31 @@ _Complex _Generic _Imaginary
 _Noreturn _Static_assert _Thread_local
 asm typeof inline auto break
 case char const continue default
-do double else enum extern
+do double else enum;
+extern
 float for goto if int
 long register return short signed
-sizeof static struct switch typedef
+sizeof static struct;
+switch typedef
 union unsigned void volatile while
 
 ----------------------------------------------------
 
 [
 	["keyword", "_Alignas"], ["keyword", "_Alignof"], ["keyword", "_Atomic"], ["keyword", "_Bool"],
-    ["keyword", "_Complex"], ["keyword", "_Generic"], ["keyword", "_Imaginary"],
-    ["keyword", "_Noreturn"], ["keyword", "_Static_assert"], ["keyword", "_Thread_local"],
+	["keyword", "_Complex"], ["keyword", "_Generic"], ["keyword", "_Imaginary"],
+	["keyword", "_Noreturn"], ["keyword", "_Static_assert"], ["keyword", "_Thread_local"],
 	["keyword", "asm"], ["keyword", "typeof"], ["keyword", "inline"], ["keyword", "auto"], ["keyword", "break"],
 	["keyword", "case"], ["keyword", "char"], ["keyword", "const"], ["keyword", "continue"], ["keyword", "default"],
-	["keyword", "do"], ["keyword", "double"], ["keyword", "else"], ["keyword", "enum"], ["keyword", "extern"],
+	["keyword", "do"], ["keyword", "double"], ["keyword", "else"], ["keyword", "enum"], ["punctuation", ";"],
+	["keyword", "extern"],
 	["keyword", "float"], ["keyword", "for"], ["keyword", "goto"], ["keyword", "if"], ["keyword", "int"],
 	["keyword", "long"], ["keyword", "register"], ["keyword", "return"], ["keyword", "short"], ["keyword", "signed"],
-	["keyword", "sizeof"], ["keyword", "static"], ["keyword", "struct"], ["keyword", "switch"], ["keyword", "typedef"],
+	["keyword", "sizeof"], ["keyword", "static"], ["keyword", "struct"], ["punctuation", ";"],
+	["keyword", "switch"], ["keyword", "typedef"],
 	["keyword", "union"], ["keyword", "unsigned"], ["keyword", "void"], ["keyword", "volatile"], ["keyword", "while"]
 ]
 
 ----------------------------------------------------
 
-Checks for all keywords.
\ No newline at end of file
+Checks for all keywords.
diff --git a/tests/languages/c/number_feature.test b/tests/languages/c/number_feature.test
index 0542683..c297587 100644
--- a/tests/languages/c/number_feature.test
+++ b/tests/languages/c/number_feature.test
@@ -5,6 +5,9 @@
 0.4e+2
 0xbabe
 0xBABE
+0x1.2
+0x0.3p-3
+0x0.3p4L
 42f
 42F
 42u
@@ -22,6 +25,9 @@
 	["number", "0.4e+2"],
 	["number", "0xbabe"],
 	["number", "0xBABE"],
+	["number", "0x1.2"],
+	["number", "0x0.3p-3"],
+	["number", "0x0.3p4L"],
 	["number", "42f"],
 	["number", "42F"],
 	["number", "42u"],
@@ -32,4 +38,4 @@
 
 ----------------------------------------------------
 
-Checks for decimal numbers and hexadecimal numbers.
\ No newline at end of file
+Checks for decimal numbers and hexadecimal numbers.
diff --git a/tests/languages/cpp/class-name_feature.test b/tests/languages/cpp/class-name_feature.test
index f3d5df5..e61733c 100644
--- a/tests/languages/cpp/class-name_feature.test
+++ b/tests/languages/cpp/class-name_feature.test
@@ -1,13 +1,17 @@
 class Foo
 class Foo_bar
+struct foo
+enum bar
 
 ----------------------------------------------------
 
 [
 	["keyword", "class"], ["class-name", "Foo"],
-	["keyword", "class"], ["class-name", "Foo_bar"]
+	["keyword", "class"], ["class-name", "Foo_bar"],
+	["keyword", "struct"], ["class-name", "foo"],
+	["keyword", "enum"], ["class-name", "bar"]
 ]
 
 ----------------------------------------------------
 
-Checks for class names.
\ No newline at end of file
+Checks for class names.
diff --git a/tests/languages/cpp/keyword_feature.test b/tests/languages/cpp/keyword_feature.test
index 180f68e..b782149 100644
--- a/tests/languages/cpp/keyword_feature.test
+++ b/tests/languages/cpp/keyword_feature.test
@@ -4,14 +4,16 @@ class;
 compl const constexpr
 const_cast continue decltype default
 delete do double dynamic_cast
-else enum explicit export extern
+else enum;
+explicit export extern
 float for friend goto if
 inline int long mutable namespace
 new noexcept nullptr operator
 private protected public register
 reinterpret_cast return short
 signed sizeof static static_assert
-static_cast struct switch template
+static_cast struct;
+switch template
 this thread_local throw try
 typedef typeid typename union
 unsigned using virtual void
@@ -28,14 +30,16 @@ uint8_t uint16_t uint32_t uint64_t
 	["keyword", "compl"], ["keyword", "const"], ["keyword", "constexpr"],
 	["keyword", "const_cast"], ["keyword", "continue"], ["keyword", "decltype"], ["keyword", "default"],
 	["keyword", "delete"], ["keyword", "do"], ["keyword", "double"], ["keyword", "dynamic_cast"],
-	["keyword", "else"], ["keyword", "enum"], ["keyword", "explicit"], ["keyword", "export"], ["keyword", "extern"],
+	["keyword", "else"], ["keyword", "enum"], ["punctuation", ";"],
+	["keyword", "explicit"], ["keyword", "export"], ["keyword", "extern"],
 	["keyword", "float"], ["keyword", "for"], ["keyword", "friend"], ["keyword", "goto"], ["keyword", "if"],
 	["keyword", "inline"], ["keyword", "int"], ["keyword", "long"], ["keyword", "mutable"], ["keyword", "namespace"],
 	["keyword", "new"], ["keyword", "noexcept"], ["keyword", "nullptr"], ["keyword", "operator"],
 	["keyword", "private"], ["keyword", "protected"], ["keyword", "public"], ["keyword", "register"],
 	["keyword", "reinterpret_cast"], ["keyword", "return"], ["keyword", "short"],
 	["keyword", "signed"], ["keyword", "sizeof"], ["keyword", "static"], ["keyword", "static_assert"],
-	["keyword", "static_cast"], ["keyword", "struct"], ["keyword", "switch"], ["keyword", "template"],
+	["keyword", "static_cast"], ["keyword", "struct"], ["punctuation", ";"],
+	["keyword", "switch"], ["keyword", "template"],
 	["keyword", "this"], ["keyword", "thread_local"], ["keyword", "throw"], ["keyword", "try"],
 	["keyword", "typedef"], ["keyword", "typeid"], ["keyword", "typename"], ["keyword", "union"],
 	["keyword", "unsigned"], ["keyword", "using"], ["keyword", "virtual"], ["keyword", "void"],
@@ -46,4 +50,4 @@ uint8_t uint16_t uint32_t uint64_t
 
 ----------------------------------------------------
 
-Checks for all keywords
\ No newline at end of file
+Checks for all keywords.
diff --git a/tests/languages/opencl/keyword_feature.test b/tests/languages/opencl/keyword_feature.test
index 47613f7..b171c05 100644
--- a/tests/languages/opencl/keyword_feature.test
+++ b/tests/languages/opencl/keyword_feature.test
@@ -71,7 +71,7 @@ double8x2
 double8x4
 double8x8
 else
-enum
+enum;
 event_t
 extern
 float
@@ -168,7 +168,7 @@ short4
 short8
 size_t
 static
-struct
+struct;
 switch
 typedef
 uchar
@@ -202,218 +202,218 @@ ushort8
 void
 volatile
 while
-write_only
-
-----------------------------------------------------
-
-[
-	["keyword", "__attribute__"],
-	["keyword", "__constant"],
-	["keyword", "__global"],
-	["keyword", "__kernel"],
-	["keyword", "__local"],
-	["keyword", "__private"],
-	["keyword", "__read_only"],
-	["keyword", "__read_write"],
-	["keyword", "__write_only"],
-	["keyword", "_cl_command_queue"],
-	["keyword", "_cl_context"],
-	["keyword", "_cl_device_id"],
-	["keyword", "_cl_event"],
-	["keyword", "_cl_kernel"],
-	["keyword", "_cl_mem"],
-	["keyword", "_cl_platform_id"],
-	["keyword", "_cl_program"],
-	["keyword", "_cl_sampler"],
-	["keyword", "auto"],
-	["keyword", "bool"],
-	["keyword", "bool16"],
-	["keyword", "bool2"],
-	["keyword", "bool3"],
-	["keyword", "bool4"],
-	["keyword", "bool8"],
-	["keyword", "break"],
-	["keyword", "case"],
-	["keyword", "char"],
-	["keyword", "char16"],
-	["keyword", "char2"],
-	["keyword", "char3"],
-	["keyword", "char4"],
-	["keyword", "char8"],
-	["keyword", "cl_image_format"],
-	["keyword", "cl_mem_fence_flags"],
-	["keyword", "clk_event_t"],
-	["keyword", "complex"],
-	["keyword", "const"],
-	["keyword", "constant"],
-	["keyword", "continue"],
-	["keyword", "do"],
-	["keyword", "double"],
-	["keyword", "double16"],
-	["keyword", "double16x1"],
-	["keyword", "double16x16"],
-	["keyword", "double16x2"],
-	["keyword", "double16x4"],
-	["keyword", "double16x8"],
-	["keyword", "double1x1"],
-	["keyword", "double1x16"],
-	["keyword", "double1x2"],
-	["keyword", "double1x4"],
-	["keyword", "double1x8"],
-	["keyword", "double2"],
-	["keyword", "double2x1"],
-	["keyword", "double2x16"],
-	["keyword", "double2x2"],
-	["keyword", "double2x4"],
-	["keyword", "double2x8"],
-	["keyword", "double3"],
-	["keyword", "double4"],
-	["keyword", "double4x1"],
-	["keyword", "double4x16"],
-	["keyword", "double4x2"],
-	["keyword", "double4x4"],
-	["keyword", "double4x8"],
-	["keyword", "double8"],
-	["keyword", "double8x1"],
-	["keyword", "double8x16"],
-	["keyword", "double8x2"],
-	["keyword", "double8x4"],
-	["keyword", "double8x8"],
-	["keyword", "else"],
-	["keyword", "enum"],
-	["keyword", "event_t"],
-	["keyword", "extern"],
-	["keyword", "float"],
-	["keyword", "float16"],
-	["keyword", "float16x1"],
-	["keyword", "float16x16"],
-	["keyword", "float16x2"],
-	["keyword", "float16x4"],
-	["keyword", "float16x8"],
-	["keyword", "float1x1"],
-	["keyword", "float1x16"],
-	["keyword", "float1x2"],
-	["keyword", "float1x4"],
-	["keyword", "float1x8"],
-	["keyword", "float2"],
-	["keyword", "float2x1"],
-	["keyword", "float2x16"],
-	["keyword", "float2x2"],
-	["keyword", "float2x4"],
-	["keyword", "float2x8"],
-	["keyword", "float3"],
-	["keyword", "float4"],
-	["keyword", "float4x1"],
-	["keyword", "float4x16"],
-	["keyword", "float4x2"],
-	["keyword", "float4x4"],
-	["keyword", "float4x8"],
-	["keyword", "float8"],
-	["keyword", "float8x1"],
-	["keyword", "float8x16"],
-	["keyword", "float8x2"],
-	["keyword", "float8x4"],
-	["keyword", "float8x8"],
-	["keyword", "for"],
-	["keyword", "global"],
-	["keyword", "half"],
-	["keyword", "half16"],
-	["keyword", "half2"],
-	["keyword", "half3"],
-	["keyword", "half4"],
-	["keyword", "half8"],
-	["keyword", "if"],
-	["keyword", "image1d_array_t"],
-	["keyword", "image1d_buffer_t"],
-	["keyword", "image1d_t"],
-	["keyword", "image2d_array_depth_t"],
-	["keyword", "image2d_array_msaa_depth_t"],
-	["keyword", "image2d_array_msaa_t"],
-	["keyword", "image2d_array_t"],
-	["keyword", "image2d_depth_t"],
-	["keyword", "image2d_msaa_depth_t"],
-	["keyword", "image2d_msaa_t"],
-	["keyword", "image2d_t"],
-	["keyword", "image3d_t"],
-	["keyword", "imaginary"],
-	["keyword", "int"],
-	["keyword", "int16"],
-	["keyword", "int2"],
-	["keyword", "int3"],
-	["keyword", "int4"],
-	["keyword", "int8"],
-	["keyword", "intptr_t"],
-	["keyword", "kernel"],
-	["keyword", "local"],
-	["keyword", "long"],
-	["keyword", "long16"],
-	["keyword", "long2"],
-	["keyword", "long3"],
-	["keyword", "long4"],
-	["keyword", "long8"],
-	["keyword", "ndrange_t"],
-	["keyword", "packed"],
-	["keyword", "pipe"],
-	["keyword", "private"],
-	["keyword", "ptrdiff_t"],
-	["keyword", "quad"],
-	["keyword", "quad16"],
-	["keyword", "quad2"],
-	["keyword", "quad3"],
-	["keyword", "quad4"],
-	["keyword", "quad8"],
-	["keyword", "queue_t"],
-	["keyword", "read_only"],
-	["keyword", "read_write"],
-	["keyword", "register"],
-	["keyword", "reserve_id_t"],
-	["keyword", "restrict"],
-	["keyword", "sampler_t"],
-	["keyword", "short"],
-	["keyword", "short16"],
-	["keyword", "short2"],
-	["keyword", "short3"],
-	["keyword", "short4"],
-	["keyword", "short8"],
-	["keyword", "size_t"],
-	["keyword", "static"],
-	["keyword", "struct"],
-	["keyword", "switch"],
-	["keyword", "typedef"],
-	["keyword", "uchar"],
-	["keyword", "uchar16"],
-	["keyword", "uchar2"],
-	["keyword", "uchar3"],
-	["keyword", "uchar4"],
-	["keyword", "uchar8"],
-	["keyword", "uint"],
-	["keyword", "uint16"],
-	["keyword", "uint2"],
-	["keyword", "uint3"],
-	["keyword", "uint4"],
-	["keyword", "uint8"],
-	["keyword", "uintptr_t"],
-	["keyword", "ulong"],
-	["keyword", "ulong16"],
-	["keyword", "ulong2"],
-	["keyword", "ulong3"],
-	["keyword", "ulong4"],
-	["keyword", "ulong8"],
-	["keyword", "uniform"],
-	["keyword", "union"],
-	["keyword", "unsigned"],
-	["keyword", "ushort"],
-	["keyword", "ushort16"],
-	["keyword", "ushort2"],
-	["keyword", "ushort3"],
-	["keyword", "ushort4"],
-	["keyword", "ushort8"],
-	["keyword", "void"],
-	["keyword", "volatile"],
-	["keyword", "while"],
-	["keyword", "write_only"]
-]
-
-----------------------------------------------------
-
-Checks for all keywords in OpenCL kernel code.
\ No newline at end of file
+write_only
+
+----------------------------------------------------
+
+[
+	["keyword", "__attribute__"],
+	["keyword", "__constant"],
+	["keyword", "__global"],
+	["keyword", "__kernel"],
+	["keyword", "__local"],
+	["keyword", "__private"],
+	["keyword", "__read_only"],
+	["keyword", "__read_write"],
+	["keyword", "__write_only"],
+	["keyword", "_cl_command_queue"],
+	["keyword", "_cl_context"],
+	["keyword", "_cl_device_id"],
+	["keyword", "_cl_event"],
+	["keyword", "_cl_kernel"],
+	["keyword", "_cl_mem"],
+	["keyword", "_cl_platform_id"],
+	["keyword", "_cl_program"],
+	["keyword", "_cl_sampler"],
+	["keyword", "auto"],
+	["keyword", "bool"],
+	["keyword", "bool16"],
+	["keyword", "bool2"],
+	["keyword", "bool3"],
+	["keyword", "bool4"],
+	["keyword", "bool8"],
+	["keyword", "break"],
+	["keyword", "case"],
+	["keyword", "char"],
+	["keyword", "char16"],
+	["keyword", "char2"],
+	["keyword", "char3"],
+	["keyword", "char4"],
+	["keyword", "char8"],
+	["keyword", "cl_image_format"],
+	["keyword", "cl_mem_fence_flags"],
+	["keyword", "clk_event_t"],
+	["keyword", "complex"],
+	["keyword", "const"],
+	["keyword", "constant"],
+	["keyword", "continue"],
+	["keyword", "do"],
+	["keyword", "double"],
+	["keyword", "double16"],
+	["keyword", "double16x1"],
+	["keyword", "double16x16"],
+	["keyword", "double16x2"],
+	["keyword", "double16x4"],
+	["keyword", "double16x8"],
+	["keyword", "double1x1"],
+	["keyword", "double1x16"],
+	["keyword", "double1x2"],
+	["keyword", "double1x4"],
+	["keyword", "double1x8"],
+	["keyword", "double2"],
+	["keyword", "double2x1"],
+	["keyword", "double2x16"],
+	["keyword", "double2x2"],
+	["keyword", "double2x4"],
+	["keyword", "double2x8"],
+	["keyword", "double3"],
+	["keyword", "double4"],
+	["keyword", "double4x1"],
+	["keyword", "double4x16"],
+	["keyword", "double4x2"],
+	["keyword", "double4x4"],
+	["keyword", "double4x8"],
+	["keyword", "double8"],
+	["keyword", "double8x1"],
+	["keyword", "double8x16"],
+	["keyword", "double8x2"],
+	["keyword", "double8x4"],
+	["keyword", "double8x8"],
+	["keyword", "else"],
+	["keyword", "enum"], ["punctuation", ";"],
+	["keyword", "event_t"],
+	["keyword", "extern"],
+	["keyword", "float"],
+	["keyword", "float16"],
+	["keyword", "float16x1"],
+	["keyword", "float16x16"],
+	["keyword", "float16x2"],
+	["keyword", "float16x4"],
+	["keyword", "float16x8"],
+	["keyword", "float1x1"],
+	["keyword", "float1x16"],
+	["keyword", "float1x2"],
+	["keyword", "float1x4"],
+	["keyword", "float1x8"],
+	["keyword", "float2"],
+	["keyword", "float2x1"],
+	["keyword", "float2x16"],
+	["keyword", "float2x2"],
+	["keyword", "float2x4"],
+	["keyword", "float2x8"],
+	["keyword", "float3"],
+	["keyword", "float4"],
+	["keyword", "float4x1"],
+	["keyword", "float4x16"],
+	["keyword", "float4x2"],
+	["keyword", "float4x4"],
+	["keyword", "float4x8"],
+	["keyword", "float8"],
+	["keyword", "float8x1"],
+	["keyword", "float8x16"],
+	["keyword", "float8x2"],
+	["keyword", "float8x4"],
+	["keyword", "float8x8"],
+	["keyword", "for"],
+	["keyword", "global"],
+	["keyword", "half"],
+	["keyword", "half16"],
+	["keyword", "half2"],
+	["keyword", "half3"],
+	["keyword", "half4"],
+	["keyword", "half8"],
+	["keyword", "if"],
+	["keyword", "image1d_array_t"],
+	["keyword", "image1d_buffer_t"],
+	["keyword", "image1d_t"],
+	["keyword", "image2d_array_depth_t"],
+	["keyword", "image2d_array_msaa_depth_t"],
+	["keyword", "image2d_array_msaa_t"],
+	["keyword", "image2d_array_t"],
+	["keyword", "image2d_depth_t"],
+	["keyword", "image2d_msaa_depth_t"],
+	["keyword", "image2d_msaa_t"],
+	["keyword", "image2d_t"],
+	["keyword", "image3d_t"],
+	["keyword", "imaginary"],
+	["keyword", "int"],
+	["keyword", "int16"],
+	["keyword", "int2"],
+	["keyword", "int3"],
+	["keyword", "int4"],
+	["keyword", "int8"],
+	["keyword", "intptr_t"],
+	["keyword", "kernel"],
+	["keyword", "local"],
+	["keyword", "long"],
+	["keyword", "long16"],
+	["keyword", "long2"],
+	["keyword", "long3"],
+	["keyword", "long4"],
+	["keyword", "long8"],
+	["keyword", "ndrange_t"],
+	["keyword", "packed"],
+	["keyword", "pipe"],
+	["keyword", "private"],
+	["keyword", "ptrdiff_t"],
+	["keyword", "quad"],
+	["keyword", "quad16"],
+	["keyword", "quad2"],
+	["keyword", "quad3"],
+	["keyword", "quad4"],
+	["keyword", "quad8"],
+	["keyword", "queue_t"],
+	["keyword", "read_only"],
+	["keyword", "read_write"],
+	["keyword", "register"],
+	["keyword", "reserve_id_t"],
+	["keyword", "restrict"],
+	["keyword", "sampler_t"],
+	["keyword", "short"],
+	["keyword", "short16"],
+	["keyword", "short2"],
+	["keyword", "short3"],
+	["keyword", "short4"],
+	["keyword", "short8"],
+	["keyword", "size_t"],
+	["keyword", "static"],
+	["keyword", "struct"], ["punctuation", ";"],
+	["keyword", "switch"],
+	["keyword", "typedef"],
+	["keyword", "uchar"],
+	["keyword", "uchar16"],
+	["keyword", "uchar2"],
+	["keyword", "uchar3"],
+	["keyword", "uchar4"],
+	["keyword", "uchar8"],
+	["keyword", "uint"],
+	["keyword", "uint16"],
+	["keyword", "uint2"],
+	["keyword", "uint3"],
+	["keyword", "uint4"],
+	["keyword", "uint8"],
+	["keyword", "uintptr_t"],
+	["keyword", "ulong"],
+	["keyword", "ulong16"],
+	["keyword", "ulong2"],
+	["keyword", "ulong3"],
+	["keyword", "ulong4"],
+	["keyword", "ulong8"],
+	["keyword", "uniform"],
+	["keyword", "union"],
+	["keyword", "unsigned"],
+	["keyword", "ushort"],
+	["keyword", "ushort16"],
+	["keyword", "ushort2"],
+	["keyword", "ushort3"],
+	["keyword", "ushort4"],
+	["keyword", "ushort8"],
+	["keyword", "void"],
+	["keyword", "volatile"],
+	["keyword", "while"],
+	["keyword", "write_only"]
+]
+
+----------------------------------------------------
+
+Checks for all keywords in OpenCL kernel code.