@@ -645,6 +645,11 @@ bool Parser::parseUsing(DeclarationAST *&node)
645
645
646
646
CHECK (Token_using);
647
647
648
+ if (token_stream.lookAhead (1 ) == ' =' )
649
+ {
650
+ return parseUsingTypedef (node);
651
+ }
652
+
648
653
if (token_stream.lookAhead () == Token_namespace)
649
654
return parseUsingDirective (node);
650
655
@@ -667,6 +672,41 @@ bool Parser::parseUsing(DeclarationAST *&node)
667
672
return true ;
668
673
}
669
674
675
+ bool Parser::parseUsingTypedef (DeclarationAST*& node)
676
+ {
677
+ std::size_t start = token_stream.cursor ();
678
+
679
+ DeclaratorAST* decl = 0 ;
680
+ if (!parseDeclarator (decl))
681
+ {
682
+ return false ;
683
+ }
684
+
685
+ InitDeclaratorAST* init_decl = CreateNode<InitDeclaratorAST>(_M_pool);
686
+ init_decl->declarator = decl;
687
+ init_decl->initializer = 0 ;
688
+ const ListNode<InitDeclaratorAST*>* declarators = 0 ;
689
+ declarators = snoc (declarators, init_decl, _M_pool);
690
+
691
+ ADVANCE (' =' , " =" );
692
+
693
+ TypeSpecifierAST* spec = 0 ;
694
+ if (!parseTypeSpecifierOrClassSpec (spec))
695
+ {
696
+ reportError ((" Need a type specifier to declare" ));
697
+ return false ;
698
+ }
699
+
700
+ TypedefAST* ast = CreateNode<TypedefAST>(_M_pool);
701
+ ast->type_specifier = spec;
702
+ ast->init_declarators = declarators;
703
+
704
+ UPDATE_POS (ast, start, token_stream.cursor ());
705
+ node = ast;
706
+
707
+ return true ;
708
+ }
709
+
670
710
bool Parser::parseUsingDirective (DeclarationAST *&node)
671
711
{
672
712
std::size_t start = token_stream.cursor ();
0 commit comments