diff options
Diffstat (limited to 'src/scanner.l')
-rw-r--r-- | src/scanner.l | 29 |
1 files changed, 29 insertions, 0 deletions
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); } } +<SliceOptional>"(" { + current->type += "("; + roundCount++; + } +<SliceOptional>[0-9]+ { + current->type += yytext; + } +<SliceOptional>")" { + current->type += ")"; + if(--roundCount<=0) + { + BEGIN (lastModifierContext); + } + } <IDLAttribute>"]" { // end of IDL function attribute if (--squareCount<=0) |