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:
Marc Mutz 2012-02-26 09:34:36 +01:00 committed by Qt by Nokia
parent c09eeff2ab
commit d811b2434b

View File

@ -273,11 +273,12 @@ sub classNames {
if($definition) {
$definition =~ s=[\n\r]==g;
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 *.*\(\*([^\)]*)\)\(.*\);$/) {
push @symbols, $1;
} elsif($definition =~ m/^ *typedef +(.*) +([^ ]*);$/) {
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;
} elsif($definition =~ m/^ *Q_DECLARE_.*ITERATOR\((.*)\);$/) {
push @symbols, "Q" . $1 . "Iterator";