-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
iF4EAREIAAYFAlJAckMACgkQRL8D6wymVNbTEAEAmhCezF2YDhawZoyjnsdn7w3G
QCO6370f2AN+I154G0IBAJwpyO1DaEJmvyPhEREiVFjo3idKENReW+Hy2sT0rLZi
=1cbg
-----END PGP SIGNATURE-----
I have a program with a number of constructs like this:-
for subscriptI to count someThing do
something( subscriptI ) := ""
repeat
@...
begin
for subscriptJ to count someThingElse do
someThingElse( subscriptJ ) := ""
repeat
end
And I ant to replace all the different subscripts with a generic 'i' or (for nested loops) 'j'
What I thought of was to use a global operation limited to the 'for' and the matching 'repeat', and what I tried was this:-
:/^\(\s\+\)for\s\+\(\a\k*\)\s\+to.*/,/^\1repeat/g/\2/s/\2/i/g
Only I fell at the first hurdle because it fails to find the matching repeat pattern.
Is this possible? Or am I missing an easier way to do this?
Regards, Andy
--
Andrew Long
andrew dot long at mac dot com
Monday, September 23, 2013
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment