pootek - 2007-07-30

Logged In: YES
user_id=1856779
Originator: YES

It can be solved by using a bit different check method: int a=0. When '[' is found increment a, but when ']' is found first check if a>0. If not throw exception, else decrement a.
After reaching the end of commands, check if a!=0. If not throw an exception. Just swap the second for-loop in ParseSrc with this one:
for(int i = 0; i < source.Length; i++)
switch (source[i])

{

case '[': bracketCount++; break;

case ']':
if(bracketCount<=0){ MessageBox.Show("Syntax error"); return null; }
bracketCount--; break;

}