diff --git a/uppsrc/CppBase/CppBase.h b/uppsrc/CppBase/CppBase.h index 15645ad03..35f9ba15d 100644 --- a/uppsrc/CppBase/CppBase.h +++ b/uppsrc/CppBase/CppBase.h @@ -551,6 +551,7 @@ struct Parser { bool UsingNamespace(); void SetScopeCurrent(); void ScopeBody(); + void DoNamespace(); void Do(); String AnonymousName(); String StructDeclaration(const String& tp, const String& tn); diff --git a/uppsrc/CppBase/Parser.cpp b/uppsrc/CppBase/Parser.cpp index ea4ff41ec..c6d2e3128 100644 --- a/uppsrc/CppBase/Parser.cpp +++ b/uppsrc/CppBase/Parser.cpp @@ -1500,6 +1500,17 @@ void Parser::ClassEnum() SetScopeCurrent(); } +void Parser::DoNamespace() +{ + if(Key('{')) + while(!Key('}')) { + if(lex == t_eof) + ThrowError("Unexpected end of file"); + Do(); + } + Key(';'); +} + void Parser::Do() { LLOG("Do, scope: " << current_scope); @@ -1513,18 +1524,18 @@ void Parser::Do() while(lex != t_eof && lex != ';') ++lex; else + if(lex == tk_inline && lex[1] == tk_namespace) { // for now, inline namespace is simply ignored + while(lex != t_eof && lex != '{') + ++lex; + DoNamespace(); + } + else if(Key(';')) // 'empty' declaration, result of some ignores ; else if(Key(tk_extern) && lex == t_string) { // extern "C++" kind ++lex; - if(Key('{')) - while(!Key('}')) { - if(lex == t_eof) - ThrowError("Unexpected end of file"); - Do(); - } - Key(';'); + DoNamespace(); } else if(Key(tk_template)) {