Beispiel #1
0
void CAipi_ExpParser::initializer()
{
	
	expression_assignment();


	//initialize an array 
	//Example: int a[] = { 6, 8 }
	if( m_lookahead == OPEN_BRACE )
	{
		//AfxMessageBox(_T("OPEN BRACE"));
		getToken();
		initializer_list();
		
		getToken();
		

		if( m_lookahead == COMMA)
		{
			//AfxMessageBox(_T("Entro a COMA"));
			getToken();
			initializer_list();
			
			//AfxMessageBox(_T("FIN initializer"));
			
			
		}
	}
	

}
Beispiel #2
0
int initializer_list(void) {
	if( initializer() ) {
	} else if( initializer_list() ) {
		match(COMMA);
		initializer();
	}
}
Beispiel #3
0
void CAipi_ExpParser::initializer_list()
{
	
	initializer();
	//getToken();
	//AfxMessageBox(_T("CLOSE BRACE"));

	//AfxMessageBox(_T("antes de coma"));
	//CString str;
	//str.Format(_T("Antes de coma Look Ahead...%d  " ), m_lookahead);
	//AfxMessageBox(str);
	
	
	if( m_lookahead == COMMA )
	{
		//AfxMessageBox(_T("Entro de coma"));
		while ( m_lookahead == COMMA )
		{
			//AfxMessageBox(_T("while coma"));
			getToken();
			initializer_list();
			
		}
	}

	
}
Beispiel #4
0
int initializer(void) {
	if( assignment_expression() ) {
	} else if( lookaheadT.type == LCURLY ) {
		match(LCURLY);
		if( initializer_list() ) {}
		if( lookaheadT.type == COMMA ) {
			match(COMMA);
		}
		match(RCURLY);
	} else {
		abort();
	}
}