From 70a4eee11581026aab0342272294ac0be8fdee5b Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 1 May 2020 15:04:52 +0200 Subject: issue #7734 Incorrect parsing of Q_PROPERTY The parsing of the type / name was not done correctly as the name `{ID}` is also part of the `{TSCOPE}` and hence the name was seen as a type. The name is the last part before an attribute is present. Missing other parts: - parsing of `*` - not parsing of a number of (not supported attributes) The definition of `Q_PROPERTY` is: ``` Q_PROPERTY(type name (READ getFunction [WRITE setFunction] | MEMBER memberName [(READ getFunction | WRITE setFunction)]) [RESET resetFunction] [NOTIFY notifySignal] [REVISION int] [DESIGNABLE bool] [SCRIPTABLE bool] [STORED bool] [USER bool] [CONSTANT] [FINAL]) ``` Note: in the implementation we do not enforce the order of the attributes. --- src/scanner.l | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/src/scanner.l b/src/scanner.l index 8ceb4ad..750967a 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -2000,33 +2000,37 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) unput(';'); BEGIN(FindMembers); } -"const"|"volatile"|"unsigned"|"signed"|"long"|"short" { - yyextra->current->type+=yytext; - } {B}+ { - yyextra->current->type+=yytext; + yyextra->current->name+=yytext; } -({TSCOPE}"::")*{TSCOPE} { - yyextra->current->type+=yytext; - BEGIN(QtPropName); +"*" { + yyextra->current->type+= yyextra->current->name; + yyextra->current->type+= yytext; + yyextra->current->name=""; } -{ID} { +({TSCOPE}"::")*{TSCOPE} { + yyextra->current->type+= yyextra->current->name; yyextra->current->name=yytext; - BEGIN(QtPropAttr); } -"READ" { +{B}+"READ"{B}+ { yyextra->current->spec |= Entry::Readable; BEGIN(QtPropRead); } -"WRITE" { +{B}+"WRITE"{B}+ { yyextra->current->spec |= Entry::Writable; BEGIN(QtPropWrite); } -"RESET"{B}+{ID} { // reset method => not supported yet - } -"SCRIPTABLE"{B}+{ID} { // scriptable property => not supported yet - } -"DESIGNABLE"{B}+{ID} { // designable property => not supported yet +{B}+"MEMBER"{B}+{ID} | // member property => not supported yet +{B}+"RESET"{B}+{ID} | // reset method => not supported yet +{B}+"SCRIPTABLE"{B}+{ID} | // scriptable property => not supported yet +{B}+"DESIGNABLE"{B}+{ID} | // designable property => not supported yet +{B}+"NOTIFY"{B}+{ID} | // notify property => not supported yet +{B}+"REVISION"{B}+{ID} | // revision property => not supported yet +{B}+"STORED"{B}+{ID} | // stored property => not supported yet +{B}+"USER"{B}+{ID} | // user property => not supported yet +{B}+"CONSTANT"{B} | // constant property => not supported yet +{B}+"FINAL"{B} { // final property => not supported yet + BEGIN(QtPropAttr); } {ID} { yyextra->current->read = yytext; -- cgit v0.12