Dependence on Programming Experts

J. Landman Gay jacque at hyperactivesw.com
Wed Jul 12 13:23:18 EDT 2006


Robert Sneidar wrote:

> Now I am confronted with converting a LOT of Foxpro code which profusely 
> uses the x = 5 syntax, into Revolution, and wish to high heaven this 
> form was supported. One less thing to have to convert.

You could write a script to do it. This is a start:

function translate pData
   put  "(.*) = (.*)" into tRegEx
   repeat for each line l in pData
     if matchText(l,tRegEx,var1,var2) = true and word 1 of l <> "if" then
     put "put" && var2 && "into" && var1 & cr after tNewScript
   else
     put l & cr after tNewScript
     end if
   end repeat
   return tNewScript
end translate

You may need to add other exceptions to the "if" test. I routinely write:

   if it = ""

which shouldn't be translated, and I may have forgotten some other 
constructs too, but this may give you an idea. Pass the function a whole 
script and see what it sends back. It doesn't account for instances 
where there are no spaces around the "=", so that would be the first 
thing to change.

The above will no doubt be improved by someone with a one-line regex. ;)

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list