1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-22 10:26:20 +00:00
emacs/test/manual/indent/perl.perl
Stefan Monnier 3d847fa9fd * lisp/progmodes/perl-mode.el: Add support for indented here docs
* lisp/progmodes/perl-mode.el (perl-syntax-propertize-function):
Recognize the new <<~ syntax for indented here docs.
(perl-syntax-propertize-special-constructs): Adjust search of the
end of here docs accordingly.

* test/manual/indent/perl.perl: Add test for indented here docs.
2017-07-24 18:10:02 -04:00

78 lines
1.2 KiB
Perl
Executable File

#!/usr/bin/perl
# -*- eval: (bug-reference-mode 1) -*-
sub add_funds($) {
return 0;
}
my $hash = {
foo => 'bar',
format => 'some',
};
sub some_code {
print "will not indent :(";
};
use v5.14;
my $str= <<END;
Hello
END
my $a = $';
my $b=3;
print $str;
if ($c && /====/){xyz;}
print "a" . <<EOF . s/he"llo/th'ere/;
It's a surprise!
EOF
print <<\EOF1 . s/he"llo/th'ere/;
foo
EOF2
bar
EOF1
$config = {
b =>
[
"123",
],
c => "123",
};
print <<"EOF1" . <<\EOF2 . s/he"llo/th'ere/;
foo
EOF2
bar
EOF1
bar
EOF2
print <<~"EOF1" . <<\EOF2 . s/he"llo/th'ere/;
foo
EOF2
bar
EOF1
bar
EOF2
print $'; # This should not start a string!
print "hello" for /./;
$fileType_filesButNot # bug#12373?
= join( '|', map { quotemeta($_).'$' } @{$fileType->{filesButNot}} );
# There can be a comment between an if/when/while and a /<re>/ matcher!
return 'W' if #/^Not Available on Mobile/m; #W=Web only
/This video is not available on mobile devices./m; #bug#20800
# A "y|abc|def|" shouldn't interfere when inside a string!
$toto = " x \" string\"";
$toto = " y \" string\""; # This is not the `y' operator!