I was wondering if anybody could help out. I'm creating my own for-fun programming language in C# using the .NET framework and am doing fairly well considering I'm pretty new at this, and was wondering if anybody knew how to how to split a string by the ; character, except when its within (), {}, or []s. So basically:
"monkey;\n
apple = ${\n
food;\n
two;\n
};\n
apply;"
would become
"monkey;"
"\napple = ${\n
food;\n
two;\n
};"
"\napply;"
ATM, I am just using this:
List<string> lines = new List<string>(new Regex(";").Split(code));
which splits by ";", anywhere though
I forgot to say that the {}, (), and []s can be nested...