Skip to content

Commit edf34d3

Browse files
committed
Update grammars
1 parent 6352696 commit edf34d3

17 files changed

Lines changed: 3215 additions & 1269 deletions

extensions/cpp/cgmanifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
"git": {
77
"name": "jeff-hykin/cpp-textmate-grammar",
88
"repositoryUrl": "https://github.com/jeff-hykin/cpp-textmate-grammar",
9-
"commitHash": "992c5ba8789288707f2a13778452d644677d9699"
9+
"commitHash": "cbd71f90cd9be0f99ddc9b0f65cec62fc3ada6d1"
1010
}
1111
},
1212
"license": "MIT",
13-
"version": "1.12.18",
13+
"version": "1.12.21",
1414
"description": "The files syntaxes/c.json and syntaxes/c++.json were derived from https://github.com/atom/language-c which was originally converted from the C TextMate bundle https://github.com/textmate/c.tmbundle."
1515
},
1616
{

extensions/cpp/syntaxes/c.tmLanguage.json

Lines changed: 76 additions & 14 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/1a24b4aa383169919f0d92cf2735ac35a3e7db3c",
7+
"version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/5209e7f9df7661db6f163753141eeb3de6fb02b3",
88
"name": "C",
99
"scopeName": "source.c",
1010
"patterns": [
@@ -67,32 +67,71 @@
6767
"include": "#strings"
6868
},
6969
{
70-
"begin": "(?x)\n^\\s* ((\\#)\\s*define) \\s+\t# define\n((?<id>[a-zA-Z_$][\\w$]*))\t # macro name\n(?:\n (\\()\n\t(\n\t \\s* \\g<id> \\s*\t\t # first argument\n\t ((,) \\s* \\g<id> \\s*)* # additional arguments\n\t (?:\\.\\.\\.)?\t\t\t# varargs ellipsis?\n\t)\n (\\))\n)?",
70+
"name": "meta.preprocessor.macro.c",
71+
"begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((#)\\s*define\\b)\\s+((?<!\\w)[a-zA-Z_]\\w*(?!\\w))(?:(\\()([^()\\\\]+)(\\)))?",
7172
"beginCaptures": {
7273
"1": {
73-
"name": "keyword.control.directive.define.c"
74+
"patterns": [
75+
{
76+
"include": "#inline_comment"
77+
}
78+
]
7479
},
7580
"2": {
76-
"name": "punctuation.definition.directive.c"
81+
"name": "comment.block.c punctuation.definition.comment.begin.c"
7782
},
7883
"3": {
79-
"name": "entity.name.function.preprocessor.c"
84+
"name": "comment.block.c"
85+
},
86+
"4": {
87+
"patterns": [
88+
{
89+
"match": "\\*\\/",
90+
"name": "comment.block.c punctuation.definition.comment.end.c"
91+
},
92+
{
93+
"match": "\\*",
94+
"name": "comment.block.c"
95+
}
96+
]
8097
},
8198
"5": {
82-
"name": "punctuation.definition.parameters.begin.c"
99+
"name": "keyword.control.directive.define.c"
83100
},
84101
"6": {
85-
"name": "variable.parameter.preprocessor.c"
102+
"name": "punctuation.definition.directive.c"
103+
},
104+
"7": {
105+
"name": "entity.name.function.preprocessor.c"
86106
},
87107
"8": {
88-
"name": "punctuation.separator.parameters.c"
108+
"name": "punctuation.definition.parameters.begin.c"
89109
},
90110
"9": {
111+
"patterns": [
112+
{
113+
"match": "(?<=[(,])\\s*((?<!\\w)[a-zA-Z_]\\w*(?!\\w))\\s*",
114+
"captures": {
115+
"1": {
116+
"name": "variable.parameter.preprocessor.c"
117+
}
118+
}
119+
},
120+
{
121+
"match": ",",
122+
"name": "punctuation.separator.parameters.c"
123+
},
124+
{
125+
"match": "\\.\\.\\.",
126+
"name": "ellipses.c punctuation.vararg-ellipses.variable.parameter.preprocessor.c"
127+
}
128+
]
129+
},
130+
"10": {
91131
"name": "punctuation.definition.parameters.end.c"
92132
}
93133
},
94-
"end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)",
95-
"name": "meta.preprocessor.macro.c",
134+
"end": "(?<!\\\\)(?=\\n)",
96135
"patterns": [
97136
{
98137
"include": "#preprocessor-rule-define-line-contents"
@@ -372,6 +411,29 @@
372411
}
373412
],
374413
"repository": {
414+
"inline_comment": {
415+
"match": "(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/))",
416+
"captures": {
417+
"1": {
418+
"name": "comment.block.c punctuation.definition.comment.begin.c"
419+
},
420+
"2": {
421+
"name": "comment.block.c"
422+
},
423+
"3": {
424+
"patterns": [
425+
{
426+
"match": "\\*\\/",
427+
"name": "comment.block.c punctuation.definition.comment.end.c"
428+
},
429+
{
430+
"match": "\\*",
431+
"name": "comment.block.c"
432+
}
433+
]
434+
}
435+
}
436+
},
375437
"default_statement": {
376438
"name": "meta.conditional.case.c",
377439
"begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?<!\\w)default(?!\\w))",
@@ -520,7 +582,7 @@
520582
"include": "#switch_conditional_parentheses"
521583
},
522584
{
523-
"include": "$base"
585+
"include": "$self"
524586
}
525587
]
526588
},
@@ -541,7 +603,7 @@
541603
"include": "#case_statement"
542604
},
543605
{
544-
"include": "$base"
606+
"include": "$self"
545607
},
546608
{
547609
"include": "#block_innards"
@@ -554,7 +616,7 @@
554616
"end": "[\\s\\n]*(?=;)",
555617
"patterns": [
556618
{
557-
"include": "$base"
619+
"include": "$self"
558620
}
559621
]
560622
}
@@ -705,7 +767,7 @@
705767
"c_conditional_context": {
706768
"patterns": [
707769
{
708-
"include": "$base"
770+
"include": "$self"
709771
},
710772
{
711773
"include": "#block_innards"

0 commit comments

Comments
 (0)