[Indent]
\s*(if|elsif)\s+.+\s+then
\s*else
\s*(while|for)\s+.+\s*do
.*(procedure|function)\s+.+\(.*\))\s*
[Ledge]
\s*end\s(if|while|for|procedure|function)
Result is formatting on-the-fly:
Code: Select all
export function permute3(sequence x)
  sequence AllPermutations = {}
  integer Quantity = length(x)
  sequence CurrentPermutation
  for i = 1 to Quantity do
    for j = 1 to Quantity do
      if i != j then
        for k = 1 to Quantity do
          if k != i and k != j then
            CurrentPermutation = x[i] & x[j] & x[k]
            AllPermutations = append(AllPermutations, CurrentPermutation)
          end if
        end for
      end if
    end for
  end for
  return AllPermutations
end function