Created
August 22, 2021 00:23
-
-
Save Beliavsky/1d56773afa9391738d3bd8cdc9b3be03 to your computer and use it in GitHub Desktop.
Convert free source form Fortran to lower case, except for comments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""convert Fortran code to lower case except for comments | |
usage: python xlower_case_fortran.py <source_file> | |
The script writes lower case code to standard output. | |
""" | |
from sys import argv | |
source_file = argv[1] | |
fp = open(source_file,"r") | |
for line in fp: | |
text = line.rstrip() | |
ipos = text.find("!") | |
if ipos >= 0: | |
print(text[:ipos].lower() + text[ipos:]) | |
else: | |
print(text.lower()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment