File: cperl-bug-66145.pl

package info (click to toggle)
emacs 1%3A30.1%2B1-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 187,300 kB
  • sloc: lisp: 1,367,529; ansic: 466,479; objc: 19,117; cpp: 8,817; java: 8,780; sh: 8,119; makefile: 7,288; python: 3,788; perl: 1,788; xml: 1,720; yacc: 1,566; asm: 1,150; php: 1,035; pascal: 1,011; awk: 937; cs: 880; ada: 725; ruby: 658; javascript: 187; erlang: 153; tcl: 16
file content (62 lines) | stat: -rw-r--r-- 1,908 bytes parent folder | download | duplicates (3)
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