the question seems simple, but isn't.
think that i have the functions list and it's parameters and the variables on vectors(inclued it's types.. it's a structure).
now see these string(yes i have the words\operators count):

function1 ( function2 ( ) , function3 ( parameter1 ) , parameter3 )

the count, in these sample, is 13.
like you see i have a function, these function have parameters... these parameteres have functions and variables.. that functions can be another functions(nested functions).
these sample is like a nested functions call.
my question is: how can i create a nested loop for control all functions and parameters(if the functions\variables exist)?
like i said, i have the functions\variables names and it's parameteres on a vectors(i have 1 vector for functions\procedure and parameters(names and types and the return type) and other vector for a variables(name and type)
Happy Christmas to all

Perhaps it's just me, but I couldn't make any sense of that explanation.

i'm sorry.
my loops must:
1 - test if that functions\variables was created;
2 - if that parameters types are combined with variable\functions types.
but i need create a loop for eatch function and test their parameters types with variables\functions types

Now it's starting to sound like an assignment. Can we see what book, class this is? Usually the preceding chapters build up to this sort of assignment.

Forget loops for a moment. What would you write to test any of the above now?

when i create a function, and test if theres any error, the function name is added on vector of a structor.
if the function have parameters i add them on another vector on same structor.
i have 2 functions:

struct FunctionList
    {
        string Name;
        string Return;
        vector<string> ParametersType;
    };

vector <FunctionList> FuncList;

struct VarSimplification
    {
        string Name="";
        string Type="";
        string Value="";
        bool Const=false;
        bool Pointer=false;
        int Scope=0;
    };
vector <VarSimplification> VarList;

int IsVarName(string VarName)
    {
        for(unsigned int VarListIndex=0; VarListIndex<VarList.size(); VarListIndex++)
        {
            if(VarName== VarList[VarListIndex].Name)
            {
                return VarListIndex;
            }
        }
        return -1;
    }

int IsFunction(string FunctionName)
    {
        for(unsigned int FunctionListIndex=0; FunctionListIndex<FuncList.size(); FunctionListIndex++)
        {
            if(FuncList[FunctionListIndex].Name==FunctionName)
                return FunctionListIndex;
        }
        return -1;
    }

both of them give me the vector index, if the function\variable was created.
now see the entire string from a vector string(like a function call):

function1 (var1, var2)
  • i can test if the function was created;
  • i can test if the var1 and var2 variables was created;
  • i can test if the var1 type is igual to parameter1 type.
    these is the simple string, just testing variables.
    but instead use variables we can use functions:

    function1 ( function2 ( ) , function3 ( parameter1 ) , parameter3 )

and these is more complex for test the entire line.
so what you can advice?
i belive, doing these topic i had some ideas, i must create a function for test all function parameters..... if the next parameter is a function, then i recall the function...
it's just an ideia, but maybe it's the best... like the recurse function

finally i did the function:

void FunctionRules(int &FunctionListIndex, unsigned int &TokensIndex, vector<TokensSimplification> &tokens)
    {
        for(unsigned int parameters=0;parameters<FuncList[FunctionListIndex].ParametersType.size()-1; TokensIndex++)
        {
            if(parameters>=FuncList[FunctionListIndex].ParametersType.size()-1 || TokensIndex>=tokens.size()-1)
                break;
            else if(FunctionListIndex>FuncList.size()-1 || parameters>FuncList[FunctionListIndex].ParametersType.size()-1)
                break;
            else if(IsNumber(tokens[TokensIndex].Description) && IsNumberType(FuncList[FunctionListIndex].ParametersType[parameters]))
                parameters++;
            else if (tokens[TokensIndex].Type==FuncList[FunctionListIndex].ParametersType[parameters])
                parameters++;
            else if(IsVarName(tokens[TokensIndex].Description)>-1)
            {
                int i=IsVarName(tokens[TokensIndex].Description);
                if(VarList[i].Type!=FuncList[FunctionListIndex].ParametersType[parameters])
                {
                    ErrorList.push_back("Line error: " + to_string(LineError) + " - var type parameter incorrect!!!");
                }
                else
                    parameters++;
            }
            else if(IsFunction(tokens[TokensIndex].Description)>-1)
            {
                int i=IsFunction(tokens[TokensIndex].Description);
                if(FuncList[i].Return!=FuncList[FunctionListIndex].ParametersType[parameters])
                {
                    ErrorList.push_back("Line error: " + to_string(LineError) + " - the function must return the parameter type!!!");
                }
                else
                {
                    FunctionRules(i,TokensIndex,tokens);
                    parameters++;
                }

            }
        }
    }

these function test all function parameters and if the variable is the parameter type.
on these function i have 1 memory leak... maybe i'm calling it more that i thot, but i don't know. can anyone advice me?

finally i fixed the error: before i call the 'FunctionRules' i must add these line:

TokensIndex++;

or that 'if's' can call the function again(on a infinite loop)... and i must do the same on 'FunctionRules' too:

void FunctionRules(int &FunctionListIndex, unsigned int &TokensIndex, vector<TokensSimplification> &tokens)
    {
        for(unsigned int parameters=0;parameters<FuncList[FunctionListIndex].ParametersType.size()-1; TokensIndex++)
        {
            if(FunctionListIndex>FuncList.size()-1 || parameters>FuncList[FunctionListIndex].ParametersType.size()-1 || TokensIndex>=tokens.size()-1)
                break;
            else if(IsNumber(tokens[TokensIndex].Description) && IsNumberType(FuncList[FunctionListIndex].ParametersType[parameters]))
                parameters++;
            else if (tokens[TokensIndex].Type==FuncList[FunctionListIndex].ParametersType[parameters])
                parameters++;
            else if(IsVarName(tokens[TokensIndex].Description)>-1)
            {
                int i=IsVarName(tokens[TokensIndex].Description);
                if(VarList[i].Type!=FuncList[FunctionListIndex].ParametersType[parameters])
                {
                    ErrorList.push_back("Line error: " + to_string(LineError) + " - var type parameter incorrect!!!");
                }
                else
                    parameters++;
            }
            else if(IsFunction(tokens[TokensIndex].Description)>-1)
            {
                int i=IsFunction(tokens[TokensIndex].Description);
                if(FuncList[i].Return!=FuncList[FunctionListIndex].ParametersType[parameters])
                {
                    ErrorList.push_back("Line error: " + to_string(LineError) + " - the function must return the parameter type!!!");
                }
                else
                {
                    TokensIndex++;//avoiding the infinite loop
                    FunctionRules(i,TokensIndex,tokens);
                    parameters++;
                }

            }
        }
    }

thank you so much for all to all

commented: It's all your work above. +1 +15

i did more 1 or 1 updates for avoid some errors on code line.. that's why i'm sharing it:

void FunctionRules(int &FunctionListIndex, unsigned int &TokensIndex, vector<TokensSimplification> &tokens)
    {
        for(unsigned int parameters=0;parameters<FuncList[FunctionListIndex].ParametersType.size()-1; TokensIndex++)
        {
            if(FunctionListIndex>FuncList.size()-1 || parameters>FuncList[FunctionListIndex].ParametersType.size()-1 || TokensIndex>=tokens.size()-1)
                break;
            else if(tokens[TokensIndex].Description=="," || tokens[TokensIndex].Description=="(" || tokens[TokensIndex].Description==")")
                continue;
            else if(IsNumber(tokens[TokensIndex].Description) && IsNumberType(FuncList[FunctionListIndex].ParametersType[parameters]))
                parameters++;
            else if (tokens[TokensIndex].Type==FuncList[FunctionListIndex].ParametersType[parameters])
                parameters++;
            else if(IsVarName(tokens[TokensIndex].Description)>-1)
            {
                int i=IsVarName(tokens[TokensIndex].Description);
                if(VarList[i].Type!=FuncList[FunctionListIndex].ParametersType[parameters])
                {
                    ErrorList.push_back("Line error: " + to_string(LineError) + " - var type parameter incorrect!!!");
                }
                else
                    parameters++;
            }
            else if(IsFunction(tokens[TokensIndex].Description)>-1)
            {
                int i=IsFunction(tokens[TokensIndex].Description);
                if(FuncList[i].Return!=FuncList[FunctionListIndex].ParametersType[parameters])
                {
                    ErrorList.push_back("Line error: " + to_string(LineError) + " - the function must return the parameter type!!!");
                }
                else
                {
                    TokensIndex++;
                    FunctionRules(i,TokensIndex,tokens);
                    parameters++;
                }
            }
            else if(tokens[TokensIndex].Type!=FuncList[FunctionListIndex].ParametersType[parameters])
            {
                ErrorList.push_back("Line error: " + to_string(LineError) + " - on call procedure '" + FuncList[FunctionListIndex].Name + "', on parameter " +  to_string(parameters) + " the var type parameter is incorrect '" + tokens[TokensIndex].Description + "' !!!");
            }
        }
    }