您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ token函数代码示例

51自学网 2021-06-03 08:55:02
  C++
这篇教程C++ token函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中token函数的典型用法代码示例。如果您正苦于以下问题:C++ token函数的具体用法?C++ token怎么用?C++ token使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了token函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: opcodeify

// Turns LLL tree into tree of code fragmentsprogramData opcodeify(Node node,                      programAux aux=Aux(),                      programVerticalAux vaux=verticalAux()) {    std::string symb = "_"+mkUniqueToken();    Metadata m = node.metadata;    // Numbers    if (node.type == TOKEN) {        return pd(aux, nodeToNumeric(node), 1);    }    else if (node.val == "ref" || node.val == "get" || node.val == "set") {        std::string varname = node.args[0].val;        // Determine reference to variable        if (!aux.vars.count(node.args[0].val)) {            aux.vars[node.args[0].val] = utd(aux.nextVarMem);            aux.nextVarMem += 32;        }        Node varNode = tkn(aux.vars[varname], m);        //std::cerr << varname << " " << printSimple(varNode) << "/n";        // Set variable        if (node.val == "set") {            programData sub = opcodeify(node.args[1], aux, vaux);            if (!sub.outs)                err("Value to set variable must have nonzero arity!", m);            // What if we are setting a stack variable?            if (vaux.dupvars.count(node.args[0].val)) {                int h = vaux.height - vaux.dupvars[node.args[0].val];                if (h > 16) err("Too deep for stack variable (max 16)", m);                Node nodelist[] = {                    sub.code,                    token("SWAP"+unsignedToDecimal(h), m),                    token("POP", m)                };                return pd(sub.aux, multiToken(nodelist, 3, m), 0);                               }            // Setting a memory variable            else {                Node nodelist[] = {                    sub.code,                    varNode,                    token("MSTORE", m),                };                return pd(sub.aux, multiToken(nodelist, 3, m), 0);                               }        }        // Get variable        else if (node.val == "get") {            // Getting a stack variable            if (vaux.dupvars.count(node.args[0].val)) {                 int h = vaux.height - vaux.dupvars[node.args[0].val];                if (h > 16) err("Too deep for stack variable (max 16)", m);                return pd(aux, token("DUP"+unsignedToDecimal(h)), 1);                               }            // Getting a memory variable            else {                Node nodelist[] =                      { varNode, token("MLOAD", m) };                return pd(aux, multiToken(nodelist, 2, m), 1);            }        }        // Refer variable        else if (node.val == "ref") {            if (vaux.dupvars.count(node.args[0].val))                err("Cannot ref stack variable!", m);            return pd(aux, varNode, 1);        }    }    // Comments do nothing    else if (node.val == "comment") {        return pd(aux, astnode("_", m), 0);    }    // Custom operation sequence    // eg. (ops bytez id msize swap1 msize add 0 swap1 mstore) == alloc    if (node.val == "ops") {        std::vector<Node>  subs2;        int depth = 0;        for (unsigned i = 0; i < node.args.size(); i++) {            std::string op = upperCase(node.args[i].val);            if (node.args[i].type == ASTNODE || opinputs(op) == -1) {                programVerticalAux vaux2 = vaux;                vaux2.height = vaux.height - i - 1 + node.args.size();                programData sub = opcodeify(node.args[i], aux, vaux2);                aux = sub.aux;                depth += sub.outs;                subs2.push_back(sub.code);            }            else {                subs2.push_back(token(op, m));                depth += opoutputs(op) - opinputs(op);            }        }        if (depth < 0 || depth > 1) err("Stack depth mismatch", m);        return pd(aux, astnode("_", subs2, m), 0);    }    // Code blocks    if (node.val == "lll" && node.args.size() == 2) {        if (node.args[1].val != "0") aux.allocUsed = true;        std::vector<Node> o;        o.push_back(finalize(opcodeify(node.args[0])));        programData sub = opcodeify(node.args[1], aux, vaux);//.........这里部分代码省略.........
开发者ID:AndresAH,项目名称:cpp-ethereum,代码行数:101,


示例2: die

static struct test *read_tests(void) {    char *fname = NULL;    FILE *fp;    char line[BUFSIZ];    struct test *result = NULL, *t = NULL;    int lc = 0;    bool append_cmd = true;    if (asprintf(&fname, "%s/tests/run.tests", abs_top_srcdir) < 0)        die("asprintf fname");    if ((fp = fopen(fname, "r")) == NULL)        die("fopen run.tests");    while (fgets(line, BUFSIZ, fp) != NULL) {        lc += 1;        char *s = skipws(line);        if (*s == '#' || *s == '/0')            continue;        if (*s == ':')            s += 1;        char *eos = s + strlen(s) - 2;        if (eos >= s && *eos == ':') {            *eos++ = '/n';            *eos = '/0';        }        if (looking_at(s, KW_TEST)) {            if (ALLOC(t) < 0)                die_oom();            list_append(result, t);            append_cmd = true;            s = token(s + strlen(KW_TEST), &(t->name));            s = inttok(s, &t->result);            s = errtok(s, &t->errcode);        } else if (looking_at(s, KW_PRINTS)) {            s = skipws(s + strlen(KW_PRINTS));            t->out_present = looking_at(s, KW_SOMETHING);            append_cmd = false;        } else if (looking_at(s, KW_USE)) {            if (t->module !=NULL)                die("Can use at most one module in a test");            s = token(s + strlen(KW_USE), &(t->module));        } else {            char **buf = append_cmd ? &(t->cmd) : &(t->out);            if (*buf == NULL) {                *buf = strdup(s);                if (*buf == NULL)                    die_oom();            } else {                if (REALLOC_N(*buf, strlen(*buf) + strlen(s) + 1) < 0)                    die_oom();                strcat(*buf, s);            }        }        if (t->out != NULL)            t->out_present = true;    }    free(fname);    return result;}
开发者ID:manandbytes,项目名称:augeas,代码行数:61,


示例3: token

void QtHistoTfuncPixmap::loadfile(QString fn){	if(fn.isEmpty()) return;	//temp storage for param parsing	string label;	int i;	int size;	Vector v;	//clear our BSs	funceditor.bs.clear();	//input file for reading in parameter ranges	ifstream input_file; 	input_file.open(fn.latin1());	//tokenize our input file	Tokenizer token(input_file);	//until oef is reached step through each token	while(!input_file.eof()){		if(token.ttype()==TT_WORD)		{			//get the first string lable			label = token.sval();						if(label=="THRESHOLD_LEVELS")			{						token.nextToken();				if(token.ttype()==TT_NUMBER) minthr = token.nval();				token.nextToken();				if(token.ttype()==TT_NUMBER) maxthr = token.nval();				token.nextToken();			}						else if(label=="TF_CONTROL_POINTS")			{						token.nextToken();				if(token.ttype()==TT_NUMBER) size = token.nval();								for(i=0; i<size; i++)				{					token.nextToken();					if(token.ttype()==TT_NUMBER) v.x = token.nval();					token.nextToken();					if(token.ttype()==TT_NUMBER) v.y = token.nval();					token.nextToken();					if(token.ttype()==TT_NUMBER) v.z = token.nval();					funceditor.bs.control_points.push_back(v);				}			}							//else if we dont know what it is, go to next label			else			{				//f<<"WARNING: Unrecognized Label..."<<endl;				token.nextToken();			}		}		else token.nextToken();	}	input_file.close();	//compute our BS curve from our loaded control points	funceditor.bs.compute();}
开发者ID:ut666,项目名称:VolViewer,代码行数:67,


示例4: main

//.........这里部分代码省略.........			receiverProxy.reset(new ReceiverBindingProxy(tds__GetCapabilitiesResponse.Capabilities->Extension->Receiver->XAddr.c_str()));		}		std::unique_ptr<RecordingBindingProxy> recordingProxy;		if ( (tds__GetCapabilitiesResponse.Capabilities->Extension != NULL) && (tds__GetCapabilitiesResponse.Capabilities->Extension->Recording != NULL) )		{			std::cout << "/tRecording Url:" << tds__GetCapabilitiesResponse.Capabilities->Extension->Recording->XAddr << std::endl;						recordingProxy.reset(new RecordingBindingProxy(tds__GetCapabilitiesResponse.Capabilities->Extension->Recording->XAddr.c_str()));		}				std::unique_ptr<SearchBindingProxy> searchProxy;		if ( (tds__GetCapabilitiesResponse.Capabilities->Extension != NULL) && (tds__GetCapabilitiesResponse.Capabilities->Extension->Search != NULL) )		{			std::cout << "/tSearch Url:" << tds__GetCapabilitiesResponse.Capabilities->Extension->Search->XAddr << std::endl;						searchProxy.reset (new SearchBindingProxy(tds__GetCapabilitiesResponse.Capabilities->Extension->Search->XAddr.c_str()));		}		std::unique_ptr<EventBindingProxy> eventProxy;		if (tds__GetCapabilitiesResponse.Capabilities->Events != NULL)		{			std::cout << "/tEvent Url:" << tds__GetCapabilitiesResponse.Capabilities->Events->XAddr << std::endl;						eventProxy.reset(new EventBindingProxy(tds__GetCapabilitiesResponse.Capabilities->Events->XAddr.c_str()));		}						if (mediaProxy.get() != NULL)		{			// call Media::GetVideoSources			std::cout << "=>Media::GetVideoSources" << std::endl;							_trt__GetVideoSources         trt__GetVideoSources;			_trt__GetVideoSourcesResponse trt__GetVideoSourcesResponse;						addSecurity(mediaProxy->soap, username, password);				if (mediaProxy->GetVideoSources(&trt__GetVideoSources, &trt__GetVideoSourcesResponse) == SOAP_OK)			{						for (auto source : trt__GetVideoSourcesResponse.VideoSources)				{					std::cout << "/t" << source->token;					if (source->Resolution)					{						std::cout << " " << source->Resolution->Width << "x" << source->Resolution->Height;					}					std::cout << std::endl;										_trt__GetVideoEncoderConfiguration         trt__GetVideoEncoderConfiguration;					trt__GetVideoEncoderConfiguration.ConfigurationToken = source->token;					_trt__GetVideoEncoderConfigurationResponse trt__GetVideoEncoderConfigurationResponse;					addSecurity(mediaProxy->soap, username, password);											if (mediaProxy->GetVideoEncoderConfiguration(&trt__GetVideoEncoderConfiguration, &trt__GetVideoEncoderConfigurationResponse) == SOAP_OK)					{								std::cout << "/tEncoding:" << trt__GetVideoEncoderConfigurationResponse.Configuration->Encoding << std::endl;						if (trt__GetVideoEncoderConfigurationResponse.Configuration->H264)						{							std::cout << "/tH264Profile:" << trt__GetVideoEncoderConfigurationResponse.Configuration->H264->H264Profile << std::endl;						}						if (trt__GetVideoEncoderConfigurationResponse.Configuration->Resolution)						{							std::cout << "/tResolution:" << trt__GetVideoEncoderConfigurationResponse.Configuration->Resolution->Width << "x" << trt__GetVideoEncoderConfigurationResponse.Configuration->Resolution->Height << std::endl;						}					}					_trt__GetVideoEncoderConfigurationOptions         trt__GetVideoEncoderConfigurationOptions;					trt__GetVideoEncoderConfigurationOptions.ConfigurationToken = soap_new_std__string(mediaProxy->soap);					trt__GetVideoEncoderConfigurationOptions.ConfigurationToken->assign(source->token);					_trt__GetVideoEncoderConfigurationOptionsResponse trt__GetVideoEncoderConfigurationOptionsResponse;					addSecurity(mediaProxy->soap, username, password);											if (mediaProxy->GetVideoEncoderConfigurationOptions(&trt__GetVideoEncoderConfigurationOptions, &trt__GetVideoEncoderConfigurationOptionsResponse) == SOAP_OK)					{							if (trt__GetVideoEncoderConfigurationOptionsResponse.Options->H264)						{
开发者ID:denisstepanenko,项目名称:v4l2onvif,代码行数:67,


示例5: scriptBuilder

bool Parser::Impl::parseTestList(){    // test-list := "(" test *("," test) ")"    if(!obtainToken() || atEnd())        return false;    if(token() != Lexer::Special || tokenValue() != "(")        return false;    if(scriptBuilder())        scriptBuilder()->testListStart();    consumeToken();    // generic while/switch construct for comma-separated lists. See    // parseStringList() for another one. Any fix here is like to apply there, too.    bool lastWasComma = true;    while(!atEnd())    {        if(!obtainToken())            return false;        switch(token())        {            case Lexer::None:                break;            case Lexer::Special:                assert(tokenValue().length() == 1);                assert(tokenValue()[0].latin1());                switch(tokenValue()[0].latin1())                {                    case ')':                        consumeToken();                        if(lastWasComma)                        {                            makeError(Error::ConsecutiveCommasInTestList);                            return false;                        }                        if(scriptBuilder())                            scriptBuilder()->testListEnd();                        return true;                    case ',':                        consumeToken();                        if(lastWasComma)                        {                            makeError(Error::ConsecutiveCommasInTestList);                            return false;                        }                        lastWasComma = true;                        break;                    default:                        makeError(Error::NonStringInStringList);                        return false;                }                break;            case Lexer::Identifier:                if(!lastWasComma)                {                    makeError(Error::MissingCommaInTestList);                    return false;                }                else                {                    lastWasComma = false;                    if(!parseTest())                    {                        assert(error());                        return false;                    }                }                break;            default:                makeUnexpectedTokenError(Error::NonTestInTestList);                return false;        }    }    makeError(Error::PrematureEndOfTestList);    return false;}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:81,


示例6: while

bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar){    unsigned short        w, wi, prv, st;    float        ww;    CBotString    name, s;    delete pVar;                pVar    = NULL;    CBotVar*    pNew    = NULL;    CBotVar*    pPrev    = NULL;    while ( true )            // retrieves a list    {        if (!ReadWord(pf, w)) return false;                        // private or type?        if ( w == 0 ) return true;        CBotString defnum;        if ( w == 200 )        {            if (!ReadString(pf, defnum)) return false;            // number with identifier            if (!ReadWord(pf, w)) return false;                    // type        }        prv = 100; st = 0;        if ( w >= 100 )        {            prv = w;            if (!ReadWord(pf, st)) return false;                // static            if (!ReadWord(pf, w)) return false;                    // type        }        if ( w == CBotTypClass ) w = CBotTypIntrinsic;            // necessarily intrinsic        if (!ReadWord(pf, wi)) return false;                    // init ?        if (!ReadString(pf, name)) return false;                // variable name        CBotToken token(name, CBotString());        switch (w)        {        case CBotTypInt:        case CBotTypBoolean:            pNew = CBotVar::Create(&token, w);                        // creates a variable            if (!ReadWord(pf, w)) return false;            pNew->SetValInt(static_cast<short>(w), defnum);            break;        case CBotTypFloat:            pNew = CBotVar::Create(&token, w);                        // creates a variable            if (!ReadFloat(pf, ww)) return false;            pNew->SetValFloat(ww);            break;        case CBotTypString:            pNew = CBotVar::Create(&token, w);                        // creates a variable            if (!ReadString(pf, s)) return false;            pNew->SetValString(s);            break;        // returns an intrinsic object or element of an array        case CBotTypIntrinsic:        case CBotTypArrayBody:            {                CBotTypResult    r;                long            id;                if (!ReadType(pf, r))  return false;                // complete type                if (!ReadLong(pf, id) ) return false;//                if (!ReadString(pf, s)) return false;                {                    CBotVar* p = NULL;                    if ( id ) p = CBotVarClass::Find(id) ;                    pNew = new CBotVarClass(&token, r);                // directly creates an instance                                                                    // attention cptuse = 0                    if ( !RestoreState(pf, (static_cast<CBotVarClass*>(pNew))->m_pVar)) return false;                    pNew->SetIdent(id);                    if ( p != NULL )                    {                        delete pNew;                        pNew = p;            // resume known element                     }                }            }            break;        case CBotTypPointer:        case CBotTypNullPointer:            if (!ReadString(pf, s)) return false;            {                pNew = CBotVar::Create(&token, CBotTypResult(w, s));// creates a variable//                CBotVarClass* p = NULL;                long id;                ReadLong(pf, id);//                if ( id ) p = CBotVarClass::Find(id);        // found the instance (made by RestoreInstance)                // returns a copy of the original instance                CBotVar* pInstance = NULL;                if ( !CBotVar::RestoreState( pf, pInstance ) ) return false;//.........这里部分代码省略.........
开发者ID:PaweX,项目名称:colobot,代码行数:101,


示例7: lineparse

static void lineparse(){  char* tokn, *env, *envName, *tmp1, *tmp2;  long l, in_template;  varname[0] = '/0';  objname[0] = '/0';  if (!strcmp(tok1,"end")) {strcpy(curstruct,"--"); in_template = 0;}  if (!strcmp(tok1,"structure")) {strcpy(curstruct,tok2);}  if (!strcmp(tok1,"database")) ;  if (!strcmp(tok1,"incname")) ;  if (!strcmp(tok1,"index")) ;  if (!strcmp(tok1,"provide")) ;  if (!strcmp(tok1,"parent")) ;  if (!strcmp(tok1,"child")) ;  if (!strcmp(tok1,"dimension")) ;  if (!strcmp(tok1,"template")) {in_template = 1; strcpy(curstruct,tok2);    n_instance = 0;}  if (!strcmp(tok1,"command")) {in_template = 1; strcpy(curstruct,tok2);}  if (!strcmp(tok1,"include")) {  /* switch input to specified file */ /* ** Commented out, we use absolute path name in the includes.  ** This allows us to go to more than one directory.. *//*    strcpy(filename,dbpath); */ /*    strcat(filename,tok2); *//*** We now implement translation of environmental variable***/      if (tok2[0] == '$') {         tmp1 = strchr(&tok2[1], '/');         if (tmp1 == NULL) {              fprintf(stderr, "DBin error, Unkonw path %s/n", tok2);              return;         }         envName = (char *) malloc(sizeof(char) * (strlen(tok2)+1));         strcpy(envName, &tok2[1]);         tmp2 = strchr(envName, '/'); *tmp2 = '/0';         env = getenv(envName);         free(envName);                  if (env == NULL) {               fprintf(stderr, "DBin error, Unkonw path %s/n", tok2);              return;         }         strcpy(filename,env); l = strlen(env); filename[l] = '/'; l++;         strcpy(&filename[l], tmp1);                  } else  strcpy(filename, tok2);    inc_depth++;  }   if (!strcmp(tok1,"make")) {    n_instance++;    strcpy(varname,"TEMPLATE_");    strcat(varname,stlower(tok2));  }  if (!strcmp(tok1,"define")) {      /* get first token (name) from values list */    tokn = token(&values," /t");    strcpy(varname,"TEMPLATE_");    strcat(varname,tok2);    strcpy(objname,tok2);    strcat(objname,"_");    strcat(objname,tokn);  }  if (!strcmp(tok1,"call")) {      /* get first token (name) from values list */    tokn = token(&values," /t");    strcpy(varname,"COMMAND_");    strcat(varname,tok2);  }  if (!strncmp(tok1,"int",3) || !strcmp(tok1,"real") || !strcmp(tok1,"double") ||      !strncmp(tok1,"char",4) || !strcmp(tok1,"material") ) {    if ((! strncmp(curstruct,"--",2)) && (in_template == 0)) {      fprintf(stdout,"dbin: Parameter /"%s/" not in structure; ignored:/n",              tok2);      fprintf(stdout,"      %s/n",line);    } else {        /* parse values */      strcpy(varname,curstruct);      strcat(varname,".");      strcat(varname,tok2);      getvalues();    }  }}
开发者ID:JeffersonLab,项目名称:HPS-CODE,代码行数:86,


示例8: FNTRACE

// primaryExpr ::= NUMBER//               | STRING//               | variable//               | function '(' exprList ')'//               | '(' expr ')'std::unique_ptr<Expr> FlowParser::primaryExpr(){	FNTRACE();	static struct {		const char* ident;		long long nominator;		long long denominator;	} units[] = {		{ "byte", 1, 1 },		{ "kbyte", 1024llu, 1 },		{ "mbyte", 1024llu * 1024, 1 },		{ "gbyte", 1024llu * 1024 * 1024, 1 },		{ "tbyte", 1024llu * 1024 * 1024 * 1024, 1 },		{ "bit", 1, 8 },		{ "kbit", 1024llu, 8 },		{ "mbit", 1024llu * 1024, 8 },		{ "gbit", 1024llu * 1024 * 1024, 8 },		{ "tbit", 1024llu * 1024 * 1024 * 1024, 8 },		{ "sec", 1, 1 },		{ "min", 60llu, 1 },		{ "hour", 60llu * 60, 1 },		{ "day", 60llu * 60 * 24, 1 },		{ "week", 60llu * 60 * 24 * 7, 1 },		{ "month", 60llu * 60 * 24 * 30, 1 },		{ "year", 60llu * 60 * 24 * 365, 1 },		{ nullptr, 1, 1 }	};	FlowLocation loc(location());	switch (token()) {		case FlowToken::Ident: {			std::string name = stringValue();			nextToken();			Symbol* symbol = scope()->lookup(name, Lookup::All);			if (!symbol) {                // XXX assume that given symbol is a auto forward-declared handler.                Handler* href = (Handler*) globalScope()->appendSymbol(std::make_unique<Handler>(name, loc));				return std::make_unique<HandlerRefExpr>(href, loc);			}			if (auto variable = dynamic_cast<Variable*>(symbol))				return std::make_unique<VariableExpr>(variable, loc);			if (auto handler = dynamic_cast<Handler*>(symbol))				return std::make_unique<HandlerRefExpr>(handler, loc);			if (symbol->type() == Symbol::BuiltinFunction) {				if (token() != FlowToken::RndOpen)					return std::make_unique<FunctionCallExpr>((BuiltinFunction*) symbol, ExprList()/*args*/, loc);				nextToken();                ExprList args;				bool rv = listExpr(args);				consume(FlowToken::RndClose);				if (!rv) return nullptr;				return std::make_unique<FunctionCallExpr>((BuiltinFunction*) symbol, std::move(args), loc);			}			reportError("Unsupported symbol type of '%s' in expression.", name.c_str());			return nullptr;		}		case FlowToken::Boolean: {			std::unique_ptr<BoolExpr> e = std::make_unique<BoolExpr>(booleanValue(), loc);			nextToken();			return std::move(e);		}		case FlowToken::RegExp: {			std::unique_ptr<RegExpExpr> e = std::make_unique<RegExpExpr>(RegExp(stringValue()), loc);			nextToken();			return std::move(e);		}		case FlowToken::InterpolatedStringFragment:			return interpolatedStr();		case FlowToken::String:		case FlowToken::RawString: {			std::unique_ptr<StringExpr> e = std::make_unique<StringExpr>(stringValue(), loc);			nextToken();			return std::move(e);		}		case FlowToken::Number: { // NUMBER [UNIT]			auto number = numberValue();			nextToken();			if (token() == FlowToken::Ident) {				std::string sv(stringValue());				for (size_t i = 0; units[i].ident; ++i) {					if (sv == units[i].ident						|| (sv[sv.size() - 1] == 's' && sv.substr(0, sv.size() - 1) == units[i].ident))					{						nextToken(); // UNIT						number = number * units[i].nominator / units[i].denominator;						loc.update(end());//.........这里部分代码省略.........
开发者ID:hiwang123,项目名称:x0,代码行数:101,


示例9: token

bool CDropbox::HasAccessToken(){	ptrA token(db_get_sa(NULL, MODULE, "TokenSecret"));	return token != NULL;}
开发者ID:ybznek,项目名称:miranda-ng,代码行数:5,


示例10: reportError

// }}}// {{{ error mgntvoid FlowParser::reportUnexpectedToken(){	reportError("Unexpected token '%s'", token().c_str());}
开发者ID:hiwang123,项目名称:x0,代码行数:6,


示例11: while

NitLexer::Token NitLexer::lex(){	int tk;	while (_ch != CHAR_EOS)	{		whitespace();		switch (_ch)		{		case CHAR_EOS:			return token(TK_EOS);		case '/':			next();			switch (_ch)			{			case '*': next(); blockComment(); continue;			case '/': lineComment(); continue;			case '=': next(); return token(TK_DIVEQ);			default:  return token('/');			}			break;		case '=':			next();			if (_ch == '>') { next(); return token(TK_LAMBDA); }			if (_ch == '=') { next(); return token(TK_EQ); }			return token('=');		case '<':			next();			if (_ch == '<') { next(); return token(TK_SHIFTL); }			if (_ch != '=') return token('<');			next();			if (_ch == '>') { next(); return token(TK_THREEWAYSCMP); }			return token(TK_LE);		case '>':			next();			if (_ch == '=') { next(); return token(TK_GE); }			if (_ch != '>') return token('>');			next();			if (_ch == '>') { next(); return token(TK_USHIFTR); }			return token(TK_SHIFTR);		case '!':			next();			if (_ch == '=') { next(); return token(TK_NE); }			return token('!');		case '@':			next();			if (_ch != '"' && _ch != '/'') return token('@');			if ((tk = readString(_ch, '@')) != -1) return token(tk);			return error("error parsing verbatim string");		case '"':		case '/'':			if (readString(_ch) != -1) return token(TK_STRING_VALUE);			return error("error parsing the string");		case '{': case '}': case '(': case ')': case '[': case ']':		case ';': case ',': case '?': case '^': case '~': case '$':			return token(next());		case '.':			next();			if (_ch != '.') return token('.');			next();			if (_ch != '.') return error("invalid token '..'");			next();			return token(TK_VARPARAMS);		case '&':			next();			if (_ch == '&') { next(); return token(TK_AND); }			return token('&');		case '|':			next();			if (_ch == '|') { next(); return token(TK_OR); }			return token('|');		case ':':			next();			if (_ch == '=') { next(); return token(TK_NEWSLOT); }			if (_ch == '>') { next(); return token(TK_WITHREF); }			if (_ch == ':') { next(); return token(TK_DOUBLE_COLON); }			return token(':');		case '*':			next();			if (_ch == '=') { next(); return token(TK_MULEQ); }			return token('*');		case '%':			next();			if (_ch == '=') { next(); return token(TK_MODEQ); }			return token('%');//.........这里部分代码省略.........
开发者ID:noriter,项目名称:nit,代码行数:101,


示例12: token

bool Parser::Impl::isStringToken() const{    return token() == Lexer::QuotedString ||           token() == Lexer::MultiLineString ;}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:5,


示例13: EHCI_MEM_READ

/*FUNCTION*-------------------------------------------------------------**  Function Name  : _usb_ehci_add_interrupt_xfer_to_periodic_list*  Returned Value : None*  Comments       :*        Queue the transfer in the EHCI hardware Periodic schedule list*END*-----------------------------------------------------------------*/uint_32 _usb_ehci_add_interrupt_xfer_to_periodic_list   (      /* [IN] the USB Host state structure */      _usb_host_handle                 handle,      /* The pipe descriptor to queue */                  PIPE_DESCRIPTOR_STRUCT_PTR       pipe_descr_ptr,            /* [IN] the transfer parameters struct */      PIPE_TR_STRUCT_PTR               pipe_tr_ptr   ){ /* Body */   USB_HOST_STATE_STRUCT_PTR                    usb_host_ptr;   VUSB20_REG_STRUCT_PTR                        dev_ptr;   ACTIVE_QH_MGMT_STRUCT_PTR                    active_list_member_ptr, temp_list_ptr;   EHCI_QH_STRUCT_PTR                           QH_ptr = NULL;   EHCI_QH_STRUCT_PTR                           prev_QH_ptr = NULL;   EHCI_QTD_STRUCT_PTR                          first_QTD_ptr, temp_QTD_ptr;   PIPE_DESCRIPTOR_STRUCT_PTR                   pipe_for_queue = NULL;   uint_32                                      cmd_val,sts_val;   uint_32                                      H_bit = 1;   uint_32                                      interrupt_sched_mask = 1;   boolean                                      init_periodic_list = FALSE;   boolean                                      found_existing_q_head = FALSE;   /* QH initialization fields */   uint_32                       control_ep_flag = 0;   uint_32                       split_completion_mask = 1;   uint_32                       data_toggle_control = 0, item_type = 0;   uint_8                        mult = 0, period = 0;   uint_32_ptr                   temp_frame_list_ptr = NULL;   usb_host_ptr = (USB_HOST_STATE_STRUCT_PTR)handle;   dev_ptr = (VUSB20_REG_STRUCT_PTR)usb_host_ptr->DEV_PTR;   /****************************************************************************   QTD MAKING       ****************************************************************************/   /* Initialize the QTDs for the Queue Head */   first_QTD_ptr = (EHCI_QTD_STRUCT_PTR)_usb_ehci_init_Q_element(                                          handle,pipe_descr_ptr, pipe_tr_ptr                                          );#ifdef DEBUG_INFO      {         uint_32 token = EHCI_MEM_READ(first_QTD_ptr->TOKEN);                  printf("QTD queued Top QTD Token=%x/n"            "   Status=%x,PID code=%x,error code=%x,page=%x,IOC=%x,Bytes=%x,Toggle=%x/n",          token          (token&0xFF),          (token >> 8)&0x3,          (token >> 10) &0x3,          (token >> 12)&0x7,          (token >> 15)&0x1,          (token >> 16)&0x7FFF,          (token&EHCI_QTD_DATA_TOGGLE) >>31);      }#endif   /****************************************************************************   Obtain the QH for this pipe   ****************************************************************************/   QH_ptr = (EHCI_QH_STRUCT_PTR) pipe_descr_ptr->QH_FOR_THIS_PIPE;      /****************************************************************************   Ensure that this QH is in the list of active QHs for interrupt pipe   ****************************************************************************/   /******************************************************************   If active list does not exist, we make a new list and this is the   first member of the list. Otherwise we append the list at the end.   *******************************************************************/   if(usb_host_ptr->ACTIVE_INTERRUPT_PERIODIC_LIST_PTR == NULL)   {      active_list_member_ptr = (ACTIVE_QH_MGMT_STRUCT_PTR)USB_mem_alloc_zero(sizeof(ACTIVE_QH_MGMT_STRUCT));      if (!active_list_member_ptr)       {         return USB_log_error(__FILE__,__LINE__,USBERR_ALLOC);      }      usb_host_ptr->ACTIVE_INTERRUPT_PERIODIC_LIST_PTR = active_list_member_ptr;      /****************************************************************      Connect the QH with the active list      ****************************************************************///.........这里部分代码省略.........
开发者ID:gxliu,项目名称:MQX_3.8.0,代码行数:101,


示例14: ruserpass

voidruserpass(char *host, char **aname, char **apass){    char *hdir, buf[BUFSIZ];    int t, usedefault = 0;    struct stat stb;    hdir = getenv("HOME");    if (hdir == NULL)	hdir = ".";    snprintf(buf, sizeof(buf), "%s/.netrc", hdir);    cfile = fopen(buf, "r");    if (cfile == NULL) {	if (errno != ENOENT)	    perror(buf);	goto done;    }    while ((t = token())) {	switch(t) {	case DEFAULT:	    usedefault = 1;	    /* FALL THROUGH */	case MACH:	    if (!usedefault) {		if (token() != ID)		    continue;		/*		 * Allow match either for user's host name.		 */		if (mh_strcasecmp(host, tokval) == 0)		    goto match;		continue;	    }match:	    while ((t = token()) && t != MACH && t != DEFAULT) {		switch(t) {		case LOGIN:		    if (token() && *aname == 0) {			*aname = mh_xmalloc((size_t) strlen(tokval) + 1);			strcpy(*aname, tokval);		    }		    break;		case PASSWD:		    if (fstat(fileno(cfile), &stb) >= 0 &&			(stb.st_mode & 077) != 0) {			/* We make this a fatal error to force the user to correct it */			advise(NULL, "Error - ~/.netrc file must not be world or group readable.");			adios(NULL, "Remove password or correct file permissions.");		    }		    if (token() && *apass == 0) {			*apass = mh_xmalloc((size_t) strlen(tokval) + 1);			strcpy(*apass, tokval);		    }		    break;		case ACCOUNT:		    break;		case MACDEF:		    goto done_close;		    break;		default:		    fprintf(stderr, "Unknown .netrc keyword %s/n", tokval);		    break;		}	    }	    goto done;	}    }done_close:    fclose(cfile);done:    if (!*aname) {	char tmp[80];	char *myname;	if ((myname = getlogin()) == NULL) {	    struct passwd *pp;	    if ((pp = getpwuid (getuid())) != NULL)		myname = pp->pw_name;	}	printf("Name (%s:%s): ", host, myname);	fgets(tmp, sizeof(tmp) - 1, stdin);	tmp[strlen(tmp) - 1] = '/0';	if (*tmp != '/0') {	    myname = tmp;	}	*aname = mh_xmalloc((size_t) strlen(myname) + 1);	strcpy (*aname, myname);    }    if (!*apass) {	char prompt[256];	char *mypass;//.........这里部分代码省略.........
开发者ID:ella13,项目名称:nmh,代码行数:101,


示例15: BaseFileManager

bool WintermuteEngine::getGameInfo(const Common::FSList &fslist, Common::String &name, Common::String &caption) {	bool retVal = false;	caption = name = "(invalid)";	Common::SeekableReadStream *stream = nullptr;	// Quick-fix, instead of possibly breaking the persistence-system, let's just roll with it	BaseFileManager *fileMan = new BaseFileManager(Common::UNK_LANG, true);	fileMan->registerPackages(fslist);	stream = fileMan->openFile("startup.settings", false, false);	// The process is as follows: Check the "GAME=" tag in startup.settings, to decide where the	// game-settings are (usually "default.game"), then look into the game-settings to find	// the NAME = and CAPTION = tags, to use them to generate a gameid and extras-field	Common::String settingsGameFile = "default.game";	// If the stream-open failed, lets at least attempt to open the default game file afterwards	// so, we don't call it a failure yet.	if (stream) {		while (!stream->eos() && !stream->err()) {			Common::String line = stream->readLine();			line.trim(); // Get rid of indentation			// Expect "SETTINGS {" or comment, or empty line			if (line.size() == 0 || line[0] == ';' || (line.contains("{"))) {				continue;			} else {				// We are looking for "GAME ="				Common::StringTokenizer token(line, "=");				Common::String key = token.nextToken();				Common::String value = token.nextToken();				if (value.size() == 0) {					continue;				}				if (value[0] == '/"') {					value.deleteChar(0);				} else {					continue;				}				if (value.lastChar() == '/"') {					value.deleteLastChar();				}				if (key == "GAME") {					settingsGameFile = value;					break;				}			}		}	}	delete stream;	stream = fileMan->openFile(settingsGameFile, false, false);	if (stream) {		// We do some manual parsing here, as the engine needs gfx to be initalized to do that.		while (!stream->eos() && !stream->err()) {			Common::String line = stream->readLine();			line.trim(); // Get rid of indentation			// Expect "GAME {" or comment, or empty line			if (line.size() == 0 || line[0] == ';' || (line.contains("{"))) {				continue;			} else {				Common::StringTokenizer token(line, "=");				Common::String key = token.nextToken();				Common::String value = token.nextToken();				if (value.size() == 0) {					continue;				}				if (value[0] == '/"') {					value.deleteChar(0);				} else {					continue;    // not a string				}				if (value.lastChar() == '/"') {					value.deleteLastChar();				}				if (key == "NAME") {					retVal = true;					name = value;				} else if (key == "CAPTION") {					retVal = true;					// Remove any translation tags, if they are included in the game description.					// This can potentially remove parts of a string that has translation tags					// and contains a "/" in its description (e.g. /tag/Name start / name end will					// result in "name end"), but it's a very rare case, and this code is just used					// for fallback anyway.					if (value.hasPrefix("/")) {						value.deleteChar(0);						while (value.contains("/")) {							value.deleteChar(0);						}					}					caption = value;				}			}		}		delete stream;	}	delete fileMan;	BaseEngine::destroy();	return retVal;}
开发者ID:AReim1982,项目名称:scummvm,代码行数:98,


示例16: ruserpass

intruserpass (const char *host, const char **aname, const char **apass){	char *hdir, *buf, *tmp;	char myname[1024], *mydomain;	int t, usedefault = 0;	struct stat64 stb;	hdir = __libc_secure_getenv("HOME");	if (hdir == NULL) {		/* If we can't get HOME, fail instead of trying ".",		   which is no improvement. This really should call		   getpwuid(getuid()).  */		/*hdir = ".";*/		return -1;	}	buf = alloca (strlen (hdir) + 8);	__stpcpy (__stpcpy (buf, hdir), "/.netrc");	cfile = fopen(buf, "rce");	if (cfile == NULL) {		if (errno != ENOENT)			warn("%s", buf);		return (0);	}	/* No threads use this stream.  */	__fsetlocking (cfile, FSETLOCKING_BYCALLER);	if (__gethostname(myname, sizeof(myname)) < 0)		myname[0] = '/0';	mydomain = __strchrnul(myname, '.');next:	while ((t = token())) switch(t) {	case DEFAULT:		usedefault = 1;		/* FALL THROUGH */	case MACHINE:		if (!usedefault) {			if (token() != ID)				continue;			/*			 * Allow match either for user's input host name			 * or official hostname.  Also allow match of			 * incompletely-specified host in local domain.			 */			if (__strcasecmp(host, tokval) == 0)				goto match;/*			if (__strcasecmp(hostname, tokval) == 0)				goto match;			if ((tmp = strchr(hostname, '.')) != NULL &&			    __strcasecmp(tmp, mydomain) == 0 &&			    __strncasecmp(hostname, tokval, tmp-hostname) == 0 &&			    tokval[tmp - hostname] == '/0')				goto match; */			if ((tmp = strchr(host, '.')) != NULL &&			    __strcasecmp(tmp, mydomain) == 0 &&			    __strncasecmp(host, tokval, tmp - host) == 0 &&			    tokval[tmp - host] == '/0')				goto match;			continue;		}	match:		while ((t = token()) && t != MACHINE && t != DEFAULT) switch(t) {		case LOGIN:			if (token()) {				if (*aname == 0) {				  char *newp;				  newp = malloc((unsigned) strlen(tokval) + 1);				  if (newp == NULL)				    {				      warnx(_("out of memory"));				      goto bad;				    }				  *aname = strcpy(newp, tokval);				} else {					if (strcmp(*aname, tokval))						goto next;				}			}			break;		case PASSWD:			if (strcmp(*aname, "anonymous") &&			    fstat64(fileno(cfile), &stb) >= 0 &&			    (stb.st_mode & 077) != 0) {	warnx(_("Error: .netrc file is readable by others."));	warnx(_("Remove password or make file unreadable by others."));				goto bad;			}			if (token() && *apass == 0) {				char *newp;				newp = malloc((unsigned) strlen(tokval) + 1);				if (newp == NULL)				  {				    warnx(_("out of memory"));				    goto bad;				  }				*apass = strcpy(newp, tokval);//.........这里部分代码省略.........
开发者ID:Kampi,项目名称:Zybo-Linux,代码行数:101,


示例17: gettimeofday_sec

void *index_memory(void *p){  pos_lists_t *Z0 = new pos_lists_t;  uint32_t used_buffer_size = 0;  thread_arg_t *arg = (thread_arg_t *) p;  int id = arg->id;  double t1 = gettimeofday_sec();  std::cout << "index_memory starts for Z0-" << id << std::endl;  MeCab::Tagger *tagger = MeCab::createTagger(0, NULL);  uint32_t doc_id = 1;  std::string line;  while (1) {    pthread_mutex_lock(&fin_mutex);    if (!getline(fin, line)) {      pthread_mutex_unlock(&fin_mutex);      break;    }    pthread_mutex_unlock(&fin_mutex);    std::vector<std::string> items;    boost::split(items, line, boost::is_any_of(""));    /*    if (items.size() != 6) { continue; }    line = items[4] + " " + items[5];    */    if (items.size() != 3) { continue; }    line = items[1] + " " + items[2];    unsigned int offset = 0;    pos_lists_tmp_t Ztmp;    const MeCab::Node *node_ = tagger->parseToNode(line.c_str());    for (; node_; node_ = node_->next) {      if (node_->stat == MECAB_BOS_NODE ||        node_->stat == MECAB_EOS_NODE) {        continue;       }         std::string token(node_->surface, node_->length);      unsigned int length = get_length_of((const unsigned char *) token.c_str());      // mecab ignores spaces in default       // but they must be counted as offset from the beginning      int head_space_len =  node_->rlength - node_->length;      offset += head_space_len > 0 ? head_space_len : 0;      pos_lists_tmp_t::iterator itr = Ztmp.find(token);      if (itr != Ztmp.end()) {        itr->second.push_back(offset);        ++(itr->second.at(1));      } else {        pos_list_t p;        p.push_back(doc_id);        p.push_back(1);        p.push_back(offset);        std::pair<std::string, pos_list_t> pos;        pos.first = token;        pos.second = p;        Ztmp.insert(pos);      }      //tokens_.push_back(Term(token, length, offset));      offset += length;    }    pos_lists_tmp_t::iterator itr_end = Ztmp.end();    for (pos_lists_tmp_t::iterator itr = Ztmp.begin();         itr != itr_end; ++itr) {      std::pair<std::string, pos_list_t> pos = *itr;      LMergeAddToken(indexes, *Z0, pos, used_buffer_size);    }    //std::cout << "doc: " << doc_id << std::endl;    ++doc_id;    Ztmp.clear();    pos_lists_tmp_t().swap(Ztmp);    if (used_buffer_size > FLUSH_THRESHOLD) {      pthread_mutex_lock(&flush_buffer_queue_mutex);      ++flush_buffer_queue_size;      push_or_merge(Z0);      //flush_buffer_queue.push_back(Z0);      if (flush_buffer_queue_size == NUM_FLUSH_BUFFER) {        // flushing (Z0 is cleard inside Z0_flush)        Z0_flush(indexes);        flush_buffer_queue_size = 0;      }      Z0 = new pos_lists_t;      pthread_mutex_unlock(&flush_buffer_queue_mutex);      used_buffer_size = 0;      // [TODO] clear doc_id    }  }  if (used_buffer_size > 0) {    pthread_mutex_lock(&flush_buffer_queue_mutex);    //flush_buffer_queue.push_back(Z0);    ++flush_buffer_queue_size;    push_or_merge(Z0);    if (flush_buffer_queue_size == NUM_FLUSH_BUFFER) {//.........这里部分代码省略.........
开发者ID:feeblefakie,项目名称:misc,代码行数:101,


示例18: qt_static_metacall

int ONVIF::AudioEncoderConfiguration::qt_metacall(QMetaObject::Call _c, int _id, void **_a){    _id = QObject::qt_metacall(_c, _id, _a);    if (_id < 0)        return _id;    if (_c == QMetaObject::InvokeMetaMethod) {        if (_id < 13)            qt_static_metacall(this, _c, _id, _a);        _id -= 13;    } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {        if (_id < 13)            *reinterpret_cast<int*>(_a[0]) = -1;        _id -= 13;    }#ifndef QT_NO_PROPERTIES      else if (_c == QMetaObject::ReadProperty) {        void *_v = _a[0];        switch (_id) {        case 0: *reinterpret_cast< QString*>(_v) = token(); break;        case 1: *reinterpret_cast< QString*>(_v) = name(); break;        case 2: *reinterpret_cast< int*>(_v) = useCount(); break;        case 3: *reinterpret_cast< QString*>(_v) = encoding(); break;        case 4: *reinterpret_cast< int*>(_v) = bitrate(); break;        case 5: *reinterpret_cast< int*>(_v) = sampleRate(); break;        case 6: *reinterpret_cast< QString*>(_v) = type(); break;        case 7: *reinterpret_cast< QString*>(_v) = ipv4Address(); break;        case 8: *reinterpret_cast< QString*>(_v) = ipv6Address(); break;        case 9: *reinterpret_cast< int*>(_v) = port(); break;        case 10: *reinterpret_cast< int*>(_v) = ttl(); break;        case 11: *reinterpret_cast< bool*>(_v) = autoStart(); break;        case 12: *reinterpret_cast< QString*>(_v) = sessionTimeout(); break;        }        _id -= 13;    } else if (_c == QMetaObject::WriteProperty) {        void *_v = _a[0];        switch (_id) {        case 0: setToken(*reinterpret_cast< QString*>(_v)); break;        case 1: setName(*reinterpret_cast< QString*>(_v)); break;        case 2: setUseCount(*reinterpret_cast< int*>(_v)); break;        case 3: setEncoding(*reinterpret_cast< QString*>(_v)); break;        case 4: setBitrate(*reinterpret_cast< int*>(_v)); break;        case 5: setSampleRate(*reinterpret_cast< int*>(_v)); break;        case 6: setType(*reinterpret_cast< QString*>(_v)); break;        case 7: setIpv4Address(*reinterpret_cast< QString*>(_v)); break;        case 8: setIpv6Address(*reinterpret_cast< QString*>(_v)); break;        case 9: setPort(*reinterpret_cast< int*>(_v)); break;        case 10: setTtl(*reinterpret_cast< int*>(_v)); break;        case 11: setAutoStart(*reinterpret_cast< bool*>(_v)); break;        case 12: setSessionTimeout(*reinterpret_cast< QString*>(_v)); break;        }        _id -= 13;    } else if (_c == QMetaObject::ResetProperty) {        _id -= 13;    } else if (_c == QMetaObject::QueryPropertyDesignable) {        _id -= 13;    } else if (_c == QMetaObject::QueryPropertyScriptable) {        _id -= 13;    } else if (_c == QMetaObject::QueryPropertyStored) {        _id -= 13;    } else if (_c == QMetaObject::QueryPropertyEditable) {        _id -= 13;    } else if (_c == QMetaObject::QueryPropertyUser) {        _id -= 13;    } else if (_c == QMetaObject::RegisterPropertyMetaType) {        if (_id < 13)            *reinterpret_cast<int*>(_a[0]) = -1;        _id -= 13;    }#endif // QT_NO_PROPERTIES    return _id;}
开发者ID:bshawk,项目名称:vdc,代码行数:71,


示例19: attr

TCodParser::TCodAttr TCodParser::AttrName()    {    TCodAttr attr( ECodUnknownAttr );    const TText* start = iCurP;    while        (            iCurP < iEndP &&            !IsControl() &&            !IsSeparator() &&            *iCurP != KCodCarriageRet &&            *iCurP != KCodLineFeed        )        {        iCurP++;        }    TPtrC token( start, iCurP - start );    if ( !token.Length() )        {        Error( KErrCodInvalidDescriptor );        }    else if ( !token.Compare( KCodName ) )        {        attr = ECodName;        }    else if ( !token.Compare( KCodVendor ) )        {        attr = ECodVendor;        }    else if ( !token.Compare( KCodDescription ) )        {        attr = ECodDescription;        }    else if ( !token.Compare( KCodUrl ) )        {        attr = ECodUrl;        }    else if ( !token.Compare( KCodSize ) )        {        attr = ECodSize;        }    else if ( !token.Compare( KCodType ) )        {        attr = ECodType;        }    else if ( !token.Compare( KCodInstallNotify ) )        {        attr = ECodInstallNotify;        }    else if ( !token.Compare( KCodNextUrl ) )        {        attr = ECodNextUrl;        }    else if ( !token.Compare( KCodNextUrlAtError ) )        {        attr = ECodNextUrlAtError;        }    else if ( !token.Compare( KCodInfoUrl ) )        {        attr = ECodInfoUrl;        }    else if ( !token.Compare( KCodPrice ) )        {        attr = ECodPrice;        }    else if ( !token.Compare( KCodIcon ) )        {        attr = ECodIcon;        }    CLOG(( EParse, 4, _L("TCodParser::AttrName token<%S> attr(%d)"), /        &token, attr ));    return attr;    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:75,


示例20: qt_static_metacall

int AppSettings::qt_metacall(QMetaObject::Call _c, int _id, void **_a){    _id = QObject::qt_metacall(_c, _id, _a);    if (_id < 0)        return _id;    if (_c == QMetaObject::InvokeMetaMethod) {        if (_id < 13)            qt_static_metacall(this, _c, _id, _a);        _id -= 13;    }#ifndef QT_NO_PROPERTIES    else if (_c == QMetaObject::ReadProperty) {        void *_v = _a[0];        switch (_id) {        case 0:            *reinterpret_cast< QString*>(_v) = token();            break;        case 1:            *reinterpret_cast< QUrl*>(_v) = address();            break;        case 2:            *reinterpret_cast< QString*>(_v) = email();            break;        case 3:            *reinterpret_cast< QString*>(_v) = username();            break;        case 4:            *reinterpret_cast< QString*>(_v) = password();            break;        case 5:            *reinterpret_cast< QString*>(_v) = userid();            break;        }        _id -= 6;    } else if (_c == QMetaObject::WriteProperty) {        void *_v = _a[0];        switch (_id) {        case 0:            setToken(*reinterpret_cast< QString*>(_v));            break;        case 1:            setAddress(*reinterpret_cast< QUrl*>(_v));            break;        case 2:            setEmail(*reinterpret_cast< QString*>(_v));            break;        case 3:            setUsername(*reinterpret_cast< QString*>(_v));            break;        case 4:            setPassword(*reinterpret_cast< QString*>(_v));            break;        case 5:            setUserid(*reinterpret_cast< QString*>(_v));            break;        }        _id -= 6;    } else if (_c == QMetaObject::ResetProperty) {        _id -= 6;    } else if (_c == QMetaObject::QueryPropertyDesignable) {        _id -= 6;    } else if (_c == QMetaObject::QueryPropertyScriptable) {        _id -= 6;    } else if (_c == QMetaObject::QueryPropertyStored) {        _id -= 6;    } else if (_c == QMetaObject::QueryPropertyEditable) {        _id -= 6;    } else if (_c == QMetaObject::QueryPropertyUser) {        _id -= 6;    }#endif // QT_NO_PROPERTIES    return _id;}
开发者ID:suntzu974,项目名称:BBMoinLelaApp,代码行数:73,


示例21: token

void Lexer::storeToken(Token::Kind kind) {    Token token(kind);    storeToken(token, location);}
开发者ID:KlasBuhre,项目名称:Buhrlang,代码行数:4,


示例22: char

///////////////////////////////////////////////////////////////////////////////////Parse function declaration after rl_cmd or rl_cmd_pbool Class::parse( iglexer& lex, charstr& templarg_, const dynarray<charstr>& namespcs, dynarray<paste_block>* pasters, dynarray<MethodIG::Arg>& irefargs ){    templarg.swap(templarg_);    namespaces = namespcs;    namespaces.for_each([this](const charstr& v){ namespc << v << "::"; });    if(namespc)        ns.set_from_range(namespc.ptr(), namespc.ptre()-2);    token t = templarg;    if(!t.is_empty()) {        templsub << char('<');        for( int i=0; !t.is_empty(); ++i ) {            token x = t.cut_left(' ');            if(i)  templsub << ", ";            templsub << t.cut_left(',');        }        templsub << char('>');    }    hash_map<charstr,uint,hash<token>> map_overloads;    typedef hash_map<charstr,uint,hash<token>>::value_type t_val;    int ncontinuable_errors = 0;    if( !lex.matches(lex.IDENT, classname) )        lex.set_err() << "expecting class name/n";    else {        const lexer::lextoken& tok = lex.last();        noref = true;        while( lex.next() != '{' ) {            if( tok.end() ) {                lex.set_err() << "unexpected end of file/n";                return false;            }            if( tok == ';' )                return false;            noref = false;        }        //ignore nested blocks        //lex.ignore(lex.CURLY, true);        dynarray<charstr> commlist;        int mt;        while( 0 != (mt=lex.find_method(classname, commlist)) )        {            if(mt<0) {                //interface definitions                const lexer::lextoken& tok = lex.last();                bool classifc = tok == lex.IFC_CLASS;                bool classvar = tok == lex.IFC_CLASS_VAR;                bool classvirtual = tok == lex.IFC_CLASS_VIRTUAL;                bool extfn = tok == lex.IFC_FNX;                bool extev = tok == lex.IFC_EVENTX;                bool bimplicit = false;                bool bdestroy = false;                int8 binternal = 0;                int8 bnocapture = 0;                int8 bcapture = 0;                charstr extname, implname;                if(extev || extfn) {                    //parse external name                    lex.match('(');                    if(extfn && lex.matches('~'))                        bdestroy = true;                    else {                        while(int k = lex.matches_either('!', '-', '+'))                            (&binternal)[k-1]++;                        lex.matches(lex.IDENT, extname);                        /*binternal = lex.matches('!');                        bimplicit = lex.matches('@');                        if(bimplicit) {                            lex.match(lex.IDENT, implname);                            lex.matches(lex.IDENT, extname);                        }                        else {                            lex.matches(lex.IDENT, extname);                            bimplicit = lex.matches('@');                            if(bimplicit)                                lex.match(lex.IDENT, implname);                        }*/                    }                    lex.match(')');                }                if(classifc || classvar || classvirtual)                {//.........这里部分代码省略.........
开发者ID:cyrilgramblicka,项目名称:X264RecorderPlugin,代码行数:101,


示例23: switch

//.........这里部分代码省略.........        break;    case '+':        if (isNextChar('+', tStart)) {            op = Operator::Increment;            location.stepColumn();        } else if (isNextChar('=', tStart)) {            op = Operator::AdditionAssignment;            location.stepColumn();        } else {            op = Operator::Addition;        }        break;    case '-':        if (isNextChar('-', tStart)) {            op = Operator::Decrement;            location.stepColumn();        } else if (isNextChar('=', tStart)) {            op = Operator::SubtractionAssignment;            location.stepColumn();        } else if (isNextChar('>', tStart)) {            op = Operator::Arrow;            location.stepColumn();        } else {            op = Operator::Subtraction;        }        break;    case '*':        if (isNextChar('=', tStart)) {            op = Operator::MultiplicationAssignment;            location.stepColumn();        } else {            op = Operator::Multiplication;        }        break;    case '/':        if (isNextChar('=', tStart)) {            op = Operator::DivisionAssignment;            location.stepColumn();        } else {            op = Operator::Division;        }        break;    case '.':        if (isNextChar('.', tStart)) {            if (isNextChar('.', tStart + 1)) {                op = Operator::Range;                location.stepColumn();            } else {                op = Operator::Wildcard;            }            location.stepColumn();        } else {            op = Operator::Dot;        }        break;    case '%':        op = Operator::Modulo;        break;    case ',':        op = Operator::Comma;        break;    case '(':        op = Operator::OpenParentheses;        break;    case ')':        op = Operator::CloseParentheses;        break;    case '{':        op = Operator::OpenBrace;        break;    case '}':        op = Operator::CloseBrace;        break;    case '[':        op = Operator::OpenBracket;        break;    case ']':        op = Operator::CloseBracket;        break;    case ';':        op = Operator::Semicolon;        break;    case '?':        op = Operator::Question;        break;    case '_':        op = Operator::Placeholder;        break;    case '^':        op = Operator::BitwiseXor;        break;    case '~':        op = Operator::BitwiseNot;        break;    default:        break;    }    Token token(op);    storeToken(token, startLocation);}
开发者ID:KlasBuhre,项目名称:Buhrlang,代码行数:101,


示例24: dummyPtr

voidtestServiceRegistry::externalServiceTest(){   art::AssertHandler ah;   {      std::unique_ptr<DummyService> dummyPtr(new DummyService);      dummyPtr->value_ = 2;      art::ServiceToken token(art::ServiceRegistry::createContaining(dummyPtr));      {         art::ServiceRegistry::Operate operate(token);         art::ServiceHandle<DummyService> dummy;         CPPUNIT_ASSERT(dummy);         CPPUNIT_ASSERT(dummy.isAvailable());         CPPUNIT_ASSERT(dummy->value_ == 2);      }      {         std::vector<fhicl::ParameterSet> pss;         fhicl::ParameterSet ps;         std::string typeName("DummyService");         ps.addParameter("service_type", typeName);         int value = 2;         ps.addParameter("value", value);         pss.push_back(ps);         art::ServiceToken token(art::ServiceRegistry::createSet(pss));         art::ServiceToken token2(art::ServiceRegistry::createContaining(dummyPtr,                                                                         token,                                                                         art::serviceregistry::kOverlapIsError));         art::ServiceRegistry::Operate operate(token2);         art::ServiceHandle<testserviceregistry::DummyService> dummy;         CPPUNIT_ASSERT(dummy);         CPPUNIT_ASSERT(dummy.isAvailable());         CPPUNIT_ASSERT(dummy->value() == 2);      }   }   {      std::unique_ptr<DummyService> dummyPtr(new DummyService);      std::shared_ptr<art::serviceregistry::ServiceWrapper<DummyService> >          wrapper(new art::serviceregistry::ServiceWrapper<DummyService>(dummyPtr));      art::ServiceToken token(art::ServiceRegistry::createContaining(wrapper));      wrapper->get().value_ = 2;      {         art::ServiceRegistry::Operate operate(token);         art::ServiceHandle<DummyService> dummy;         CPPUNIT_ASSERT(dummy);         CPPUNIT_ASSERT(dummy.isAvailable());         CPPUNIT_ASSERT(dummy->value_ == 2);      }      {         std::vector<fhicl::ParameterSet> pss;         fhicl::ParameterSet ps;         std::string typeName("DummyService");         ps.addParameter("service_type", typeName);         int value = 2;         ps.addParameter("value", value);         pss.push_back(ps);         art::ServiceToken token(art::ServiceRegistry::createSet(pss));         art::ServiceToken token2(art::ServiceRegistry::createContaining(dummyPtr,                                                                         token,                                                                         art::serviceregistry::kOverlapIsError));         art::ServiceRegistry::Operate operate(token2);         art::ServiceHandle<testserviceregistry::DummyService> dummy;         CPPUNIT_ASSERT(dummy);         CPPUNIT_ASSERT(dummy.isAvailable());         CPPUNIT_ASSERT(dummy->value() == 2);      }   }}
开发者ID:gartung,项目名称:fnal-art,代码行数:78,


示例25: while

// internalint asCScriptFunction::ParseListPattern(asSListPatternNode *&target, const char *decl, asCScriptNode *listNodes){	asSListPatternNode *node = target;	listNodes = listNodes->firstChild;	while( listNodes )	{		if( listNodes->nodeType == snIdentifier )		{			asCString token(&decl[listNodes->tokenPos], listNodes->tokenLength);			if( token == "repeat" )			{				node->next = asNEW(asSListPatternNode)(asLPT_REPEAT);				node = node->next;			}			else if( token == "repeat_same" )			{				// TODO: list: Should make sure this is a sub-list				node->next = asNEW(asSListPatternNode)(asLPT_REPEAT_SAME);				node = node->next;			}			else			{				// Shouldn't happen as the parser already reported the error				asASSERT(false);			}		}		else if( listNodes->nodeType == snDataType )		{			asCDataType dt;			asCBuilder builder(engine, 0);			asCScriptCode code;			code.SetCode("", decl, 0, false);			dt = builder.CreateDataTypeFromNode(listNodes, &code, engine->defaultNamespace, false, returnType.GetObjectType());			node->next = asNEW(asSListPatternDataTypeNode)(dt);			node = node->next;		}		else if( listNodes->nodeType == snListPattern )		{			node->next = asNEW(asSListPatternNode)(asLPT_START);			node = node->next;			// Recursively parse the child			int r = ParseListPattern(node, decl, listNodes);			if( r < 0 )				return r;			node->next = asNEW(asSListPatternNode)(asLPT_END);			node = node->next;		}		else		{			// Unexpected token in the list, the parser shouldn't have allowed			asASSERT( false );			return -1;		}		listNodes = listNodes->next;	}	target = node;	return 0;}
开发者ID:Clever-Boy,项目名称:qfusion,代码行数:65,



注:本文中的token函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ tokenizer函数代码示例
C++ tok2str函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。