From 50ccc8346bc2b30e3b98811f71ca33fa62e9524d Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 14 Sep 2008 16:50:17 +0000 Subject: [PATCH] Fixed initializer list in C++ parser git-svn-id: svn://ultimatepp.org/upp/trunk@447 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/ignorelist | 2 ++ uppsrc/CppBase/Parser.cpp | 18 +++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/uppsrc/Core/ignorelist b/uppsrc/Core/ignorelist index 71d7b74f7..df428500a 100644 --- a/uppsrc/Core/ignorelist +++ b/uppsrc/Core/ignorelist @@ -33,3 +33,5 @@ __CLRCALL_OR_CDECL _CRTIMP2_PURE_DEBUG_IT _CRTIMP2_PURE __declspec +NAMESPACE_UPP +END_UPP_NAMESPACE diff --git a/uppsrc/CppBase/Parser.cpp b/uppsrc/CppBase/Parser.cpp index 61b7a7fc4..b4214f9e4 100644 --- a/uppsrc/CppBase/Parser.cpp +++ b/uppsrc/CppBase/Parser.cpp @@ -484,9 +484,9 @@ int Parser::RPtr() void Parser::EatInitializers() { - if(Key(':')) { - while(lex != '{' && lex != t_eof) ++lex; - } + if(Key(':')) + while(lex != '{' && lex != t_eof) + ++lex; } void Parser::Declarator(Decl& d, const char *p) @@ -556,15 +556,15 @@ void Parser::Declarator(Decl& d, const char *p) } } if(Key('=') || (inbody && lex == '(')) { - int lvl = 0; + int level = 0; for(;;) { - if(lex == t_eof || lvl == 0 && (lex == ',' || lex == ')' || lex == ';')) + if(lex == t_eof || level == 0 && (lex == ',' || lex == ')' || lex == ';')) break; - if(Key('(')) - lvl++; + if(Key('(') || Key('{')) + level++; else - if(Key(')')) - lvl--; + if(Key(')') || Key('}')) + level--; else ++lex; }