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")); } } }
int initializer_list(void) { if( initializer() ) { } else if( initializer_list() ) { match(COMMA); initializer(); } }
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(); } } }
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(); } }