non rien de rien et les fonctions

This commit is contained in:
sylvain099
2016-01-31 14:39:09 +01:00
parent d168ca8f22
commit 1869cca27a
4 changed files with 41 additions and 23 deletions

View File

@@ -3,20 +3,6 @@
int uniteCourante;
extern char yytext[100];
void ou(void);
void ouBis(void);
void et(void);
void etBis(void);
void non(void);
void nonBis(void);
void egal(void);
void egalBis(void);
void expArith(void);
void expArithBis(void);
void terme(void);
void termeBis(void);
void facteur(void);
void ou (void){
affiche_balise_ouvrante("ou", 1);
@@ -61,23 +47,21 @@ void etBis(void){
void non(void){
affiche_balise_ouvrante("non", 1);
egal();
nonBis();
egal();
affiche_balise_fermante("non", 1);
}
void nonBis(void){
affiche_balise_ouvrante("etBis", 1);
affiche_balise_ouvrante("nonBis", 1);
if(uniteCourante == NON){
uniteCourante = yylex();
affiche_xml_texte(yytext);
non();
nonBis();
}
affiche_balise_fermante("etBis", 1);
affiche_balise_fermante("nonBis", 1);
}
void egal(void){
@@ -92,7 +76,7 @@ void egal(void){
void egalBis(void){
affiche_balise_ouvrante("egalBis", 1);
if(uniteCourante == NON){
if(uniteCourante == EGAL || uniteCourante == INFERIEUR){
uniteCourante = yylex();
affiche_xml_texte(yytext);
egal();
@@ -178,7 +162,39 @@ void facteur (void) {
}
uniteCourante = yylex();
affiche_xml_texte(yytext);
}
}
else if(uniteCourante == ID_FCT){
uniteCourante = yylex();
affiche_xml_texte(yytext);
if(uniteCourante != PARENTHESE_OUVRANTE){
printf("Erreur de syntaxe");
exit(-1);
}
uniteCourante = yylex();
affiche_xml_texte(yytext);
if(uniteCourante != PARENTHESE_FERMANTE){
ou();
while(uniteCourante == VIRGULE){
uniteCourante = yylex();
affiche_xml_texte(yytext);
ou();
}
}
if(uniteCourante != PARENTHESE_FERMANTE){
printf("Erreur de syntaxe");
exit(-1);
}
uniteCourante = yylex();
affiche_xml_texte(yytext);
if(uniteCourante != POINT_VIRGULE){
printf("Erreur de syntaxe");
exit(-1);
}
uniteCourante = yylex();
affiche_xml_texte(yytext);
}
else {
printf("Erreur de syntaxe");
exit(-1);

View File

@@ -1 +1 @@
(!!!var & var) | (10 -4) & 10 < (5/3)
(!!!$var & $var) | (10 -4) & 10 < (5/3)

View File

@@ -0,0 +1 @@
expression(1,10);

1
test/expressionfctsimple Normal file
View File

@@ -0,0 +1 @@
test();