From 9992e9fba8050f891ed1f2c009c2284541f67375 Mon Sep 17 00:00:00 2001 From: Xaver Hellauer Date: Tue, 2 Feb 2016 20:03:25 +0100 Subject: [PATCH] alignof and alignas keywords alignof and alignas are official C++ keywords, further I moved one function definition from the C file to the C++ because it has caused wrong highlighting for C (friend and override are not C keywords). .H files are now also C++ file types. --- extensions/cpp/syntaxes/c++.plist | 72 ++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 6 deletions(-) diff --git a/extensions/cpp/syntaxes/c++.plist b/extensions/cpp/syntaxes/c++.plist index e846dc23184..6a76b757ec6 100644 --- a/extensions/cpp/syntaxes/c++.plist +++ b/extensions/cpp/syntaxes/c++.plist @@ -16,6 +16,7 @@ hh hpp h++ + H firstLineMatch -\*- C\+\+ -\*- @@ -29,10 +30,6 @@ include #special_block - - include - source.c - match \b(friend|explicit|virtual)\b @@ -85,7 +82,7 @@ match - \b(and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq)\b + \b(alignof|alignas|and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq)\b name keyword.operator.c++ @@ -97,7 +94,7 @@ match - \b(constexpr|export|mutable|typename|thread_local|noexcept)\b + \b(constexpr|export|mutable|typename|thread_local)\b name storage.modifier.c++ @@ -185,6 +182,69 @@ + + begin + (?x) + (?: ^ # begin-of-line + | + (?: (?= \s ) (?<!else|new|return) (?<=\w) # or word + space before name + | (?= \s*[A-Za-z_] ) (?<!&&) (?<=[*&>]) # or type modifier before name + ) + ) + (\s*) (?!(while|for|do|if|else|switch|catch|enumerate|return|sizeof|[cr]?iterate)\s*\() + ( + (?: [A-Za-z_][A-Za-z0-9_]*+ | :: )++ | # actual name + (?: (?<=operator) (?: [-*&<>=+!]+ | \(\) | \[\] ) ) # if it is a C++ operator + ) + \s*(?=\() + beginCaptures + + 1 + + name + punctuation.whitespace.function.leading.c + + 3 + + name + entity.name.function.c + + 4 + + name + punctuation.definition.parameters.c + + + end + (?<=\})|(?=#)|(;) + name + meta.function.c++ + patterns + + + include + #comments + + + include + #parens + + + match + \b(const|final|override|noexcept)\b + name + storage.modifier.$1.c++ + + + include + #block + + + + + include + source.c + repository