Allan Odgaard <throw-away-1@...> writes:
Thanks for the simplification. As you may have noticed, I am rather a newbie with RegExp... Your simplified version seems to work fine.
I didn’t fully understand the first branch of the start pattern. You can have type + random text repeated zero or more times, and then the subroutine/program/module/function keyword?
I wanted to take care of the “function” declaration where you can indicate the type of the function on the very first line like so :
real*8 function blabla() some code here end function blabla
So the start marker must not simply be '^\s*(function)\b' or so... Because I always use an asterisk in my type declaration, I made it detect that (I always use : real*4, real*8, integer*4, complex*8 for type declaration) and not the “end function” line (which should be picked by the stop marker).
Currently it is required that fold start and stop patterns have the same indent, so I am afraid this one is not possible to match.
OK. In that case, maybe exclude from the start markers the “do” line like those :
do 10 i=...
i.e. a “do” word immediatly followed by a number. It will exclude folding alltogether for those loops but at least, in the whole program, there should be the same number of start and stop markers so that it is possible to fold the whole program.