Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions proto2cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def parseFile(self, inputFile):

# Search for "enum" and if one is found before comment,
# start changing all semicolons (";") to commas (",").
matchEnum = re.search("enum", line)
matchEnum = re.search(r'\benum\b', line)
if matchEnum is not None and (matchComment is None or matchEnum.start() < matchComment.start()):
isEnum = True
# Search again for semicolon if we have detected an enum, and replace semicolon with comma.
Expand All @@ -155,7 +155,7 @@ def parseFile(self, inputFile):
# be a proper C(++) struct and Doxygen will handle it correctly.
line = line[:matchClosingBrace.start()] + "};" + line[matchClosingBrace.end():]
# Search for 'message' and replace it with 'struct' unless 'message' is behind a comment.
matchMsg = re.search("message", line)
matchMsg = re.search(r'\bmessage\b', line)
if matchMsg is not None and (matchComment is None or matchMsg.start() < matchComment.start()):
output = "struct" + line[:matchMsg.start()] + line[matchMsg.end():]
theOutput += output
Expand Down