Hey I made a little scanner to debug code for nesting errors since the DB one wasn\'t very good. its not perfect, but it works, all you do is copy your code into a txt file and then load it with the scanner. has to be in the same folder as the scanner. The only problem with it is this
if you\'re code were like this and you forgot the endif for blue if statement. it would return red as the error. it only does it for these type situations, but the moment it finishes all the if statements in that section it works correctly again
Edit----
If the nesting errors run past the page, you can use the up and down errors to scroll between them
Edit----
to try to prevent confusion. if your code looked like this
Pseudo code:
if color=red
if color=blue
if color=green
endif
endif
if this=that
endif
it would return the if color=red line as the nesting error line
you could conclude from that your nesting error was in these lines
--------------------
if color=red
if color=blue
if color=green
endif
endif
--------------------------
if this=that
endif
Scanner
sync on : sync rate 0 : cls
dim line(99999,2)
dim linename$(99999)
input "File Name: ";filename$
input "Line Start: ";start
input "Line Stop: ";stop
cls
if file exist(filename$+".txt")=1
open to read 1,filename$+".txt"
read string 1,total$
for l=1 to start-1
read string 1,tempstring$
next l
for l=1 to stop-start
read string 1,tempstring$
linename$(l)=tempstring$
for o=1 to len(tempstring$)
line(l,2)=l+start
if right$(left$(tempstring$,o),1)=" " or o=len(tempstring$)
if o=len(tempstring$)
if right$(left$(tempstring$,o),count+1)="if"
line(l,1)=1
endif
if right$(left$(tempstring$,o),count+1)="for" and right$(left$(tempstring$,o-5),7)<>"suspend"
line(l,1)=2
endif
if right$(left$(tempstring$,o),count+1)="do"
line(l,1)=3
endif
if right$(left$(tempstring$,o),count+1)="repeat"
line(l,1)=4
endif
if right$(left$(tempstring$,o),count+1)="until"
for sub=0 to l
if line(l-sub,1)=4
line(l-sub,1)=0
sub=l
endif
next sub
endif
if right$(left$(tempstring$,o),count+1)="loop"
for sub=0 to l
if line(l-sub,1)=3
line(l-sub,1)=0
sub=l
endif
next sub
endif
if right$(left$(tempstring$,o),count+1)="next"
for sub=0 to l
if line(l-sub,1)=2
line(l-sub,1)=0
sub=l
endif
next sub
endif
if right$(left$(tempstring$,o),count+1)="then"
line(l,1)=0
endif
if right$(left$(tempstring$,o),count+1)="endif"
for sub=0 to l
if line(l-sub,1)=1
line(l-sub,1)=0
sub=l
endif
next sub
endif
else
if right$(left$(tempstring$,o-1),count)="if"
line(l,1)=1
endif
if right$(left$(tempstring$,o-1),count)="for" and right$(left$(tempstring$,o-5),7)<>"suspend"
line(l,1)=2
endif
if right$(left$(tempstring$,o-1),count)="do"
line(l,1)=3
endif
if right$(left$(tempstring$,o-1),count)="repeat"
line(l,1)=4
endif
if right$(left$(tempstring$,o-1),count)="until"
for sub=0 to l
if line(l-sub,1)=4
line(l-sub,1)=0
sub=l
endif
next sub
endif
if right$(left$(tempstring$,o-1),count)="loop"
for sub=0 to l
if line(l-sub,1)=3
line(l-sub,1)=0
sub=l
endif
next sub
endif
if right$(left$(tempstring$,o-1),count)="next"
for sub=0 to l
if line(l-sub,1)=2
line(l-sub,1)=0
sub=l
endif
next sub
endif
if right$(left$(tempstring$,o-1),count)="then"
line(l,1)=0
endif
if right$(left$(tempstring$,o-1),count)="endif"
for sub=0 to l
if line(l-sub,1)=1
line(l-sub,1)=0
sub=l
endif
next sub
endif
endif
count=0
else
count=count+1
endif
next o
next l
close file 1
errors=0
for l=1 to stop-start
if line(l,1)=1 or line(l,1)=2 or line(l,1)=3 or line(l,1)=4
errors=errors+1
endif
next l
toterrors=errors
do
text 0,0,filename$+".txt"
errors=0
if tab<toterrors-24
if downkey()=1 then tab=tab+1
endif
if tab>0
if upkey()=1 then tab=tab-1
endif
for l=1 to stop-start
if line(l,1)=1 or line(l,1)=2 or line(l,1)=3 or line(l,1)=4
errors=errors+1
if errors>tab and errors<=24+tab
text 0,(errors-tab)*20,"Nesting Error on line: "+str$(line(l,2)) : text 320,(errors-tab)*20,"Line: "+linename$(l)
endif
endif
next l
sync
cls
loop
else
do
text 0,0,filename$+".txt"
text 0,20,"File did not exist"
sync
cls
loop
endif
suspend for key