void ParserThread::ReadFunctionArguments(ArgumentList &args) { //TKN_L_PAREN args.clear(); ConsumeToken();//remove the first TKN_L_PAREN PushContext(); m_Context.parseType = FunctionParameter; DoParse(); PopContext(); }
bool ParserThread::ParseArgumentList(ArgumentList &argumentList) { // do nothing on the argumentList, just do the loop if(PeekToken()->type_id() != TKN_LESS) return true; // shoud be a (xxxx) or <xxxxx> Token * tk = ConsumeToken(); TRACE("ParserThread::ParseArgumentList() Enter..."); int level = 1; argumentList.clear(); argumentList.push_back(*tk); // push <while(true) while(true) { tk = PeekToken();// if(tk->type_id() == TKN_LESS) { ConsumeToken(); argumentList.push_back(*tk); level++; } else if (tk->type_id() == TKN_GREATER) { level--; ConsumeToken(); argumentList.push_back(*tk); if(level <= 0) break; } else if(tk->type_id()==TKN_SEMICOLON || tk->type_id()==TKN_R_BRACE) { m_Context.EndStatement(); return false; } else { //std::cout<<*tk<<std::endl; argumentList.push_back(*tk); ConsumeToken(); } } //cout<<"currentToken"<<*(CurrentToken())<<endl; TRACE("ParserThread::ParseArgumentList() Leave..."); return true; }