コード例 #1
0
ファイル: pipe.c プロジェクト: aiju/hdl
void
pipestart(ASTNode *n, Symbol *cl, Symbol *go)
{
	if(curfsm != nil || curpipe != nil)
		error(nil, "nested pipe");
	curpipe = n;
	lastlab = nil;
	if(cl != nil)
		n->sym->clock = node(ASTSYMB, cl);
	else
		n->sym->clock = node(ASTSYMB, findclock(n->sym));
	if(go != nil)
		n->n2 = vardecl(scope->up, node(ASTSYMB, go), 0, nil, type(TYPBITV, nil, 0), nil);
}
コード例 #2
0
ファイル: parser2.c プロジェクト: tungvx/FSE
static AST vardecls(AST vdl, AST fdl) {
    Token *t = &tok;
    AST a=0;
    AST a1=0;
    bool isfuncdecl = false;

    while (true) {
	if (!isprimtype(t->sym) && !isclasstype() && !isstructtype()) break;
	a1 = vardecl();
	if (a1 && nodetype(a1) == nFUNCDECL) /* expect var, but it was func */
	{ isfuncdecl = true; break; }
	if (a1) vdl = append_list(vdl, a1);

	if (t->sym == ';') gettoken();
	else parse_error("expected ;");
    }

    if (isfuncdecl) {
	fdl = append_list(fdl, a1);    /* add first elem of fdl */
    }

    return vdl;
}