I was wondering how hard this would be for you to add to SC2.
While it parses the code, have it count how many While/Repeat/If Then commands it encounters, and how many End statements it encounters, then subtract to see if there is enough there.
That can be helpful for people who are programming extremely complex While stuff (like me) for menus, etc.
you should make it count Then commands instead of If's
you use a stack for this.
push everytime you find a command that needs an End and pop every time you find an end. there is anything left in the stack at the end of the program or if it ever tries to pop from an empty stack that means there is a problem.
I've tried this before. the problem is when people are using Advanced stuff like golfing out of a loop and thus having two or more ends for the same loop.
Well, it was just an idea...
it could say, Whiles: X Repeats:Y IF Thens: Z Ends A
That would be a nice addition.
So you know when you accidently miss to put an "End"
right, best of both worlds. This way, you know if you have enough, and can compensate the numbers for the advanced ends (I know I have use them once of twice)
Have it run the same way the interpreter on the calc does, except instead of a mem overflow or syntax error the command line(s) are highlighted in red or something.
dude... that'd be very complicated to make
I know. Do you have a better idea?
true, and parsing takes long enough as it is
Kuro wrote:
Have it run the same way the interpreter on the calc does, except instead of a mem overflow or syntax error the command line(s) are highlighted in red or something.
that isn't feasable, due to external conditions such as getkey and if/loop coditions
i can think of no way around problems like that
That's REALLY complicated, and would require a ton of stuff, like actually running the code implied by each token instead of just parsing them. I think I like the idea of something like this:
Fors: 3
Whiles: 2
Thens: 5
Repeats: 6
Ends: 17
Caution: SourceCoder has detected a count mismatch between your opening conditionals/loops and your closing Ends. This may be a programming error, or it may be due to correct Ending of branched code from within loops.
That seems like a good idea.
Alrighty, I'll try to do that later today.
that is what I was suggesting
Coolness. Do you really think this would be helpful though?
yeah, in my RPG, I have a ton of nested loops and if-thens and counting Ends on a calc screen in annoying
Do you do any funky outlooping though?
once in a while, not in there, but I have once or twice