Create parsor for simple if statements

Hi guys, I am seeking help/advice to make a very simple parser that use just if statement (I mean not with else statement or elsif)

I did already a condition parser that work, but I don’t know how to manage if there is multiple if.

Basically, when my parser read a configuration file, I would like when it parse it to read the if statements:

Example:

if (condition)
    if (condition)
        (do this)
    end
    if (condition)
        (do this)
    end
end

How can I manage this ? I tried to put the problem on paper, find a way, but I actually don’t really find a solution. If someone have experience already with this, I will be grateful

In my example, if you are in the last condition, how can I know if I am not under the previous one ?