Skip to content

Commit 8200277

Browse files
committed
Update C++ grammar to get * fix
There is a known bug for macros, but it is better to get the * fix and pick up the macro fix as soon as it is made.
1 parent 64031a2 commit 8200277

7 files changed

Lines changed: 10750 additions & 4920 deletions

File tree

extensions/cpp/cgmanifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"git": {
77
"name": "jeff-hykin/cpp-textmate-grammar",
88
"repositoryUrl": "https://github.com/jeff-hykin/cpp-textmate-grammar",
9-
"commitHash": "59f0673f04d6e5c8a4d1b3ccc5235ed8a4ccb6c0"
9+
"commitHash": "cb9cb59b32d0cb9e2cbbca1a9cdb62769fc2ca8e"
1010
}
1111
},
1212
"license": "MIT",

extensions/cpp/syntaxes/c.tmLanguage.json

Lines changed: 108 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
55
"Once accepted there, we are happy to receive an update request."
66
],
7-
"version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/9c4f4b3291538d9f5144f02d3b6af877b84f2cb2",
7+
"version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/1a24b4aa383169919f0d92cf2735ac35a3e7db3c",
88
"name": "C",
99
"scopeName": "source.c",
1010
"patterns": [
@@ -374,16 +374,41 @@
374374
"repository": {
375375
"default_statement": {
376376
"name": "meta.conditional.case.c",
377-
"begin": "((?<!\\w)default(?!\\w))",
377+
"begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?<!\\w)default(?!\\w))",
378378
"beginCaptures": {
379379
"1": {
380+
"patterns": [
381+
{
382+
"include": "#inline_comment"
383+
}
384+
]
385+
},
386+
"2": {
387+
"name": "comment.block.c punctuation.definition.comment.begin.c"
388+
},
389+
"3": {
390+
"name": "comment.block.c"
391+
},
392+
"4": {
393+
"patterns": [
394+
{
395+
"match": "\\*\\/",
396+
"name": "comment.block.c punctuation.definition.comment.end.c"
397+
},
398+
{
399+
"match": "\\*",
400+
"name": "comment.block.c"
401+
}
402+
]
403+
},
404+
"5": {
380405
"name": "keyword.control.default.c"
381406
}
382407
},
383408
"end": "(:)",
384409
"endCaptures": {
385410
"1": {
386-
"name": "colon.c punctuation.separator.case.default.c"
411+
"name": "punctuation.separator.colon.case.default.c"
387412
}
388413
},
389414
"patterns": [
@@ -397,16 +422,41 @@
397422
},
398423
"case_statement": {
399424
"name": "meta.conditional.case.c",
400-
"begin": "((?<!\\w)case(?!\\w))",
425+
"begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?<!\\w)case(?!\\w))",
401426
"beginCaptures": {
402427
"1": {
428+
"patterns": [
429+
{
430+
"include": "#inline_comment"
431+
}
432+
]
433+
},
434+
"2": {
435+
"name": "comment.block.c punctuation.definition.comment.begin.c"
436+
},
437+
"3": {
438+
"name": "comment.block.c"
439+
},
440+
"4": {
441+
"patterns": [
442+
{
443+
"match": "\\*\\/",
444+
"name": "comment.block.c punctuation.definition.comment.end.c"
445+
},
446+
{
447+
"match": "\\*",
448+
"name": "comment.block.c"
449+
}
450+
]
451+
},
452+
"5": {
403453
"name": "keyword.control.case.c"
404454
}
405455
},
406456
"end": "(:)",
407457
"endCaptures": {
408458
"1": {
409-
"name": "colon.c punctuation.separator.case.c"
459+
"name": "punctuation.separator.colon.case.c"
410460
}
411461
},
412462
"patterns": [
@@ -420,12 +470,37 @@
420470
},
421471
"switch_statement": {
422472
"name": "meta.block.switch.c",
423-
"begin": "(((?<!\\w)switch(?!\\w)))",
473+
"begin": "(((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?<!\\w)switch(?!\\w)))",
424474
"beginCaptures": {
425475
"1": {
426476
"name": "meta.head.switch.c"
427477
},
428478
"2": {
479+
"patterns": [
480+
{
481+
"include": "#inline_comment"
482+
}
483+
]
484+
},
485+
"3": {
486+
"name": "comment.block.c punctuation.definition.comment.begin.c"
487+
},
488+
"4": {
489+
"name": "comment.block.c"
490+
},
491+
"5": {
492+
"patterns": [
493+
{
494+
"match": "\\*\\/",
495+
"name": "comment.block.c punctuation.definition.comment.end.c"
496+
},
497+
{
498+
"match": "\\*",
499+
"name": "comment.block.c"
500+
}
501+
]
502+
},
503+
"6": {
429504
"name": "keyword.control.switch.c"
430505
}
431506
},
@@ -487,9 +562,34 @@
487562
},
488563
"switch_conditional_parentheses": {
489564
"name": "meta.conditional.switch.c",
490-
"begin": "(\\()",
565+
"begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))(\\()",
491566
"beginCaptures": {
492567
"1": {
568+
"patterns": [
569+
{
570+
"include": "#inline_comment"
571+
}
572+
]
573+
},
574+
"2": {
575+
"name": "comment.block.c punctuation.definition.comment.begin.c"
576+
},
577+
"3": {
578+
"name": "comment.block.c"
579+
},
580+
"4": {
581+
"patterns": [
582+
{
583+
"match": "\\*\\/",
584+
"name": "comment.block.c punctuation.definition.comment.end.c"
585+
},
586+
{
587+
"match": "\\*",
588+
"name": "comment.block.c"
589+
}
590+
]
591+
},
592+
"5": {
493593
"name": "punctuation.section.parens.begin.bracket.round.conditional.switch.c"
494594
}
495595
},
@@ -580,7 +680,7 @@
580680
"begin": "(,)\\s*(?=(?:L|u8|u|U\\s*\\\")?)",
581681
"beginCaptures": {
582682
"1": {
583-
"name": "comma.c punctuation.separator.delimiter.c"
683+
"name": "punctuation.separator.delimiter.comma.c"
584684
}
585685
},
586686
"end": "(?=\\))",

0 commit comments

Comments
 (0)