Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Programatically find Return within WITH / ENDWITH
Message
De
23/06/2008 20:00:40
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
23/06/2008 17:33:03
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01326207
Message ID:
01326232
Vues:
14
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform