Merge branch 'master' into set_parameters

This commit is contained in:
Otto Kohulak 2022-10-21 08:18:44 +02:00
commit a885761ea2
1 changed files with 21 additions and 0 deletions

View File

@ -117,6 +117,14 @@ class Grep(object):
def declaration(self,string):
return re.match(self.re_declaration,string) is not None
re_preprocessor = re.compile(r"^\s*#.*$")
def preprocessor(self,string):
return re.match(self.re_preprocessor,string) is not None
re_omppragma = re.compile(r"^\s*!\$omp\s.*$")
def omppragma(self,string):
return re.match(self.re_omppragma,string) is not None
grep = Grep()
class indent(object):
@ -178,6 +186,19 @@ class indent(object):
for i in range(len(self.text)):
prevline = line
line = self.text[i].strip()
if line == "":
print("")
continue
if grep.preprocessor(line):
print(line.lstrip())
continue
if grep.omppragma(line):
print(line.lstrip())
continue
if grep.continuation(line):
line = self.format_continuation(line,k)