Skip to content

Commit c23395a

Browse files
committed
Ajout des fonctionnalités sur l'instruction "changer".
1 parent f1a62e4 commit c23395a

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/Parser.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,15 +1044,26 @@ namespace FPL {
10441044
auto PossibleVar = CheckerIdentifiant();
10451045
if (PossibleVar.has_value()) {
10461046
if (CheckerOperateur(";").has_value()) {
1047-
if (isVariable(PossibleVar->mText)) {
1047+
if (PossibleVar->mText == "vrai" || PossibleVar->mText == "faux") {
1048+
if (isVariable(VarName->mText)) {
1049+
auto var = mVariables[VarName->mText];
1050+
if (var.VariableType.mType == BOOL) {
1051+
mVariables[VarName->mText].VariableValue = PossibleVar->mText;
1052+
return true;
1053+
} else {
1054+
std::cerr << "Ces valeurs ne peuvent etre attribue qu'au variable de type booleen." << std::endl;
1055+
exit(1);
1056+
}
1057+
}
1058+
} else if (isVariable(PossibleVar->mText)) {
10481059
if (mVariables[PossibleVar->mText].VariableType.mType == mVariables[VarName->mText].VariableType.mType) {
10491060
mVariables[VarName->mText].VariableValue = mVariables[PossibleVar->mText].VariableValue;
10501061
return true;
10511062
} else {
10521063
std::cerr << "Le type de la variable n'est pas le même que celui de la variable que vous voulez modifier." << std::endl;
10531064
exit(1);
10541065
}
1055-
} else if (fonction != std::nullopt) {
1066+
} else if (fonction.has_value()) {
10561067
if (isArgument(fonction->FonctionName, PossibleVar->mText)) {
10571068
mVariables[VarName->mText].VariableValue = mArguments[fonction->FonctionName][PossibleVar->mText].ArgValue;
10581069
return true;

0 commit comments

Comments
 (0)