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

Perl syntax highlighting issue - s{foo}{bar} if $baz; #131322

Closed
NorthboundTrain opened this issue Aug 21, 2021 · 3 comments
Closed

Perl syntax highlighting issue - s{foo}{bar} if $baz; #131322

NorthboundTrain opened this issue Aug 21, 2021 · 3 comments
Assignees
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream

Comments

@NorthboundTrain
Copy link

Issue Type: Bug

Perl's regex operators can use any pair of matching characters as delimiters (see https://perldoc.perl.org/perlop#Regexp-Quote-Like-Operators). When using a bracketing character as the delimiter, e.g. ({[, then the matching closing bracket can be used to close the operator, e.g. m<foo> or s{foo}{bar}. The bug only occurs when using the substitution operator (s///), and only when using bracketing delimiters, and only with a statement modifier (a trailing if, while, etc).

Screen Shot 2021-08-21 at 12 25 02 PM

VS Code version: Code 1.56.2 (Universal) (054a929, 2021-05-12T17:44:30.902Z)
OS version: Darwin x64 20.5.0

System Info
Item Value
CPUs Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz (16 x 2300)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 2, 2, 2
Memory (System) 32.00GB (9.12GB free)
Process Argv --crash-reporter-id 90d0d44f-9a2d-4c6d-8a76-8104cbdd8a55
Screen Reader no
VM 0%
Extensions (31)
Extension Author (truncated) Version
Bookmarks ale 13.1.0
spellright ban 3.0.60
github-markdown-preview bie 0.0.2
markdown-checkbox bie 0.1.3
markdown-emoji bie 0.1.0
markdown-preview-github-styles bie 0.2.0
markdown-yaml-preamble bie 0.0.4
vscode-markdownlint Dav 0.43.2
vscode-simpler-icons dav 1.6.5
shebang-language-associator dav 1.1.1
gitlens eam 11.5.1
permute-lines ear 1.1.0
prettier-vscode esb 7.1.1
code-runner for 0.11.5
perl-outline hit 0.0.7
bats jet 0.1.7
vsc-space-block-jumper jmf 1.2.2
jq-syntax-highlighting jq- 0.0.2
bash-ide-vscode mad 1.11.0
python ms- 2021.5.926500501
vscode-pylance ms- 2021.7.7
jupyter ms- 2021.6.999406279
remote-ssh ms- 0.65.7
remote-ssh-edit ms- 0.65.7
oracledevtools Ora 19.3.4
jq-vscode pet 0.1.3
remote-vscode raf 1.1.0
rehydrate Lla 0.0.2
vscode-workspace-switcher sad 1.15.3
rewrap stk 1.14.0
shellcheck tim 0.15.2

(1 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
pythonvspyt639:30300192
pythontb:30283811
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263:30335439
vscoreces:30322571
pythondataviewer:30285071
pythonvsuse255:30340121
vscod805:30301674
pythonvspyt200:30340761
vscextlang:30333561
binariesv615:30325510
vsccppwtct:30329789
pythonvssor306:30344512
bridge0708:30335490
vstre464cf:30350173
bridge0723cf:30351748

@alexr00
Copy link
Member

alexr00 commented Aug 24, 2021

@NorthboundTrain can you please provide a code snippet that repos the issue that I can copy/paste for testing?

@alexr00 alexr00 added the info-needed Issue requires more information from poster label Aug 24, 2021
@NorthboundTrain
Copy link
Author

Thanks for the help!

s/foo/bar/; # OK
s/foo/bar/ unless $baz; # OK
s/foo/bar/ if $baz; # OK

s{foo}{bar}; # OK
s{foo}{bar} if $baz; # BROKEN
# lasts until a scalar variable is given; neither an @array nor a %hash works,
# but the $scalar does (but the remainder of the line is still FUBAR)
# next line is OK, though

s(foo)(bar) if $baz; # BROKEN - $clear;
s[foo][bar] if $baz; # BROKEN - $clear;
s<foo><bar> if $baz; # BROKEN - $clear;
s:foo:bar: if $baz; # OK
s#foo#bar# if $baz; # OK

# other statement modifiers
s(foo)(bar) for $baz; # BROKEN differently
s(foo)(bar) foreach $baz; # BROKEN - $clear
s(foo)(bar) unless $baz; # OK
s(foo)(bar) until $baz; # BROKEN differently
s(foo)(bar) when $baz; # BROKEN differently
s(foo)(bar) while $baz; # BROKEN differently

# other regex/quote-like operators are OK:
m/foo/ if $baz; # OK
m{foo} if $baz; # OK
q/foo/ if $baz; # OK
q{foo} if $baz; # OK
qq/foo/ if $baz; # OK
qq{foo} if $baz; # OK
qw/foo/ if $baz; # OK
qw{foo} if $baz; # OK

@alexr00
Copy link
Member

alexr00 commented Aug 25, 2021

Thanks, I can reproduce the issue. We get our perl syntax highlighting grammar from https://github.com/textmate/perl.tmbundle. I've moved the issue there: textmate/perl.tmbundle#49

@alexr00 alexr00 closed this as completed Aug 25, 2021
@alexr00 alexr00 added grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream and removed info-needed Issue requires more information from poster labels Aug 25, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
grammar Syntax highlighting grammar upstream-issue-linked This is an upstream issue that has been reported upstream
Projects
None yet
Development

No branches or pull requests

3 participants