From cfe591a27631cdee91040d9e0faf572bd75f9e72 Mon Sep 17 00:00:00 2001 From: Arron Vinyard Date: Mon, 8 Jun 2020 12:30:56 -0400 Subject: [PATCH] Fix comment regex --- SPCompletions.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/SPCompletions.py b/SPCompletions.py index 5898bb4..0393c6b 100644 --- a/SPCompletions.py +++ b/SPCompletions.py @@ -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) @@ -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'\/\*(.*?)\*\/')