Skip to content

Commit

Permalink
Fix comment regex
Browse files Browse the repository at this point in the history
  • Loading branch information
JoinedSenses authored Jun 8, 2020
1 parent de52011 commit cfe591a
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions SPCompletions.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,22 +442,22 @@ def process_lines(line_reader, node):
break

# strip multiline comments if only written on single line
# buffer = comment_re.sub('', buffer)
# buffer = buffer.strip()
# if not buffer or buffer.startswith('//'):
# continue
buffer = comment_re.sub('', buffer)
buffer = buffer.strip()
if not buffer or buffer.startswith('//'):
continue

# # assumes no nested comments. compiler marks those as invalid
# while buffer.startswith('/*'):
# # print('Skipping multi-line comment')
# pos = buffer.find('*/');
# while pos == -1:
# buffer = read_line(line_reader)
# pos = buffer.find('*/')
# buffer = buffer[pos+2:].strip()

# if not buffer or buffer.startswith('//'):
# continue
# assumes no nested comments. compiler marks those as invalid
while buffer.startswith('/*'):
# print('Skipping multi-line comment')
pos = buffer.find('*/');
while pos == -1:
buffer = read_line(line_reader)
pos = buffer.find('*/')
buffer = buffer[pos+2:].strip()

if not buffer or buffer.startswith('//'):
continue

if brace_level == 0:
m = enum_re.search(buffer)
Expand Down Expand Up @@ -776,4 +776,4 @@ def read_string(buffer, found_comment, brace_level):
function_re = re.compile(r'^[ \t]*(?:(native|stock|forward)\b[ \t]+)?(?:([\w_]+)(?:[ \t]+|:))?([\w_]+[ \t]*\()')
fullfunction_re = re.compile(r'^[ \t]*(?:(native|stock|forward)\b[ \t]+)?(?:([\w_]+)(?: +|:))?([\w_]+ *\(.*?\))')
define_re = re.compile(r'#define[ \t]+([^\s]+)[\s]+(.+)')
comment_re = re.compile(r'\/\*(.*?\n?)+\*\/')
comment_re = re.compile(r'\/\*(.*?)\*\/')

0 comments on commit cfe591a

Please sign in to comment.