syncqt: parse classes that use Q_DECL_FINAL|final|sealed
I've introduced a variable $post_kw (post-class-keywords) that contains the patterns which are expected after a class name. This variable is used both for a negative look-ahead assertion in the class-name capture (so the regex doesn't parse the keywords as the class-name), as well as to carry the parser over the keywords into the subclass clauses. Change-Id: Ia534ca01a511e1c773d007f1b0b4f448e8d009d0 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
This commit is contained in:
parent
c09eeff2ab
commit
d811b2434b
@ -273,11 +273,12 @@ sub classNames {
|
|||||||
if($definition) {
|
if($definition) {
|
||||||
$definition =~ s=[\n\r]==g;
|
$definition =~ s=[\n\r]==g;
|
||||||
my @symbols;
|
my @symbols;
|
||||||
|
my $post_kw = qr/Q_DECL_FINAL|final|sealed/; # add here macros and keywords that go after the class-name of a class definition
|
||||||
if($definition =~ m/^ *typedef *.*\(\*([^\)]*)\)\(.*\);$/) {
|
if($definition =~ m/^ *typedef *.*\(\*([^\)]*)\)\(.*\);$/) {
|
||||||
push @symbols, $1;
|
push @symbols, $1;
|
||||||
} elsif($definition =~ m/^ *typedef +(.*) +([^ ]*);$/) {
|
} elsif($definition =~ m/^ *typedef +(.*) +([^ ]*);$/) {
|
||||||
push @symbols, $2;
|
push @symbols, $2;
|
||||||
} elsif($definition =~ m/^ *(template *<.*> *)?(class|struct) +([^ ]* +)?([^<\s]+) ?(<[^>]*> ?)?\s*((,|:)\s*(public|protected|private) *.*)? *\{\}$/) {
|
} elsif($definition =~ m/^ *(template *<.*> *)?(class|struct) +([^ ]* +)?((?!$post_kw)[^<\s]+) ?(<[^>]*> ?)?\s*(?:$post_kw)?\s*((,|:)\s*(public|protected|private) *.*)? *\{\}$/o) {
|
||||||
push @symbols, $4;
|
push @symbols, $4;
|
||||||
} elsif($definition =~ m/^ *Q_DECLARE_.*ITERATOR\((.*)\);$/) {
|
} elsif($definition =~ m/^ *Q_DECLARE_.*ITERATOR\((.*)\);$/) {
|
||||||
push @symbols, "Q" . $1 . "Iterator";
|
push @symbols, "Q" . $1 . "Iterator";
|
||||||
|
Loading…
Reference in New Issue
Block a user