From 951aecb5ff24e445db087ba941aeada77220d974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Nadeau=2C=20ing?= Date: Mon, 6 Nov 2017 16:59:29 -0500 Subject: [PATCH] :fix: #245 #169 #170 Allow class declaration and inheritance to be on a separate line. Also add support for virtual inheritance. --- grammars/c++.cson | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/grammars/c++.cson b/grammars/c++.cson index 16dc335..894d187 100644 --- a/grammars/c++.cson +++ b/grammars/c++.cson @@ -281,33 +281,31 @@ ] } { - '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)|(,)?' + } { 'begin': '\\{' 'beginCaptures':