summaryrefslogtreecommitdiff
path: root/test/lisp/progmodes/cperl-mode-resources/cperl-bug-66145.pl
blob: 70f12346dededfdeac4f080d8f427347dfdcfeaf (plain)
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
# The original code, from the bug report, with variables renamed

sub foo {
  # Here we do something like
  # this: $array_comment [ num_things ]->{key_comment}
}

# --------------------------------------------------
# Comments containing hash and array sigils

# This is an @array, and this is a %hash
# $array_comment[$index] = $hash_comment{key_comment}
# The last element has the index $#array_comment
# my @a_slice = @array_comment[1,2,3];
# my @h_slice = @hash_comment{qw(a b c)};
# my %a_set   = %array_comment[1,2,3];
# my %h_set   = %hash_comment{qw(a b c)};

# --------------------------------------------------
# in POD

=head1 NAME

cperl-bug-66145 - don't fontify arrays and hashes in POD

=head1 SYNOPSIS

   $array_comment[$index] = $hash_comment{key_comment};
   @array_comment = qw(in pod);
   %hash_comment  = key_comment => q(pod);
   @array_comment = @array_comment[1,2,3];
   @array_comment = @hash_comment{qw(a b c)};
   %hash_comment  = %array_comment[1,2,3];
   %hash_comment  = %hash_comment{qw(a b c)};

=cut

# --------------------------------------------------
# in strings

my @strings = (
    q/$array_string[$index] = $hash_string{key_string};/,
    q/my @array_string = qw(in unquoted string);/,
    q/my %hash_string  = (key_string => q(pod);)/,
    q/@array_string    = @array_string[1,2,3];/,
    q/@array_string    = @hash_string{qw(a b c)};/,
    q/%hash_string     = %array_string[1,2,3];/,
    q/%hash_string     = %hash_string{qw(a b c)};/,
);

# --------------------------------------------------
# in a HERE-document (perl-mode has an extra face for that)

my $here = <<DONE;
   $array_here[$index_here] = $hash_here{key_here};
   @array_here = qw(in a hrere-document);
   %hash_here  = key_here => q(pod);
   @array_here = @array_here[1,2,3];
   @array_here = @hash_here{qw(a b c)};
   %hash_here  = %array_here[1,2,3];
   %hash_here  = %hash_here{qw(a b c)};
DONE