diff --git a/packages/language-c/grammars/c++.cson b/packages/language-c/grammars/c++.cson index 16dc335d08..d27a4f8a39 100644 --- a/packages/language-c/grammars/c++.cson +++ b/packages/language-c/grammars/c++.cson @@ -69,9 +69,17 @@ 'name': 'punctuation.separator.namespace.access.cpp' } { - 'match': '\\b(and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq|alignof|alignas)\\b' + 'match': '\\b(typeid|alignof|alignas)\\b' 'name': 'keyword.operator.cpp' } + { + 'match': '\\b(and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|xor|xor_eq)\\b' + 'name': 'keyword.operator.alias.cpp' + } + { + 'match': '\\bstatic_assert\\b' + 'name': 'keyword.static-assert.cpp' + } { 'match': '\\b(class|decltype|wchar_t|char16_t|char32_t)\\b' 'name': 'storage.type.cpp' @@ -242,7 +250,7 @@ "name": "meta.using-namespace-declaration.cpp" }, { - 'begin': '\\b(namespace)\\b\\s*([_A-Za-z][_A-Za-z0-9]*\\b)?+' + 'begin': '\\b(namespace)\\b\\s*((?:[_A-Za-z][_A-Za-z0-9]*\\b(::)?)*)?+' 'beginCaptures': '1': 'name': 'storage.type.cpp' @@ -281,33 +289,36 @@ ] } { - 'begin': '\\b(class|struct)\\b\\s*([_A-Za-z][_A-Za-z0-9]*\\b)?+(\\s*:\\s*(public|protected|private)\\s*([_A-Za-z][_A-Za-z0-9]*\\b)((\\s*,\\s*(public|protected|private)\\s*[_A-Za-z][_A-Za-z0-9]*\\b)*))?' + 'begin': '\\b(class|struct)\\b\\s*([_A-Za-z][_A-Za-z0-9]*\\b)?+(\\s*:\\s)?' 'beginCaptures': '1': 'name': 'storage.type.cpp' '2': 'name': 'entity.name.type.cpp' - '4': - 'name': 'storage.type.modifier.cpp' - '5': - 'name': 'entity.name.type.inherited.cpp' - '6': - 'patterns': [ - { - 'match': '(public|protected|private)' - 'name': 'storage.type.modifier.cpp' - } - { - 'match': '[_A-Za-z][_A-Za-z0-9]*' - 'name': 'entity.name.type.inherited.cpp' - } - ] 'end': '(?<=\\})|(?=(;|\\(|\\)|>|\\[|\\]|=))' 'name': 'meta.class-struct-block.cpp' 'patterns': [ { 'include': '#angle_brackets' } + { + 'begin': '(virtual\\s*)?(public|protected|private)\\s*(virtual\\s*)?([_A-Za-z][_A-Za-z0-9]*)\\b' + 'beginCaptures': + '1': + 'name': 'storage.type.modifier.cpp' + '2': + 'name': 'storage.type.modifier.cpp' + '3': + 'name': 'storage.type.modifier.cpp' + '4': + 'name': 'entity.name.type.inherited.cpp' + 'end': '(\\{)|(\\s*\\n)|(,)?' + 'patterns': [ + { + 'include': '#angle_brackets' + } + ] + } { 'begin': '\\{' 'beginCaptures': diff --git a/packages/language-c/grammars/tree-sitter-cpp.cson b/packages/language-c/grammars/tree-sitter-cpp.cson index d8fb0e4e42..796c93e10a 100644 --- a/packages/language-c/grammars/tree-sitter-cpp.cson +++ b/packages/language-c/grammars/tree-sitter-cpp.cson @@ -90,6 +90,7 @@ scopes: '"#define"': 'keyword.control.directive' '"#include"': 'keyword.control.directive' 'preproc_directive': 'keyword.control.directive' + '"static_assert"': 'keyword.control.directive' '"if"': 'keyword.control' '"else"': 'keyword.control' @@ -133,12 +134,14 @@ scopes: call_expression > identifier, call_expression > field_expression > field_identifier, call_expression > scoped_identifier > identifier, + call_expression > qualified_identifier > identifier, template_function > identifier, template_function > scoped_identifier > identifier, template_method > field_identifier, function_declarator > identifier, function_declarator > field_identifier, function_declarator > scoped_identifier > identifier, + function_declarator > qualified_identifier > identifier, destructor_name > identifier ''': 'entity.name.function' @@ -224,8 +227,8 @@ scopes: '"=="': 'keyword.operator' '"!"': 'keyword.operator' '"!="': 'keyword.operator' - 'relational_expression > "<"': 'keyword.operator' - 'relational_expression > ">"': 'keyword.operator' + 'binary_expression > "<"': 'keyword.operator' + 'binary_expression > ">"': 'keyword.operator' '">="': 'keyword.operator' '"<="': 'keyword.operator' '"&&"': 'keyword.operator'