@@ -514,7 +514,6 @@ namespace FPL {
514514 auto PossibleFonction = CheckerIdentifiant ();
515515 if (PossibleFonction.has_value ()) {
516516 if (isFonction (PossibleFonction->mText )) {
517-
518517 FonctionDefinition f = mFonctions [PossibleFonction->mText ];
519518
520519 if (VarType->mType != f.ReturnType .mType && VarType->mType != AUTO) {
@@ -544,9 +543,32 @@ namespace FPL {
544543 if (fonction != std::nullopt ) {
545544 variable.InFonction = true ;
546545 }
547-
548546 mVariables [variable.VariableName ] = variable;
549547 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+ }
550572 } else {
551573 std::cerr << " Cette fonction est inexistante." << std::endl;
552574 exit (1 );
@@ -868,7 +890,7 @@ namespace FPL {
868890 continue ;
869891 }
870892
871- std::cerr << " Identifier inconnu : " << mCurrentToken ->mText << std::endl;
893+ std::cerr << " Identifier inconnu : " << mCurrentToken ->mText << " : " << mCurrentToken -> mLineNumber << std::endl;
872894 ++mCurrentToken ;
873895 }
874896 }
0 commit comments