Here are the rules I would like implemented.
(1) A Fortran conditional statement begins with IF, ELSEIF, or ELSE IF, case insensitive (treat "if" and "If" the same as "IF", etc). Leave exactly one space before and after the conditional clause of an if statement, so that
IF(MN.GT.2)GO TO 10
ELSEIF (MN.GT.2)GO TO 10
ELSE IF (MN.GT.2)GO TO 10
become
IF (MN.GT.2) GO TO 10
ELSEIF (MN.GT.2) GO TO 10
ELSE IF (MN.GT.2) GO TO 10
(2) In a DO statement (beginning with DO, leave exactly
one space after the DO, one space before and after the equal sign, and no spaces after that, so
DO month = 1, 12, 1
DO month = 1, 12
become
DO month = 1,12,1
DO month = 1,12
(3) Put a space before and after the first equal sign in
an assignment, so
a=b+c
becomes
a = b+c
(4) Remove all spaces just after an opening parenthesis (, brace {, or
bracket [ or just before the closing characters ) } ] so that
day = ( date + n1 + n2 - ( yr / 100 ) + (yr / 400 ) - 1)
become
day = (date + n1 + n2 - (yr / 100) + (yr / 400) - 1)
Put ([{ and )]} in lists that I can modify.
(5) Remove spaces both before and after the characters
* and / , so that
y = x * y + z / a
becomes
y = x*y + z/a
Put * and / in a list so that I can easily change.
(6) Do not change any text that is within single or double quotes.
(7) Do not change the column in which any line of code starts.
The Perl or Python script should read the file name from standard input and write to standard output.
## Deliverables
Perl code that works with Perl 5.8.6 or Python code that works with Python 2.4.
## Platform
Windows XP