Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Programatically find Return within WITH / ENDWITH
Message
From
23/06/2008 20:00:40
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
23/06/2008 17:33:03
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01326207
Message ID:
01326232
Views:
13
>Anybody have a programmatic way of finding RERURNs within WITH/ENDWITH constructions?
>
>I thought I had one, but have found it didn't do a very good job.

Assuming you got all the code in .prg files (by either running SccText or class browser export), apply aProcInfo() so you can break the code into snippets - substrings of the whole .prg.

Assuming now that you got one prg/method at a time in a string, chop that into lines using aLines(), then redimension the array you got to be two dimensional and append all into a cursor... like this:
lparameters tcText
n=alines(aRows, tcText)
for i=1 to n
   aRows[i]=allt(chrtran(aRows[i], chr(9), " "))   && trim out any leading tabs
endfor
dimension aRows[n,1]  && make it 2-dim for Append
create cursor crsRows (cRow c(200), nLevel i)
append from array aRows
lnLevel=0
scan
   do case
      case lower(cRow)="with "
         lnLevel=lnLevel+1
      case lower(cRow)="endwith "
         lnLevel=lnLevel-1
   enddo
   replace nlevel with lnLevel
endscan
browse for cRow="retu" and nLevel>0
Of course, you can add row numbers and other stuff, make things easier to find in code references, etc. No guarantee, batteries not included, just an idea, code off headtop.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform