Your 6th item in directive
causes Catastrophic backtracking
# Annotatable definition attributes
resulting in TextMate giving up on the rest of the line
\b((?:\s*(?!class|enum|interface|type|namespace|var|const|function|extends|implements|default\s+xml\s+namespace|new|delete|void|typeof|await|yield|instanceof|not\s+in|in|is(\s+not)?|as|if|else|for\s+each|for|return|throw|switch\s+type|switch|case|try|catch|finally\b)(?:[\p{L}$_\p{Nl}]|\\u((\{[A-Fa-f0-9]+\})|[A-Fa-f0-9]{4}))(?:[\p{L}$_\p{Nl}\p{Mn}\p{Mc}\p{Nd}\p{Pc}]|\\u((\{[A-Fa-f0-9]+\})|[A-Fa-f0-9]{4}))*(?:\s*\.\s*(?:[\p{L}$_\p{Nl}]|\\u((\{[A-Fa-f0-9]+\})|[A-Fa-f0-9]{4}))(?:[\p{L}$_\p{Nl}\p{Mn}\p{Mc}\p{Nd}\p{Pc}]|\\u((\{[A-Fa-f0-9]+\})|[A-Fa-f0-9]{4}))*)*)+)\s*(?=class|enum|interface|type|namespace|var|const|function)\b
I would recommend using atomic groups (?>...)
and possessive quantifiers ?+
, *+
& ++
where possible
This will disable backtracking
Just remember it can be a double edge sword if you've set up your regex in a way that requires backtracking for it to work