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

Add support dereferencing with block #50

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

usualoma
Copy link

Hi,

This pull request contains adding support dereferencing with block.
https://metacpan.org/pod/perlref#Block

We can use the following syntax to dereference.

print ${\"string"};
print @{[lc("STRING")]};
print %{{1 => 2}};
print &{sub{ "sub" }};

This syntax is often used to embed expressions in strings.
https://github.com/leejo/CGI.pm/blob/master/lib/CGI.pm#L3638

19974bc makes match a code block, for example, as in the following JavaScript plist.
https://github.com/textmate/javascript.tmbundle/blob/master/Syntaxes/JavaScript.plist#L1047-L1075

Then, 5e87c64 handles dereferencing.

And the following syntax is a pattern of dereferencing with block, so I think we can also add the following changes.

${$variable};
diff --git a/Syntaxes/Perl.plist b/Syntaxes/Perl.plist
index cfc22d9..4ac01e8 100644
--- a/Syntaxes/Perl.plist
+++ b/Syntaxes/Perl.plist
@@ -4587,7 +4587,7 @@
 						</dict>
 					</dict>
 					<key>match</key>
-					<string>(\$\{)(?:[a-zA-Zx7f-xff\$]|::)(?:[a-zA-Z0-9_x7f-xff\$]|::)*(\})</string>
+					<string>(\$\{)(?:[a-zA-Zx7f-xff]|::)(?:[a-zA-Z0-9_x7f-xff]|::)*(\})</string>
 					<key>name</key>
 					<string>variable.other.readwrite.global.perl</string>
 				</dict>

Kind regards,

@oalders
Copy link

oalders commented Jan 27, 2022

@usualoma could you add a graphic which shows the various cases before and after your changes?

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

Successfully merging this pull request may close these issues.

2 participants