comp error
This commit is contained in:
parent
0bffeedd78
commit
989f1f17fd
|
@ -5,9 +5,16 @@ impl Pendragon {
|
|||
let texte = arguments
|
||||
.replace("ouvre la parenthèse", "ouvre-la-parenthese")
|
||||
.replace("ferme la parenthèse", "ferme-la-parenthese");
|
||||
.replace("est égal à", "est-egal-a");
|
||||
.replace("est différent de", "est-different-de");
|
||||
.replace("est supérieur ou égal à", "est-superieur-ou-egal-a");
|
||||
.replace("est inférieur ou égal à", "est-inferieur-ou-egal-a");
|
||||
.replace("est supérieur à", "est-superieur-a");
|
||||
.replace("est inférieur à", "est-inferieur-a");
|
||||
let elements_texte: Vec<&str> = texte.split(" ").collect();
|
||||
let mut expression: Vec<Element> = Vec::new();
|
||||
let mut pile_operateurs: Vec<Operateur> = Vec::new();
|
||||
let mut comparaison: Vec<Element> = Vec::new();
|
||||
|
||||
for element in elements_texte {
|
||||
match element {
|
||||
|
|
|
@ -152,6 +152,7 @@ pub enum Element {
|
|||
Booleen(bool),
|
||||
Variable(String, TypeElement),
|
||||
Operateur(Operateur),
|
||||
Comparaison(Comparaison),
|
||||
}
|
||||
|
||||
impl Element {
|
||||
|
@ -159,7 +160,7 @@ impl Element {
|
|||
match self {
|
||||
Self::Entier(_) => TypeElement::Entier,
|
||||
Self::Texte(_) => TypeElement::Texte,
|
||||
Self::Booleen(_) => TypeElement::Booleen,
|
||||
Self::Booleen(_) || Self::Comparaison(_) => TypeElement::Booleen,
|
||||
Self::Variable(_, type_element) => type_element.clone(),
|
||||
Self::Operateur(operateur) => operateur.type_element(),
|
||||
}
|
||||
|
@ -188,4 +189,18 @@ impl Operateur {
|
|||
Self::Plus | Self::Moins | Self::Fois | Self::Divise | Self::ParentheseEntier => TypeElement::Entier,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub enum Comparaison {
|
||||
Egal(Element, Element),
|
||||
Different(Element, Element),
|
||||
Superieur(Element, Element),
|
||||
Inferieur(Element, Element),
|
||||
SuperieurEgal(Element, Element),
|
||||
InferieurEgal(Element, Element)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue