easy partiel
This commit is contained in:
@@ -44,11 +44,11 @@ void syntaxErrorMsg( const char * msg )
|
||||
void programme() {
|
||||
openSection( __func__ );
|
||||
|
||||
if( est_premier( _optDecVariables_, uniteCourante ) || est_premier( _listeDecFonctions_, uniteCourante )) {
|
||||
if( !est_premier( _optDecVariables_, uniteCourante ) && !est_premier( _listeDecFonctions_, uniteCourante ) && !est_suivant( _listeDecFonctions_, uniteCourante )) {
|
||||
syntaxError();
|
||||
} else {
|
||||
optDecVariables();
|
||||
listeDecFonctions();
|
||||
} else if ( !est_suivant( _listeDecFonctions_, uniteCourante ) ) {
|
||||
syntaxError();
|
||||
}
|
||||
|
||||
closeSection( __func__ );
|
||||
@@ -234,6 +234,8 @@ void instruction() {
|
||||
instructionRetour();
|
||||
} else if( est_premier( _instructionEcriture_, uniteCourante ) ) {
|
||||
instructionEcriture();
|
||||
} else if( est_premier( _instructionPour_, uniteCourante ) ) {
|
||||
instructionPour();
|
||||
} else if( est_premier( _instructionVide_, uniteCourante ) ) {
|
||||
instructionVide();
|
||||
} else {
|
||||
@@ -447,6 +449,42 @@ void instructionEcriture() {
|
||||
closeSection( __func__ );
|
||||
}
|
||||
|
||||
void instructionPour() {
|
||||
openSection( __func__ );
|
||||
|
||||
if( uniteCourante == POUR ) {
|
||||
elementConsome();
|
||||
uniteCourante = yylex();
|
||||
|
||||
instructionAffect();
|
||||
expression();
|
||||
|
||||
if( uniteCourante == POINT_VIRGULE ) {
|
||||
elementConsome();
|
||||
uniteCourante = yylex();
|
||||
|
||||
instructionAffect();
|
||||
|
||||
if( uniteCourante == FAIRE ) {
|
||||
elementConsome();
|
||||
uniteCourante = yylex();
|
||||
|
||||
instructionBloc();
|
||||
|
||||
} else {
|
||||
syntaxErrorMsg( "'faire' été attendu" );
|
||||
}
|
||||
|
||||
} else {
|
||||
syntaxErrorMsg( "';' été attendu" );
|
||||
}
|
||||
} else {
|
||||
syntaxErrorMsg( "'pour' été attendu" );
|
||||
}
|
||||
|
||||
closeSection( __func__ );
|
||||
}
|
||||
|
||||
void instructionVide() {
|
||||
openSection( __func__ );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user