//<Node> void LibraryParser::ParseNode(TiXmlNode* pParent) { GetNodeAttributes(pParent ) ; TiXmlNode* Child; string Elem; for (Child = pParent->FirstChild() ; Child != 0; Child = Child->NextSibling() ) { Elem = Child->ValueStr() ; if (Elem == "Interface") { ParseInterface(Child ) ; } else { cout << "Unknown XML element "<< Elem << " in file "<< mFname << endl ; } } //Add node to the library mLib->AddNode(mCurrentNode) ; }
void CUDisks2Provider::ParseInterfaces(DBusMessageIter *objIter) { DBusMessageIter dictIter; const char *object; dbus_message_iter_get_basic(objIter, &object); dbus_message_iter_next(objIter); dbus_message_iter_recurse(objIter, &dictIter); while (dbus_message_iter_get_arg_type(&dictIter) == DBUS_TYPE_DICT_ENTRY) { DBusMessageIter ifaceIter, propsIter; const char *iface; dbus_message_iter_recurse(&dictIter, &ifaceIter); dbus_message_iter_get_basic(&ifaceIter, &iface); dbus_message_iter_next(&ifaceIter); dbus_message_iter_recurse(&ifaceIter, &propsIter); ParseInterface(object, iface, &propsIter/*, &discovery*/); dbus_message_iter_next(&dictIter); } }
void GFGLink::ParseLine ( const JString& data ) { // we only care about virtual functions JBoolean required = kJFalse; if (data.Contains("implementation:pure virtual")) { required = kJTrue; } else if (!data.Contains("implementation:virtual")) { return; } JArray<JIndexRange> subList; if (memberLine.Match(data, &subList)) { JIndexRange sRange = subList.GetElement(2); JString name = data.GetSubstring(sRange); if (name.BeginsWith("~")) { return; } GFGMemberFunction* fn = jnew GFGMemberFunction(); assert(fn != NULL); fn->SetFnName(name); fn->ShouldBeRequired(required); sRange = subList.GetElement(3); JIndex line; JString lineStr = data.GetSubstring(sRange); lineStr.ConvertToUInt(&line); sRange = subList.GetElement(4); JString base = data.GetSubstring(sRange); if (base != itsCurrentClass) { jdelete fn; return; } sRange = subList.GetElement(5); JString access = data.GetSubstring(sRange); if (access == "protected") { fn->ShouldBeProtected(kJTrue); } ParseInterface(fn, line); // Override entry from base class so function will only be // marked as pure virtual if nobody implemented it. JBoolean found; const JIndex i = itsClassList->SearchSorted1(fn, JOrderedSetT::kAnyMatch, &found); if (found) { itsClassList->DeleteElement(i); } itsClassList->InsertAtIndex(i, fn); } }
asCScriptNode *asCParser::ParseScript() { asCScriptNode *node = new asCScriptNode(snScript); // Determine type of node sToken t1; for(;;) { while( !isSyntaxError ) { GetToken(&t1); RewindTo(&t1); if( t1.type == ttImport ) node->AddChildLast(ParseImport()); else if( t1.type == ttClass ) node->AddChildLast(ParseClass()); else if( t1.type == ttInterface ) node->AddChildLast(ParseInterface()); else if( t1.type == ttConst ) node->AddChildLast(ParseGlobalVar()); else if( IsDataType(t1.type) ) { if( IsVarDecl() ) node->AddChildLast(ParseGlobalVar()); else node->AddChildLast(ParseFunction()); } else if( t1.type == ttEndStatement ) { // Ignore a semicolon by itself GetToken(&t1); } else if( t1.type == ttEnd ) return node; else { asCString str; const char *t = asGetTokenDefinition(t1.type); if( t == 0 ) t = "<unknown token>"; str.Format(TXT_UNEXPECTED_TOKEN_s, t); Error(str.AddressOf(), &t1); } } if( isSyntaxError ) { // Search for either ';' or '{' or end GetToken(&t1); while( t1.type != ttEndStatement && t1.type != ttEnd && t1.type != ttStartStatementBlock ) GetToken(&t1); if( t1.type == ttStartStatementBlock ) { // Find the end of the block and skip nested blocks int level = 1; while( level > 0 ) { GetToken(&t1); if( t1.type == ttStartStatementBlock ) level++; if( t1.type == ttEndStatementBlock ) level--; if( t1.type == ttEnd ) break; } } isSyntaxError = false; } } return 0; }