当前位置: 首页>>代码示例>>C++>>正文


C++ SkipToken函数代码示例

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


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

示例1: vcc_Eval_Regsub

static void
vcc_Eval_Regsub(struct vcc *tl, struct expr **e, const struct symbol *sym)
{
	struct expr *e2;
	int all = sym->eval_priv == NULL ? 0 : 1;
	char *p;
	char buf[128];

	vcc_delete_expr(*e);
	SkipToken(tl, ID);
	SkipToken(tl, '(');

	vcc_expr0(tl, &e2, STRING);
	if (e2->fmt != STRING)
		vcc_expr_tostring(&e2, STRING);

	SkipToken(tl, ',');
	ExpectErr(tl, CSTR);
	p = vcc_regexp(tl);
	vcc_NextToken(tl);

	bprintf(buf, "VRT_regsub(sp, %d,\n\v1,\n%s\n", all, p);
	*e = vcc_expr_edit(STRING, buf, e2, *e);

	SkipToken(tl, ',');
	vcc_expr0(tl, &e2, STRING);
	if (e2->fmt != STRING)
		vcc_expr_tostring(&e2, STRING);
	*e = vcc_expr_edit(STRING, "\v1, \v2)", *e, e2);
	SkipToken(tl, ')');
}
开发者ID:BabyOnlineSG,项目名称:pkg-varnish,代码行数:31,代码来源:vcc_expr.c

示例2: SkipToken

const char *ParseTexCoords(const char *pText, F3DSubObject &sub, int numPositions)
{
	SkipToken(pText, "{");

	// get num positions
	int numUV = GetInt(pText, &pText);
	MFDebug_Assert(numUV == numPositions, "Number of UV's does not match the number of verts in the mesh.");

	sub.uvs.resize(numUV);

	// read positions
	for(int a=0; a<numUV; a++)
	{
		sub.uvs[a].x = GetFloat(pText, &pText);
		sub.uvs[a].y = GetFloat(pText, &pText);

		if(a < numUV-1)
			SkipToken(pText, ",");
	}
	SkipToken(pText, ";");

	// map to faces
	for(int m=0; m<sub.matSubobjects.size(); m++)
	{
		int totalVerts = sub.matSubobjects[m].vertices.size();
		for(int a=0; a<totalVerts; a++)
		{
			sub.matSubobjects[m].vertices[a].uv1 = sub.matSubobjects[m].vertices[a].position;
		}
	}

	SkipToken(pText, "}");

	return pText;
}
开发者ID:RemedyGameJam,项目名称:fuji,代码行数:35,代码来源:ReadX.cpp

示例3: UnlessStatement

static void UnlessStatement(void)
{
	Int32 l1,l2;

	SkipToken(tUNLESS);
	
	Expr();
	
	if( Token==tTHEN ) NextToken();

	l1 = vm_genI(op_jz,0);
	
	StatementList();
	
	if( Token==tELSE )
	{
		SkipToken(tELSE);
		l2 = vm_genI(op_jmp,0);
		vm_patch(l1,vm_addr());
		l1 = l2;
		StatementList();
	}

	vm_patch(l1,vm_addr());

	SkipToken(tEND);
}
开发者ID:markcheno,项目名称:topaz,代码行数:27,代码来源:parser.c

示例4: FormalParamList

static void FormalParamList(SymPtr func)
{
	SymPtr t,p;
	Int32 num,shift;

	SkipToken(tLPAREN);
	if(Token==tVARIABLE)
	{
		FormalParam();
		func->nargs++;
	}
	
	while( Token==tCOMMA )
	{
		SkipToken(tCOMMA);
		FormalParam();
		func->nargs++;
	}
	SkipToken(tRPAREN);		

	/* Reverse and shift the argument numbers (if any).
	   Arguments are located directly after the function. */
	p = func;
	shift = in_class ? 2 : 1;
	for( num=-func->nargs; num<0; num++ )
	{
		/* shift to make room for argc and maybe class  */
		t = p->next;
        p = t;
		p->num = num-shift;
	}
}
开发者ID:markcheno,项目名称:topaz,代码行数:32,代码来源:parser.c

示例5: ActualParams

static Int32 ActualParams(void)
{
	Int32 args=0;

	if( Token==tLPAREN )
	{
		SkipToken(tLPAREN);
		
		if( Token != tRPAREN ) 
		{
			Expr();
			args++;

			while( Token==tCOMMA )
			{
				SkipToken(tCOMMA);
				Expr();
				args++;
			}
		}
		SkipToken(tRPAREN);
	}

	return args;
}
开发者ID:markcheno,项目名称:topaz,代码行数:25,代码来源:parser.c

示例6: CaseStatement

static void CaseStatement(void)
{
	Int32 ii=0;
	Int32 l1,l2[MAXCOND];

	SkipToken(tCASE);

	Expr();

	while( Token==tWHEN )
	{
		SkipToken(tWHEN);
		vm_gen0(op_dup);
		Expr();
		if( Token==tTHEN ) NextToken();
		vm_gen0(op_eql);
		l1 = vm_genI(op_jz,0);
		StatementList();
		l2[ii++] = vm_genI(op_jmp,0);
		vm_patch(l1,vm_addr());
	}
	
	if( Token==tELSE )
	{
		SkipToken(tELSE);
		StatementList();
	}

	while( --ii >= 0 )
		vm_patch(l2[ii],vm_addr());

	vm_gen0(op_pop);
	
	SkipToken(tEND);
}
开发者ID:markcheno,项目名称:topaz,代码行数:35,代码来源:parser.c

示例7: vcc_Compound

static void
vcc_Compound(struct vcc *tl)
{
	int i;

	SkipToken(tl, '{');
	Fb(tl, 1, "{\n");
	tl->indent += INDENT;
	C(tl, ";");
	while (1) {
		ERRCHK(tl);
		switch (tl->t->tok) {
		case '{':
			vcc_Compound(tl);
			break;
		case '}':
			vcc_NextToken(tl);
			tl->indent -= INDENT;
			Fb(tl, 1, "}\n");
			return;
		case CSRC:
			if (tl->allow_inline_c) {
				Fb(tl, 1, "%.*s\n",
				    (int) (tl->t->e - (tl->t->b + 2)),
				    tl->t->b + 1);
				vcc_NextToken(tl);
			} else {
				VSB_printf(tl->sb,
				    "Inline-C not allowed\n");
				vcc_ErrWhere(tl, tl->t);
			}
			break;
		case EOI:
			VSB_printf(tl->sb,
			    "End of input while in compound statement\n");
			tl->err = 1;
			return;
		case ID:
			if (vcc_IdIs(tl->t, "if")) {
				vcc_IfStmt(tl);
				break;
			} else {
				i = vcc_ParseAction(tl);
				ERRCHK(tl);
				if (i) {
					SkipToken(tl, ';');
					break;
				}
			}
			/* FALLTHROUGH */
		default:
			/* We deliberately do not mention inline C */
			VSB_printf(tl->sb,
			    "Expected an action, 'if', '{' or '}'\n");
			vcc_ErrWhere(tl, tl->t);
			return;
		}
	}
}
开发者ID:varnishcache,项目名称:varnish-cache,代码行数:59,代码来源:vcc_parse.c

示例8: SkipToken

void XFileLoader::ReadArray(istream& s, iter b, iter e)
{
	for (iter i = b; i != e; ++i)
	{
		if (i != b)
			SkipToken(s, XFileToken::Comma);
		ReadData(s, *i);
	}
	SkipToken(s, XFileToken::Semicolon);
}
开发者ID:kamillys,项目名称:IN_SDL_Demo,代码行数:10,代码来源:mini_xfileLoader.cpp

示例9: LookupIdent

static SymPtr LookupIdent(char **name)
{
	SymPtr sym=NULL,parent;
	
    /* check this class only */
	if( in_class && Token==tSELF )
	{
		SkipToken(tSELF);
		SkipToken(tPERIOD);
		*name = GetIdent();
		sym = SymFindLevel(*name,(SymGetScope()-1));
	}
    /* check super class only */
	else if( in_class && Token==tSUPER && base_class->super!=NULL )
	{
	    SkipToken(tSUPER);
	    SkipToken(tPERIOD);
	    *name = GetIdent();
	    sym = SymFindLocal(*name,base_class->super);
        
	    if( sym!=NULL && sym->flags&SYM_PRIVATE )
	    {
		    compileError("attempt to access private field '%s'",*name);
		    NextToken();
		    return COMPILE_ERROR;
	    }
	}
	/* check all super classes */
    else if( in_class )
	{
        *name = GetIdent();
        parent=base_class->super;
        while(parent!=NULL)
        {
            sym = SymFindLocal(*name,parent);
            if(sym!=NULL) break;
            parent=parent->super;
        }
	   	if( sym!=NULL && sym->flags&SYM_PRIVATE )
	    {
		    compileError("attempt to access private field '%s'",*name);
		    NextToken();
		    return COMPILE_ERROR;
	    }
	}
    
    /* check globals */
    if( sym==NULL )
	{
		*name = GetIdent();
		sym = SymFind(*name);
	}
    
	return sym;
}
开发者ID:markcheno,项目名称:topaz,代码行数:55,代码来源:parser.c

示例10: vcc_Conditional

static void
vcc_Conditional(struct vcc *tl)
{

	SkipToken(tl, '(');
	Fb(tl, 0, "(\n");
	L(tl, vcc_Expr(tl, BOOL));
	ERRCHK(tl);
	Fb(tl, 1, ")\n");
	SkipToken(tl, ')');
}
开发者ID:varnishcache,项目名称:varnish-cache,代码行数:11,代码来源:vcc_parse.c

示例11: parse_hash_data

static void
parse_hash_data(struct vcc *tl)
{
	vcc_NextToken(tl);
	SkipToken(tl, '(');

	Fb(tl, 1, "VRT_hashdata(ctx, ");
	vcc_Expr(tl, STRING_LIST);
	ERRCHK(tl);
	Fb(tl, 0, ");\n");
	SkipToken(tl, ')');
}
开发者ID:estibi,项目名称:Varnish-Cache,代码行数:12,代码来源:vcc_action.c

示例12: MethodDefinition

static void MethodDefinition(void)
{
	Pointer name;
	SymPtr sym;
	Int32 l1,shift;
	
	SkipToken(tDEF);
	/* MatchToken(tVARIABLE); */

	name = GetIdent();
	/* maybe check for duplicates here? */
	sym = SymAdd(name);
	sym->kind = FUNCTION_KIND;
	sym->object.u.ival = vm_addr();
	sym->flags |= cur_scope;
	if( in_class && base_class!=NULL ) sym->clas=base_class;
    if( in_class && super_class!=NULL ) sym->super=super_class;
    
	NextToken();
	SymEnterScope();
	in_method=TRUE;
	l1 = vm_genI(op_link,0);
		
	/* check for any formal parameters */
	if( Token==tLPAREN )
	{
		FormalParamList(sym);
	}
	
	/* function statements */
	local_num=0;
	StatementList();
	sym->nlocs = local_num;

	/* backpatch any return statements */
	CheckReturn(sym);

	/* implicit return */
	shift = in_class ? 2 : 1;
	vm_genI(op_rts,sym->nlocs+sym->nargs+shift);
	
	/* reserve space for locals */
	vm_patch(l1,sym->nlocs);	
	
	SymExitScope(sym);
	in_method=FALSE;
	/* end of function */
	SkipToken(tEND);
	if( Token==tSEMI ) NextToken();
}
开发者ID:markcheno,项目名称:topaz,代码行数:50,代码来源:parser.c

示例13: ForStatement

static void ForStatement(void)
{
	Int32 l1,l2,l3,l4;
	
	SkipToken(tFOR);
	SkipToken(tLPAREN);
	
	/* init */
	if( Token != tSEMI )
	{
		AssignmentStatement();
        while( Token==tCOMMA )
        {
            SkipToken(tCOMMA);
    		AssignmentStatement();    
        }
	}
	SkipToken(tSEMI);
	
	/* cond */
	l1 = vm_addr();
    if( Token != tSEMI )
    {
	    Expr();
    }
    else
    {
    	vm_genI(op_pushint,1);
    }
	l2 = vm_genI(op_jnz,0);
	l3 = vm_genI(op_jmp,0);
	
	/* incr */
	SkipToken(tSEMI);
	vm_patch(l3,vm_addr());
	l4 = vm_addr();
    if( Token != tRPAREN )
    {
	    AssignmentStatement();
        while( Token==tCOMMA )
        {
            SkipToken(tCOMMA);
            AssignmentStatement();
        }
    }
	vm_genI(op_jmp,l1);
	
	/* statements */
	SkipToken(tRPAREN);
	vm_patch(l2,vm_addr());
	StatementList();
	vm_genI(op_jmp,l4);
	
	/* done */
	vm_patch(l3,vm_addr());
	CheckBreak();
	
	SkipToken(tEND);
}
开发者ID:markcheno,项目名称:topaz,代码行数:59,代码来源:parser.c

示例14: Factor

static Int32 Factor(void)
{
    Int32 type;
	
	switch(Token)
	{
	case tINTCONST:
		vm_genI(op_pushint,GetInt());
		NextToken();
        type=INT_TYPE;
		break;
	
	case tREALCONST:
		vm_genR(op_pushreal,GetReal());
		NextToken();
        type=REAL_TYPE;
		break;
		
	case tSTRINGCONST:
		vm_genS(op_pushstring,GetString());
		NextToken();
        type=STRING_TYPE;
		break;
		
	case tNOT:
        NextToken();
		type=Factor();
		vm_gen0(op_not);
		break;
		
	case tLPAREN:
		SkipToken(tLPAREN);
		type=Expr();
		SkipToken(tRPAREN);
		break;

	case tLBRACK:
		ArrayInitializer();
        type=ARRAY_TYPE;
		break;

	default:
		type=Rhs();
		break;
	}
    
    return type;
}
开发者ID:markcheno,项目名称:topaz,代码行数:48,代码来源:parser.c

示例15: parse_error

static void
parse_error(struct vcc *tl)
{

	vcc_NextToken(tl);
	Fb(tl, 1, "VRT_error(sp,\n");
	if (tl->t->tok == '(') {
		vcc_NextToken(tl);
		vcc_Expr(tl, INT);
		if (tl->t->tok == ',') {
			Fb(tl, 1, ",\n");
			vcc_NextToken(tl);
			vcc_Expr(tl, STRING);
		} else
			Fb(tl, 1, ", 0\n");
		SkipToken(tl, ')');
	} else {
		vcc_Expr(tl, INT);
		if (tl->t->tok != ';') {
			Fb(tl, 1, ",\n");
			vcc_Expr(tl, STRING);
		} else
			Fb(tl, 1, ", 0\n");
	}
	Fb(tl, 1, ");\n");
	Fb(tl, 1, "VRT_done(sp, VCL_RET_ERROR);\n");
}
开发者ID:tpn,项目名称:Varnish-Cache,代码行数:27,代码来源:vcc_action.c


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