Autoformatting
Posted: Tue Aug 07, 2012 5:48 am
I saw the best decision in the jEdit editor. Any line, matching to own regular expression, automatically receives indentation. Unfortunately, even coders of this fine editor didn't finish thinking about this clever thought up to the end. It would be logical to add expression for a ledge also. Here is how it could look.
[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:
[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