@@ -514,7 +514,6 @@ namespace FPL {
514
514
auto PossibleFonction = CheckerIdentifiant ();
515
515
if (PossibleFonction.has_value ()) {
516
516
if (isFonction (PossibleFonction->mText )) {
517
-
518
517
FonctionDefinition f = mFonctions [PossibleFonction->mText ];
519
518
520
519
if (VarType->mType != f.ReturnType .mType && VarType->mType != AUTO) {
@@ -544,9 +543,32 @@ namespace FPL {
544
543
if (fonction != std::nullopt) {
545
544
variable.InFonction = true ;
546
545
}
547
-
548
546
mVariables [variable.VariableName ] = variable;
549
547
return true ;
548
+ } else if (isVariable (PossibleFonction->mText )) {
549
+ VariableDefinition var = mVariables [PossibleFonction->mText ];
550
+ if (var.HasReturnValue ) {
551
+ if (CheckerOperateur (" ;" ).has_value ()) {
552
+ VariableDefinition variable;
553
+ variable.VariableName = VarName->mText ;
554
+ variable.VariableValue = var.VariableValue ;
555
+ variable.VariableType = Type (var.VariableType .mName , var.VariableType .mType );
556
+ variable.IsGlobal = false ;
557
+ variable.InFonction = false ;
558
+ variable.HasReturnValue = true ;
559
+ if (fonction != std::nullopt) {
560
+ variable.InFonction = true ;
561
+ }
562
+ mVariables [variable.VariableName ] = variable;
563
+ return true ;
564
+ } else {
565
+ std::cerr << " Vous devez mettre le symbole ';' pour mettre fin a l'instruction." << std::endl;
566
+ exit (1 );
567
+ }
568
+ } else {
569
+ std::cerr << " La variable doit avoir une valeur de retour." << std::endl;
570
+ exit (1 );
571
+ }
550
572
} else {
551
573
std::cerr << " Cette fonction est inexistante." << std::endl;
552
574
exit (1 );
@@ -868,7 +890,7 @@ namespace FPL {
868
890
continue ;
869
891
}
870
892
871
- std::cerr << " Identifier inconnu : " << mCurrentToken ->mText << std::endl;
893
+ std::cerr << " Identifier inconnu : " << mCurrentToken ->mText << " : " << mCurrentToken -> mLineNumber << std::endl;
872
894
++mCurrentToken ;
873
895
}
874
896
}
0 commit comments