textmate / perl.tmbundle

TextMate support for Perl
37 stars 26 forks source link

Regular expression breaks syntax highlighting #52

Open alexr00 opened 2 years ago

alexr00 commented 2 years ago

Regular expression breaks syntax highlighting for remainder of the file. The offending line (perl) is here:

if ((($var, $val) = /^\s*([_a-zA-Z0-9]+)\s*=\s*(.*)/) != 2) {

The *'s after each \s seem to be relevant; deleting one fixes the formatting (but deleting two breaks it again).

Steps to Reproduce:

  1. Do above
  2. See error

Originally from @zaharazod in https://github.com/microsoft/vscode/issues/154706

alexr00 commented 2 years ago

Looking at the highlighter code It looks like regex strings can only come after (, {, ~, &, |, if, unless or a newline. in your example, the regex is after a =, which isn't supported image

As a temp work around, you can just surround the regex with brackets (or any of the other valid character) image

Or add = to the list of allowed characters image image https://github.com/textmate/perl.tmbundle/blob/a85927a902d6e5d7805f56a653f324d34dfad53a/Syntaxes/Perl.plist#L1174

Should make report to: https://github.com/textmate/perl.tmbundle

Originally from @RedCMD in https://github.com/microsoft/vscode/issues/154706

zaharazod commented 2 years ago

On Mon, 2022-07-11 at 00:50 -0700, Alex Ross wrote:

Looking at the highlighter code It looks like regex strings can only come after (, {, ~, &, |, if, unless or a newline. in your example, the regex is after a =, which isn't supported image As a temp work around, you can just surround the regex with brackets (or any of the other valid character) image Or add = to the list of allowed characters

Huh! Thank you, that is very helpful!

image image https://github.com/textmate/perl.tmbundle/blob/a85927a902d6e5d7805f56a653f324d34dfad53a/Syntaxes/Perl.plist#L1174 Should make report to: https://github.com/textmate/perl.tmbundle Originally from @RedCMD in microsoft/vscode#154706 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

RedCMD commented 2 years ago

https://github.com/microsoft/vscode/issues/155209 https://github.com/textmate/perl.tmbundle/issues/28 https://github.com/textmate/perl.tmbundle/issues/27