Skip to content

Commit 6a3d953

Browse files
mmereckiigcbot
authored andcommitted
Fix MDAutogen script
Pass the complete line (with comments) to the `skipLine()` function. Fix detection of `#include` keyword in comments.
1 parent cb6c3f8 commit 6a3d953

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

IGC/common/autogen.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ def parseCmdArgs():
5454

5555

5656
def skipLine(line):
57-
if line.find("};") != -1:
57+
lineNoComment = line.split("//")[0]
58+
if lineNoComment.find("};") != -1:
5859
return True
5960
return False
6061

@@ -126,8 +127,8 @@ def parseFile(fileName, insideIGCNameSpace):
126127
found_struct = DeclHeader(line, words[1], [])
127128
while line.find("};") == -1:
128129
line = next(file, None)
129-
line = line.split("//")[0]
130130
if not skipLine(line):
131+
line = line.split("//")[0]
131132
extractVars(line, found_struct)
132133
structureNames.append(found_struct)
133134
#
@@ -137,12 +138,12 @@ def parseFile(fileName, insideIGCNameSpace):
137138
found_enum = DeclHeader(line, words[nameIdx], [])
138139
while line.find("};") == -1:
139140
line = next(file, None)
140-
line = line.split("//")[0]
141141
if not skipLine(line):
142+
line = line.split("//")[0]
142143
extractEnumVal(line, found_enum)
143144
enumNames.append(found_enum)
144145
#
145-
if line.find("#include") != -1:
146+
if line.lstrip().startswith("#include") == True:
146147
words = line.split()
147148
parent_dir = os.path.dirname(fileName)
148149
include_file = words[1][1:-1] # cut off the "" or <> surrounding the file name

0 commit comments

Comments
 (0)