Update c/c++ grammar (May27)

This commit is contained in:
Martin Aeschlimann 2016-07-14 15:07:33 +02:00
parent 99aa1bc6b0
commit 6367beb82e
4 changed files with 22 additions and 18 deletions

View file

@ -14,11 +14,12 @@
"hxx",
"h++",
"inl",
"ino",
"ipp",
"tcc",
"tpp"
],
"firstLineMatch": "-\\*-\\s*([Mm]ode: )?C\\+\\+;?\\s*-\\*-",
"firstLineMatch": "(?i)-\\*-[^*]*(Mode:\\s*)?C\\+\\+(\\s*;.*?)?\\s*-\\*-",
"name": "C++",
"patterns": [
{
@ -28,7 +29,7 @@
"include": "source.c"
},
{
"match": "\\b(friend|explicit|virtual)\\b",
"match": "\\b(friend|explicit|virtual|override|final|noexcept)\\b",
"name": "storage.modifier.cpp"
},
{
@ -65,15 +66,15 @@
"name": "keyword.operator.cast.cpp"
},
{
"match": "\\b(and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq)\\b",
"match": "\\b(and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\b",
"name": "keyword.operator.cpp"
},
{
"match": "\\b(class|decltype|wchar_t)\\b",
"match": "\\b(class|decltype|wchar_t|char16_t|char32_t)\\b",
"name": "storage.type.cpp"
},
{
"match": "\\b(constexpr|export|mutable|typename)\\b",
"match": "\\b(constexpr|export|mutable|typename|thread_local)\\b",
"name": "storage.modifier.cpp"
},
{

View file

@ -4,7 +4,7 @@
"c",
"h"
],
"firstLineMatch": "-\\*-\\s*([Mm]ode: )?C;?\\s*-\\*-",
"firstLineMatch": "(?i)-\\*-[^*]*(Mode:\\s*)?C(\\s*;.*?)?\\s*-\\*-",
"name": "C",
"patterns": [
{
@ -58,7 +58,7 @@
"include": "#strings"
},
{
"begin": "(?x)\n^\\s* ((\\#)\\s*define) \\s+ # define\n((?<id>[a-zA-Z_][a-zA-Z0-9_]*)) # macro name\n(?:\n (\\()\n (\n \\s* \\g<id> \\s* # first argument\n ((,) \\s* \\g<id> \\s*)* # additional arguments\n (?:\\.\\.\\.)? # varargs ellipsis?\n )\n (\\))\n)?",
"begin": "(?x)\n^\\s* ((\\#)\\s*define) \\s+ # define\n((?<id>[a-zA-Z_$][\\w$]*)) # macro name\n(?:\n (\\()\n (\n \\s* \\g<id> \\s* # first argument\n ((,) \\s* \\g<id> \\s*)* # additional arguments\n (?:\\.\\.\\.)? # varargs ellipsis?\n )\n (\\))\n)?",
"beginCaptures": {
"1": {
"name": "keyword.control.directive.define.c"
@ -258,7 +258,7 @@
"include": "#parens"
},
{
"match": "\\b(const|override|final|noexcept)\\b",
"match": "\\b(const)\\b",
"name": "storage.modifier.c"
},
{
@ -273,14 +273,17 @@
"repository": {
"access": {
"captures": {
"1": {
"name": "punctuation.separator.variable-access.c"
},
"2": {
"name": "variable.other.dot-access.c"
"name": "punctuation.separator.dot-access.c"
},
"3": {
"name": "punctuation.separator.pointer-access.c"
},
"4": {
"name": "variable.other.member.c"
}
},
"match": "(\\.)([a-zA-Z_][a-zA-Z_0-9]*)\\b(?!\\s*\\()"
"match": "((\\.)|(->))([a-zA-Z_][a-zA-Z_0-9]*)\\b(?!\\s*\\()"
},
"block": {
"patterns": [
@ -470,7 +473,7 @@
"numbers": {
"patterns": [
{
"match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b",
"match": "\\b((0(x|X)[0-9a-fA-F]*)|(0(b|B)[01]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b",
"name": "constant.numeric.c"
}
]

View file

@ -749,7 +749,7 @@
},
{
"c": ".",
"t": "block.c.function.meta.punctuation.separator.variable-access",
"t": "block.c.dot-access.function.meta.punctuation.separator",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
@ -760,7 +760,7 @@
},
{
"c": "x",
"t": "block.c.dot-access.function.meta.other.variable",
"t": "block.c.function.member.meta.other.variable",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.variable rgb(156, 220, 254)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.variable rgb(0, 16, 128)",

View file

@ -2245,7 +2245,7 @@
},
{
"c": ".",
"t": "block.c.function-with-body.implementation.meta.objc.punctuation.scope.separator.variable-access",
"t": "block.c.dot-access.function-with-body.implementation.meta.objc.punctuation.scope.separator",
"r": {
"dark_plus": ".vs-dark .token rgb(212, 212, 212)",
"light_plus": ".vs .token rgb(0, 0, 0)",
@ -2256,7 +2256,7 @@
},
{
"c": "gestureRecognizers",
"t": "block.c.dot-access.function-with-body.implementation.meta.objc.other.scope.variable",
"t": "block.c.function-with-body.implementation.member.meta.objc.other.scope.variable",
"r": {
"dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.variable rgb(156, 220, 254)",
"light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.variable rgb(0, 16, 128)",