From e32d061bfcd7e995a2c740a19e07f6fbebc7a311 Mon Sep 17 00:00:00 2001 From: Keith Hall Date: Fri, 8 Oct 2021 22:07:12 +0300 Subject: [PATCH 1/2] Handle syntax_test headers which use "partial-symbols" mode --- plugins/syntaxtest_dev.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/plugins/syntaxtest_dev.py b/plugins/syntaxtest_dev.py index 176f3ccb..347ff026 100644 --- a/plugins/syntaxtest_dev.py +++ b/plugins/syntaxtest_dev.py @@ -23,7 +23,16 @@ 'AssertionLineDetails', ['comment_marker_match', 'assertion_colrange', 'line_region'] ) SyntaxTestHeader = namedtuple( - 'SyntaxTestHeader', ['comment_start', 'comment_end', 'syntax_file', 'reindent'] + 'SyntaxTestHeader', ['comment_start', 'comment_end', 'syntax_file', 'test_mode'] +) + + +syntax_test_header_regex = re.compile( + r'^(?P\s*.+?)' + r'\s+SYNTAX TEST\s+' + r'(?P(?:partial-symbols|(?:reindent(?:-un(?:indented|changed))?)\s+)*)' + r'"(?P[^"]+)"' + r'\s*(?P\S+)?$' ) @@ -37,11 +46,8 @@ def get_syntax_test_tokens(view): match = None if line.size() < 1000: # no point checking longer lines as they are unlikely to match first_line = view.substr(line) - match = re.match(r'^(?P\s*.+?)' - r'\s+SYNTAX TEST\s+' - r'(?P(?:reindent(?:-un(?:indented|changed))?\s+)*)' - r'"(?P[^"]+)"' - r'\s*(?P\S+)?$', first_line) + match = syntax_test_header_regex.match(first_line) + if not match: return None else: From 31506bdb30e4a25df78622a492b49b76fe4a2cfe Mon Sep 17 00:00:00 2001 From: Keith Hall Date: Fri, 8 Oct 2021 22:16:24 +0300 Subject: [PATCH 2/2] Update snippet syntax test to work with latest Regular Expression package changes --- Package/Sublime Text Snippet/syntax_test_snippet.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package/Sublime Text Snippet/syntax_test_snippet.xml b/Package/Sublime Text Snippet/syntax_test_snippet.xml index 361c6816..b437876b 100644 --- a/Package/Sublime Text Snippet/syntax_test_snippet.xml +++ b/Package/Sublime Text Snippet/syntax_test_snippet.xml @@ -208,7 +208,7 @@ It is possible to include a literal newline in the replacement: ${1/test/_ ${TM_CURRENT_LINE/^\\s*((?:\\/\\/[\\/!]?|#|%|--|::|(?i:rem)|'|;)\\s*).*/$1/} -# ^ meta.group.regexp meta.group.regexp meta.literal.regexp +# ^ meta.group.regexp meta.group.regexp # ^ keyword.other.regex.mid.snippet ]]>snippet<