int main(int argc, char* argv[]) { ParseCommandLine(argc, argv); int err = 0; Reference ref; if ((err = createReference(OPT_reffilename, &ref))) { printStringForError(err); exit(err); } QuerySet queries; if ((err = createQuerySet(OPT_qryfilename, &queries))) { printStringForError(err); exit(err); } MatchContext ctx; if ((err = createMatchContext(&ref, &queries, 0, options, OPT_match_length, OPT_stats_file, OPT_reverse, OPT_forwardreverse, OPT_forwardcoordinates, OPT_showQueryLength, &ctx))) { printStringForError(err); exit(err); } if ((err = matchQueries(&ctx))) { printStringForError(err); exit(err); } if ((err = destroyMatchContext(&ctx))) { printStringForError(err); exit(err); } }
std::string DomElement::declare() const { var_ = "j" + boost::lexical_cast<std::string>(nextId_++); return var_ + "=" + createReference() + ';'; }
void aJsonClass::addItemReferenceToObject(aJsonObject *object, const char *string, aJsonObject *item) { addItemToObject(object, string, createReference(item)); }
void aJsonClass::addItemReferenceToArray(aJsonObject *array, aJsonObject *item) { addItemToArray(array, createReference(item)); }
QSObject QSFuncRefClass::construct( const QSList &args ) const { // ### QString p = QString::fromLatin1(""); QString body; int argsSize = args.size(); if (argsSize == 0) { body = ""; } else if (argsSize == 1) { body = args[0].toString(); } else { p = args[0].toString(); for (int k = 1; k < argsSize - 1; k++) p += QString::fromLatin1(",") + args[k].toString(); body = args[argsSize-1].toString(); } QSLexer::lexer()->setCode( body, -1 ); if ( qsyyparse() ) { /* TODO: free nodes */ return env()->throwError( SyntaxError, QString::fromLatin1("Syntax error in function body") ); } QSFunctionScopeClass *scope = new QSFunctionScopeClass( env()->objectClass() ); QSFunctionBodyNode * bodyNode = QSProgramNode::last(); bodyNode->setScopeDefinition( scope ); scope->setFunctionBodyNode(bodyNode); QSMember mem( bodyNode ); // parse parameter list. throw syntax error on illegal identifiers int len = p.length(); const QChar *c = p.unicode(); int i = 0, params = 0; QString param; while (i < len) { while (*c == ' ' && i < len) c++, i++; if ( QSLexer::isIdentLetter( c->unicode() ) ) { // else error param = QString(c, 1); c++, i++; while (i < len && ( QSLexer::isIdentLetter( c->unicode() ) || QSLexer::isDecimalDigit( c->unicode() ) ) ) { param += QString(c, 1); c++, i++; } while (i < len && *c == ' ') c++, i++; if (i == len) { int index = scope->addVariableMember( param, AttributeNone ); Q_ASSERT( params==index ); params++; break; } else if (*c == ',') { int index = scope->addVariableMember( param, AttributeNone ); Q_ASSERT( params==index ); params++; c++, i++; continue; } // else error } return env()->throwError( SyntaxError, QString::fromLatin1("Syntax error in parameter list") ); } scope->setNumArguments( params ); return createReference( env()->currentScope(), mem ); }