@@ -227,7 +227,7 @@ using namespace cppast;
227227%token <str> tknLShift tknRShift tknLShiftEq tknRShiftEq tknCmpEq tknNotEq tknLessEq tknGreaterEq
228228%token <str> tkn3WayCmp tknAnd tknOr tknInc tknDec tknArrow tknArrowStar
229229%token <str> tknLT tknGT // We will need the position of these operators in stream when used for declaring template instance .
230- %token <str> ' +' ' -' ' *' ' /' ' %' ' ^' ' &' ' |' ' ~' ' !' ' =' ' ,' ' (' ' )' ' [' ' ]' ' ;'
230+ %token <str> ' +' ' -' ' *' ' /' ' %' ' ^' ' &' ' |' ' ~' ' !' ' =' ' ,' ' (' ' )' ' [' ' ]' ' ;' ' . '
231231%token <str> tknNew tknDelete
232232%token <str> tknConst tknConstExpr // For templatearg parsing it is made as str type .
233233%token <str> tknVoid // For the cases when void is used as function parameter .
@@ -249,7 +249,7 @@ using namespace cppast;
249249
250250%type <str> strlit
251251%type <str> optapidecor apidecor apidecortokensq
252- %type <str> identifier optidentifier numbertype typeidentifier varidentifier optname id name operfuncname funcname
252+ %type <str> identifier optidentifier numbertype typeidentifier varidentifier optname id name designatedname operfuncname funcname
253253%type <str> templidentifier templqualifiedid
254254%type <str> doccommentstr optdoccommentstr
255255%type <str> rshift
@@ -278,7 +278,7 @@ using namespace cppast;
278278%type <templateParamList> templatespecifier templateparamlist
279279%type <templateParam> templateparam
280280%type <docCommentObj> doccomment
281- %type <cppExprObj> expr exprstmt optexpr lambdacapture captureallbyref captureallbyval exprorlist optexprorlist
281+ %type <cppExprObj> expr exprstmt optexpr lambdacapture captureallbyref captureallbyval exprorlist optexprorlist desinatedinitialization
282282%type <exprList> exprlist optexprlist
283283%type <cppExprObj> objcarg objcarglist
284284%type <cppLambda> lambda
@@ -748,6 +748,10 @@ name
748748 : tknName [ZZLOG; $$ = $1;] {}
749749 ;
750750
751+ designatedname
752+ : '.' name [ZZLOG;] {$$ = mergeCppToken($1, $2);}
753+ ;
754+
751755id
752756 : tknID [ZZLOG; $$ = $1; ] {}
753757 ;
@@ -2073,11 +2077,20 @@ exprlist
20732077 $$ = new std::vector<std::unique_ptr<const cppast::CppExpression>>;
20742078 $$->emplace_back($1);
20752079 }
2080+ | desinatedinitialization [ZZLOG;] {
2081+ $$ = new std::vector<std::unique_ptr<const cppast::CppExpression>>;
2082+ $$->emplace_back($1);
2083+ }
20762084 | exprlist optdoccommentstr ',' optdoccommentstr expr %prec COMMA [ZZLOG;] { $1->emplace_back($5); $$ = $1; }
2085+ | exprlist optdoccommentstr ',' optdoccommentstr desinatedinitialization %prec COMMA [ZZLOG;] { $1->emplace_back($5); $$ = $1; }
20772086 | doccommentstr exprlist [ZZLOG;] { $$ = $2; }
20782087 | exprlist doccommentstr [ZZLOG;] { $$ = $1; }
20792088 ;
20802089
2090+ desinatedinitialization
2091+ : designatedname '=' expr [ZZLOG;] { $$ = BinomialExpr(cppast::CppBinaryOperator::ASSIGN, NameExpr($1), $3); }
2092+ ;
2093+
20812094optexprlist
20822095 : [ZZLOG;] { $$ = nullptr; }
20832096 | exprlist [ZZLOG;] { $$ = $1; }
0 commit comments