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< 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: