Skip to content

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?

@usualoma usualoma force-pushed the syntax-dereferencing branch from 0aa9865 to 8cdcd3d Compare January 28, 2022 01:03
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