forked from vim-perl/vim-perl
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathperl-regression.pl
102 lines (75 loc) · 1.4 KB
/
perl-regression.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/usr/local/bin/perl
# From http://www.van-laarhoven.org/vim/syntax/perl.vim.regression.pl
# Regression tests for the perl.vim file
# Please run this one first before committing any patches.
# //
$a /= 2;
if (/hello/) {
$b = 2;
}
$a =~ / hello/;
$a /= /hello/x;
$a = 1/$hello / 2/4;
$a = new HelloWorld::Thing;
package HelloWorld;
sub new {
my ($class) = @_;
return bless {}, $class;
}
1;
# Test for here document. EOF should be coloured as string or as statement
# depending on whether perl_string_as_statement is set.
# XXX 'if $true' is highlighted incorrectly
$true = 1;
print <<EOF if $true;
Here document
EOF
print <<"EOF" if $true;
Here document
EOF
print <<'EOF' if $true;
Here document
EOF
# Here documents finishing with an empty line. Note the Error colour because of
# the line with only a space in it.
print <<"" if $true;
Here document
print <<'' if $true;
Here document
# Here document with a different. Only works in 6.0.
print <<RandomID;
here document
RandomID
# Don't fold
#
sub x;
sub x { print "x"; }
sub y($);
sub y($) { print "y"; }
# Fold
#
sub y ($) {
print "y";
}
sub y($)
{
print "y";
}
sub x {
print "x";
}
sub x
{
print "x";
}
BEGIN {
sub x {
print "x";
}
}
# Fold the DATA segment
# XXX We should add some POD to show that that is highlighted correctly as well
# in there.
#
__DATA__
hello world