mirror of
https://github.com/Microsoft/vscode
synced 2024-08-25 12:06:27 +00:00
Update C++ grammar to get macro fix
Also added a macro to the test Fixes #76430
This commit is contained in:
parent
2c3e8a8e39
commit
06d2f9c05d
|
@ -4,7 +4,7 @@
|
|||
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
|
||||
"Once accepted there, we are happy to receive an update request."
|
||||
],
|
||||
"version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/9c4f4b3291538d9f5144f02d3b6af877b84f2cb2",
|
||||
"version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/19ef66475b6bb21b5ed466cbcf8cef4e1b1fa212",
|
||||
"name": "C++",
|
||||
"scopeName": "source.cpp",
|
||||
"patterns": [
|
||||
|
@ -57,6 +57,9 @@
|
|||
},
|
||||
"ever_present_context": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#single_line_macro"
|
||||
},
|
||||
{
|
||||
"include": "#preprocessor_rule_enabled"
|
||||
},
|
||||
|
@ -11193,6 +11196,58 @@
|
|||
"match": "(?<!\\w)#(?:endif|else|elif)(?!\\w)",
|
||||
"name": "keyword.control.directive.$0.cpp"
|
||||
},
|
||||
"single_line_macro": {
|
||||
"match": "^((?:(?:(?>\\s+)|(\\/\\*)((?>(?:[^\\*]|(?>\\*+)[^\\/])*)((?>\\*+)\\/)))+?|(?:(?:(?:(?:\\b|(?<=\\W))|(?=\\W))|\\A)|\\Z)))#define.*(?<![\\\\])(?:\\n|$)",
|
||||
"captures": {
|
||||
"0": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#meta_preprocessor_macro"
|
||||
},
|
||||
{
|
||||
"include": "#comments"
|
||||
},
|
||||
{
|
||||
"include": "#string_context"
|
||||
},
|
||||
{
|
||||
"include": "#number_literal"
|
||||
},
|
||||
{
|
||||
"include": "#operators"
|
||||
},
|
||||
{
|
||||
"include": "#semicolon"
|
||||
}
|
||||
]
|
||||
},
|
||||
"1": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#inline_comment"
|
||||
}
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"name": "comment.block.cpp punctuation.definition.comment.begin.cpp"
|
||||
},
|
||||
"3": {
|
||||
"name": "comment.block.cpp"
|
||||
},
|
||||
"4": {
|
||||
"patterns": [
|
||||
{
|
||||
"match": "\\*\\/",
|
||||
"name": "comment.block.cpp punctuation.definition.comment.end.cpp"
|
||||
},
|
||||
{
|
||||
"match": "\\*",
|
||||
"name": "comment.block.cpp"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"assembly": {
|
||||
"name": "meta.asm.cpp",
|
||||
"begin": "(\\b(?:__asm__|asm)\\b)\\s*((?:volatile)?)\\s*(\\()",
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
#define EXTERN_C extern "C"
|
||||
|
||||
class Rectangle {
|
||||
int width, height;
|
||||
public:
|
||||
|
|
|
@ -153,6 +153,116 @@
|
|||
"hc_black": "default: #FFFFFF"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "#",
|
||||
"t": "source.cpp source.cpp meta.preprocessor.macro.cpp keyword.control.directive.define.cpp punctuation.definition.directive.cpp",
|
||||
"r": {
|
||||
"dark_plus": "keyword.control: #C586C0",
|
||||
"light_plus": "keyword.control: #AF00DB",
|
||||
"dark_vs": "keyword.control: #569CD6",
|
||||
"light_vs": "keyword.control: #0000FF",
|
||||
"hc_black": "keyword.control: #C586C0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "define",
|
||||
"t": "source.cpp source.cpp meta.preprocessor.macro.cpp keyword.control.directive.define.cpp",
|
||||
"r": {
|
||||
"dark_plus": "keyword.control: #C586C0",
|
||||
"light_plus": "keyword.control: #AF00DB",
|
||||
"dark_vs": "keyword.control: #569CD6",
|
||||
"light_vs": "keyword.control: #0000FF",
|
||||
"hc_black": "keyword.control: #C586C0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": " ",
|
||||
"t": "source.cpp source.cpp meta.preprocessor.macro.cpp",
|
||||
"r": {
|
||||
"dark_plus": "meta.preprocessor: #569CD6",
|
||||
"light_plus": "meta.preprocessor: #0000FF",
|
||||
"dark_vs": "meta.preprocessor: #569CD6",
|
||||
"light_vs": "meta.preprocessor: #0000FF",
|
||||
"hc_black": "meta.preprocessor: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "EXTERN_C",
|
||||
"t": "source.cpp source.cpp meta.preprocessor.macro.cpp entity.name.function.preprocessor.cpp",
|
||||
"r": {
|
||||
"dark_plus": "entity.name.function: #DCDCAA",
|
||||
"light_plus": "entity.name.function: #795E26",
|
||||
"dark_vs": "meta.preprocessor: #569CD6",
|
||||
"light_vs": "meta.preprocessor: #0000FF",
|
||||
"hc_black": "entity.name.function: #DCDCAA"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": " ",
|
||||
"t": "source.cpp source.cpp meta.preprocessor.macro.cpp",
|
||||
"r": {
|
||||
"dark_plus": "meta.preprocessor: #569CD6",
|
||||
"light_plus": "meta.preprocessor: #0000FF",
|
||||
"dark_vs": "meta.preprocessor: #569CD6",
|
||||
"light_vs": "meta.preprocessor: #0000FF",
|
||||
"hc_black": "meta.preprocessor: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "extern",
|
||||
"t": "source.cpp source.cpp meta.preprocessor.macro.cpp meta.block.extern.cpp meta.head.extern.cpp storage.type.extern.cpp",
|
||||
"r": {
|
||||
"dark_plus": "storage.type: #569CD6",
|
||||
"light_plus": "storage.type: #0000FF",
|
||||
"dark_vs": "storage.type: #569CD6",
|
||||
"light_vs": "storage.type: #0000FF",
|
||||
"hc_black": "storage.type: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": " ",
|
||||
"t": "source.cpp source.cpp meta.preprocessor.macro.cpp meta.block.extern.cpp meta.head.extern.cpp",
|
||||
"r": {
|
||||
"dark_plus": "meta.preprocessor: #569CD6",
|
||||
"light_plus": "meta.preprocessor: #0000FF",
|
||||
"dark_vs": "meta.preprocessor: #569CD6",
|
||||
"light_vs": "meta.preprocessor: #0000FF",
|
||||
"hc_black": "meta.preprocessor: #569CD6"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "\"",
|
||||
"t": "source.cpp source.cpp meta.preprocessor.macro.cpp meta.block.extern.cpp meta.head.extern.cpp string.quoted.double.cpp punctuation.definition.string.begin.cpp",
|
||||
"r": {
|
||||
"dark_plus": "string: #CE9178",
|
||||
"light_plus": "string: #A31515",
|
||||
"dark_vs": "string: #CE9178",
|
||||
"light_vs": "string: #A31515",
|
||||
"hc_black": "string: #CE9178"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "C",
|
||||
"t": "source.cpp source.cpp meta.preprocessor.macro.cpp meta.block.extern.cpp meta.head.extern.cpp string.quoted.double.cpp",
|
||||
"r": {
|
||||
"dark_plus": "string: #CE9178",
|
||||
"light_plus": "string: #A31515",
|
||||
"dark_vs": "string: #CE9178",
|
||||
"light_vs": "string: #A31515",
|
||||
"hc_black": "string: #CE9178"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "\"",
|
||||
"t": "source.cpp source.cpp meta.preprocessor.macro.cpp meta.block.extern.cpp meta.head.extern.cpp string.quoted.double.cpp punctuation.definition.string.end.cpp",
|
||||
"r": {
|
||||
"dark_plus": "string: #CE9178",
|
||||
"light_plus": "string: #A31515",
|
||||
"dark_vs": "string: #CE9178",
|
||||
"light_vs": "string: #A31515",
|
||||
"hc_black": "string: #CE9178"
|
||||
}
|
||||
},
|
||||
{
|
||||
"c": "class",
|
||||
"t": "source.cpp source.cpp meta.block.class.cpp meta.head.class.cpp storage.type.class.cpp",
|
||||
|
|
Loading…
Reference in a new issue