Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / DBP: Code checker - to help solve nesting errors.

Author
Message
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 6th Nov 2006 12:39
If, like me, you have ever typed a whole load of code into a large program without having compiled it for a while, you will may be familiar with the 'could not close nest' error message. You get this message when your code structure is incorrect - for example, if you have an 'if' without a 'then' or 'endif', or if you have a 'for' without a 'next'.

Trying to find the error in a program several thousand lines long, especially when your indenting isn't as neat as it should be, can lose you hours (trust me!).

This code may be of some help - I have found it very useful for my own debugging. All you need to do is paste the full path of the .dba file you want to scan at the top of the code, and it will check the structure of your code, reporting any mismatched ifs/thens/endifs, whiles/endwhiles, repeats/untils, and fors/nexts.

It will also tell you the name and line number of mismatched for/next loops. The scanner will automatically disregard any parts of your code remmed out with the ` character, or the rem/remstart/remend commands.

If any clever sausage feels like improving the code in any way, please do.



TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 26th Nov 2006 04:57
I'm upset now Ric!

You've obviously never seen or heard of DBA Tidy.

I suppose I must have written it about 4 years ago, so it's no wonder you don't know about it...

TDK_Man

Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 26th Nov 2006 22:14
Quote: "You've obviously never seen or heard of DBA Tidy"


I'm afraid I haven't! And a search of these forums (including all threads started by you) doesn't appear to come up with anything. Perhaps you didn't post it here?

Anyway, it's not the first time I've reinvented the wheel, and it probably won't be the last!

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 27th Nov 2006 00:08


In fact, come to think of it, I probably posted it on the old forums - it was that long ago!

Mine was a Delphi program though - not DB...

TDK_Man

Login to post a reply

Server time is: 2024-11-22 23:17:10
Your offset time is: 2024-11-22 23:17:10