|
4 | 4 | "If you want to provide a fix or improvement, please create a pull request against the original repository.", |
5 | 5 | "Once accepted there, we are happy to receive an update request." |
6 | 6 | ], |
7 | | - "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/1a24b4aa383169919f0d92cf2735ac35a3e7db3c", |
| 7 | + "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/5209e7f9df7661db6f163753141eeb3de6fb02b3", |
8 | 8 | "name": "C", |
9 | 9 | "scopeName": "source.c", |
10 | 10 | "patterns": [ |
|
67 | 67 | "include": "#strings" |
68 | 68 | }, |
69 | 69 | { |
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))(?:(\\()([^()\\\\]+)(\\)))?", |
71 | 72 | "beginCaptures": { |
72 | 73 | "1": { |
73 | | - "name": "keyword.control.directive.define.c" |
| 74 | + "patterns": [ |
| 75 | + { |
| 76 | + "include": "#inline_comment" |
| 77 | + } |
| 78 | + ] |
74 | 79 | }, |
75 | 80 | "2": { |
76 | | - "name": "punctuation.definition.directive.c" |
| 81 | + "name": "comment.block.c punctuation.definition.comment.begin.c" |
77 | 82 | }, |
78 | 83 | "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 | + ] |
80 | 97 | }, |
81 | 98 | "5": { |
82 | | - "name": "punctuation.definition.parameters.begin.c" |
| 99 | + "name": "keyword.control.directive.define.c" |
83 | 100 | }, |
84 | 101 | "6": { |
85 | | - "name": "variable.parameter.preprocessor.c" |
| 102 | + "name": "punctuation.definition.directive.c" |
| 103 | + }, |
| 104 | + "7": { |
| 105 | + "name": "entity.name.function.preprocessor.c" |
86 | 106 | }, |
87 | 107 | "8": { |
88 | | - "name": "punctuation.separator.parameters.c" |
| 108 | + "name": "punctuation.definition.parameters.begin.c" |
89 | 109 | }, |
90 | 110 | "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": { |
91 | 131 | "name": "punctuation.definition.parameters.end.c" |
92 | 132 | } |
93 | 133 | }, |
94 | | - "end": "(?=(?://|/\\*))|(?<!\\\\)(?=\\n)", |
95 | | - "name": "meta.preprocessor.macro.c", |
| 134 | + "end": "(?<!\\\\)(?=\\n)", |
96 | 135 | "patterns": [ |
97 | 136 | { |
98 | 137 | "include": "#preprocessor-rule-define-line-contents" |
|
372 | 411 | } |
373 | 412 | ], |
374 | 413 | "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 | + }, |
375 | 437 | "default_statement": { |
376 | 438 | "name": "meta.conditional.case.c", |
377 | 439 | "begin": "((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))((?<!\\w)default(?!\\w))", |
|
520 | 582 | "include": "#switch_conditional_parentheses" |
521 | 583 | }, |
522 | 584 | { |
523 | | - "include": "$base" |
| 585 | + "include": "$self" |
524 | 586 | } |
525 | 587 | ] |
526 | 588 | }, |
|
541 | 603 | "include": "#case_statement" |
542 | 604 | }, |
543 | 605 | { |
544 | | - "include": "$base" |
| 606 | + "include": "$self" |
545 | 607 | }, |
546 | 608 | { |
547 | 609 | "include": "#block_innards" |
|
554 | 616 | "end": "[\\s\\n]*(?=;)", |
555 | 617 | "patterns": [ |
556 | 618 | { |
557 | | - "include": "$base" |
| 619 | + "include": "$self" |
558 | 620 | } |
559 | 621 | ] |
560 | 622 | } |
|
705 | 767 | "c_conditional_context": { |
706 | 768 | "patterns": [ |
707 | 769 | { |
708 | | - "include": "$base" |
| 770 | + "include": "$self" |
709 | 771 | }, |
710 | 772 | { |
711 | 773 | "include": "#block_innards" |
|
0 commit comments