File Coverage

blib/lib/PPIx/QuoteLike/Constant.pm
Criterion Covered Total %
statement 53 54 98.1
branch n/a
condition n/a
subroutine 17 17 100.0
pod n/a
total 70 71 98.5


line stmt bran cond sub pod time code
1             package PPIx::QuoteLike::Constant;
2              
3 8     8   164977 use 5.006;
  8         38  
4              
5 8     8   36 use strict;
  8         17  
  8         133  
6 8     8   31 use warnings;
  8         21  
  8         181  
7              
8 8     8   34 use Carp;
  8         11  
  8         403  
9 8     8   44 use base qw{ Exporter };
  8         14  
  8         1117  
10              
11             our $VERSION = '0.023';
12              
13 8     8   49 no warnings qw{ once }; # For older Perls.
  8         11  
  8         559  
14              
15             our @CARP_NOT = qw{
16             PPIx::QuoteLike
17             PPIx::QuoteLike::Constant
18             PPIx::QuoteLike::Dumper
19             PPIx::QuoteLike::Token
20             PPIx::QuoteLike::Token::Control
21             PPIx::QuoteLike::Token::Delimiter
22             PPIx::QuoteLike::Token::Interpolation
23             PPIx::QuoteLike::Token::String
24             PPIx::QuoteLike::Token::Structure
25             PPIx::QuoteLike::Token::Unknown
26             PPIx::QuoteLike::Token::Whitespace
27             PPIx::QuoteLike::Utils
28             };
29              
30 8     8   45 use warnings qw{ once };
  8         19  
  8         587  
31              
32             our @EXPORT_OK = qw{
33             ARRAY_REF
34             MINIMUM_PERL
35             HAVE_PPIX_REGEXP
36             LOCATION_LINE
37             LOCATION_CHARACTER
38             LOCATION_COLUMN
39             LOCATION_LOGICAL_LINE
40             LOCATION_LOGICAL_FILE
41             SUFFICIENT_UTF8_SUPPORT_FOR_WEIRD_DELIMITERS
42             VARIABLE_RE
43             @CARP_NOT
44             };
45              
46 8     8   44 use constant ARRAY_REF => ref [];
  8         13  
  8         847  
47              
48             # We can't depend on PPIx::Regexp without getting into a circular
49             # dependency. I think. But we can sure use it if we can come by it.
50 8         28 use constant HAVE_PPIX_REGEXP => do {
51 8         15 local $@ = undef;
52 8         13 eval { ## no critic (RequireCheckingReturnValueOfEval)
53 8         1551 require PPIx::Regexp;
54 0         0 1;
55             };
56 8     8   45 };
  8         24  
57              
58             # The '## VERBATIM' annotations support test xt/author/verbatim.t
59             ## VERBATIM EXPECT 1
60             ## VERBATIM BEGIN PPI::Document
61 8     8   37 use constant LOCATION_LINE => 0;
  8         13  
  8         381  
62 8     8   43 use constant LOCATION_CHARACTER => 1;
  8         17  
  8         323  
63 8     8   44 use constant LOCATION_COLUMN => 2;
  8         21  
  8         383  
64 8     8   41 use constant LOCATION_LOGICAL_LINE => 3;
  8         18  
  8         331  
65 8     8   40 use constant LOCATION_LOGICAL_FILE => 4;
  8         20  
  8         365  
66             ## VERBATIM END
67              
68 8     8   41 use constant MINIMUM_PERL => '5.000';
  8         76  
  8         490  
69              
70 8     8   44 use constant SUFFICIENT_UTF8_SUPPORT_FOR_WEIRD_DELIMITERS => $] ge '5.008003';
  8         23  
  8         1861  
71              
72             # Match the name of a variable. The user of this needs to anchor it
73             # right after the sigil. The line noise is [[:punct:]] as documented in
74             # perlrecharclass, less anything that needs to be excluded (currently
75             # only '@' and '*').
76 8         473 use constant VARIABLE_RE => qr/
77             [[:alpha:]_]\w* (?: :: [[:alpha:]_] \w* )* |
78             \^ [A-Z_] |
79             [0-9]+ |
80             [-!"#\$%&'()+,.\/:;<=>?[\\\]^_`{|}~]
81 8     8   49 /smx;
  8         14  
82              
83             1;
84              
85             __END__