示例#1
0
Statement *ParseTryStatement()
{
	Statement *snp;
	TYP *tp,*tp1,*tp2;
	SYM *sp;
	Statement *hd, *tl;

	hd = NULL;
	tl = NULL;
	snp = NewStatement(st_try, TRUE);
    snp->s1 = ParseStatement();
	if (lastst != kw_catch)
        error(ERR_CATCHEXPECT);
    while( lastst == kw_catch ) {
		if( hd == NULL )
			hd = tl = ParseCatchStatement(); 
		else { 
			tl->next = ParseCatchStatement(); 
			if( tl->next != NULL ) 
				tl = tl->next;
		}
		if (tl==NULL) break;	// end of file in try
        tl->next = NULL; 
    } 
    snp->s2 = hd;
    return snp;
} 
示例#2
0
Statement *ParseTryStatement()
{
	Statement *snp;
	TYP *tp,*tp1,*tp2;
	SYM *sp;
	Statement *hd, *tl;

	hd = (Statement *)NULL;
	tl = (Statement *)NULL;
	snp = NewStatement(st_try, TRUE);
    snp->s1 = ParseStatement();
	// Empty statements return NULL
	if (snp->s1)
		snp->s1->outer = snp;
	if (lastst != kw_catch)
        error(ERR_CATCHEXPECT);
    while( lastst == kw_catch ) {
		if( hd == NULL ) {
			hd = tl = ParseCatchStatement(); 
			if (hd)
				hd->outer = snp;
		}
		else { 
			tl->next = ParseCatchStatement(); 
			if( tl->next != NULL ) {
				tl->next->outer = snp;
				tl = tl->next;
			}
		}
		if (tl==(Statement *)NULL) break;	// end of file in try
        tl->next = (Statement *)NULL; 
    } 
    snp->s2 = hd;
    return snp;
}