Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax highlighting bug on regular expressions containing '#' inside a conditional #32

Open
variacc opened this issue Jun 1, 2018 · 1 comment

Comments

@variacc
Copy link

variacc commented Jun 1, 2018

The Perl syntax highlighting breaks on regular expressions that implicitly use the default input variable and contain the '#' character.
The syntax highlighting breaks if the following conditions are met:

  • The regex implicitly uses the default $_ variable
  • The regex is not the first item in the conditional
  • The regex follows an 'and' or 'or' operator

The rest of the line following the # is highlighted as a comment.

if (/^#/ and $something) { moo(); } # Syntax highlighting is good
if ($something && /^#/) { moo(); } # Syntax highlighting is good
if ($something and /^#/) { moo(); } # Syntax highlighting breaks!

@chrstphrchvz
Copy link

Using m// instead of // (i.e. m/^#/) seems to workaround this issue.

The way I would describe why it doesn't affect the first two cases is that there isn't something to the left of the matching operator // that isn't one of a few characters of operators (&, |, and ~ are the only I've found) or the opening parenthesis (.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants