easy partiel

This commit is contained in:
2016-02-23 18:02:37 +01:00
parent cd4e0880e5
commit 336d8d58bd
102 changed files with 15322 additions and 10 deletions

View File

@@ -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__ );