File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -207,15 +207,30 @@ namespace FPL::Parser {
207207
208208 if (ExpectOperator (data, " {" ).has_value ()) {
209209 // On récupère le contenu de la fonction
210- while (!ExpectOperator (data, " }" ).has_value ()) {
210+
211+ int totalInstructionInDefinition = 0 ;
212+
213+ while (true ) {
211214 auto currentToken = data.current_token ;
215+ if (currentToken->TokenText == " definir" ) {
216+ totalInstructionInDefinition += 1 ;
217+ }
218+
212219 if (currentToken->TokenType == FPL::Tokenizer::CHAINE_LITTERAL) {
213220 currentToken->TokenText = " \" " + currentToken->TokenText += " \" " ;
214221 }
215222 fonction.FonctionContentCode .push_back (currentToken->TokenText );
216223 data.incrementeTokens (data);
217224
218- if (ExpectOperator (data, " }" ).has_value ()) { break ; }
225+ if (ExpectOperator (data, " }" ).has_value ()) {
226+ if (totalInstructionInDefinition > 0 ) {
227+ fonction.FonctionContentCode .emplace_back (" }" );
228+ totalInstructionInDefinition -= 1 ;
229+ } else {
230+ break ;
231+ }
232+ }
233+
219234 }
220235
221236 data.Map_Fonctions [fonction.FonctionName ] = fonction;
You can’t perform that action at this time.
0 commit comments