From 8a2b1dd98f6d1dd2ed08beda3a654827a0ad821b Mon Sep 17 00:00:00 2001 From: Austin Henriksen Date: Wed, 12 Jun 2019 10:52:16 -0400 Subject: Fixes #6860. --- src/scanner.l | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/scanner.l b/src/scanner.l index e36b36d..42058d8 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -78,6 +78,7 @@ static int lastHereDocContext; static int lastDefineContext; static int lastAlignAsContext; static int lastC11AttributeContext; +static int lastModifierContext; static Protection protection; static Protection baseProt; static int sharpCount = 0 ; @@ -766,6 +767,7 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) /** Slice states */ +%x SliceOptional %x SliceMetadata %x SliceSequence %x SliceSequenceName @@ -2439,6 +2441,19 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) current->type+=yytext; BEGIN(DeclType); } + else if (insideSlice && qstrcmp(yytext,"optional")==0) + { + if (current->type.isEmpty()) + { + current->type = "optional"; + } + else + { + current->type += " optional"; + } + lastModifierContext = YY_START; + BEGIN(SliceOptional); + } else { if (YY_START==FindMembers) @@ -3593,6 +3608,20 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) BEGIN (lastSquareContext); } } +"(" { + current->type += "("; + roundCount++; + } +[0-9]+ { + current->type += yytext; + } +")" { + current->type += ")"; + if(--roundCount<=0) + { + BEGIN (lastModifierContext); + } + } "]" { // end of IDL function attribute if (--squareCount<=0) -- cgit v0.12