File Coverage

blib/lib/re/engine/GNU.pm
Criterion Covered Total %
statement 26 27 96.3
branch 4 8 50.0
condition 1 3 33.3
subroutine 8 8 100.0
pod n/a
total 39 46 84.7


line stmt bran cond sub pod time code
1             package re::engine::GNU;
2 1     1   78070 use strict;
  1         11  
  1         33  
3 1     1   5 use warnings FATAL => 'all';
  1         2  
  1         31  
4 1     1   24 use 5.010000;
  1         3  
5 1     1   6 use XSLoader ();
  1         13  
  1         77  
6              
7             # ABSTRACT: GNU Regular Expression Engine
8              
9             our $AUTHORITY = 'cpan:JDDPAUSE'; # AUTHORITY
10              
11             # All engines should subclass the core Regexp package
12             our @ISA = 'Regexp';
13              
14             BEGIN {
15 1     1   3 our $VERSION = '0.025'; # VERSION
16 1         681 XSLoader::load __PACKAGE__, $VERSION;
17             }
18              
19             {
20 1     1   10 no strict 'subs'; ## no critic
  1         33  
  1         734  
21             our $RE_SYNTAX_AWK = RE_SYNTAX_AWK;
22             our $RE_SYNTAX_ED = RE_SYNTAX_ED;
23             our $RE_SYNTAX_EGREP = RE_SYNTAX_EGREP;
24             our $RE_SYNTAX_EMACS = RE_SYNTAX_EMACS;
25             our $RE_SYNTAX_GNU_AWK = RE_SYNTAX_GNU_AWK;
26             our $RE_SYNTAX_GREP = RE_SYNTAX_GREP;
27             our $RE_SYNTAX_POSIX_AWK = RE_SYNTAX_POSIX_AWK;
28             our $RE_SYNTAX_POSIX_BASIC = RE_SYNTAX_POSIX_BASIC;
29             our $RE_SYNTAX_POSIX_EGREP = RE_SYNTAX_POSIX_EGREP;
30             our $RE_SYNTAX_POSIX_EXTENDED = RE_SYNTAX_POSIX_EXTENDED;
31             our $RE_SYNTAX_POSIX_MINIMAL_BASIC = RE_SYNTAX_POSIX_MINIMAL_BASIC;
32             our $RE_SYNTAX_POSIX_MINIMAL_EXTENDED = RE_SYNTAX_POSIX_MINIMAL_EXTENDED;
33             our $RE_SYNTAX_SED = RE_SYNTAX_SED;
34             #
35             # __USE_GNU specifics
36             #
37             our $RE_BACKSLASH_ESCAPE_IN_LISTS = RE_BACKSLASH_ESCAPE_IN_LISTS;
38             our $RE_BK_PLUS_QM = RE_BK_PLUS_QM;
39             our $RE_CHAR_CLASSES = RE_CHAR_CLASSES;
40             our $RE_CONTEXT_INDEP_ANCHORS = RE_CONTEXT_INDEP_ANCHORS;
41             our $RE_CONTEXT_INDEP_OPS = RE_CONTEXT_INDEP_OPS;
42             our $RE_CONTEXT_INVALID_OPS = RE_CONTEXT_INVALID_OPS;
43             our $RE_DOT_NEWLINE = RE_DOT_NEWLINE;
44             our $RE_DOT_NOT_NULL = RE_DOT_NOT_NULL;
45             our $RE_HAT_LISTS_NOT_NEWLINE = RE_HAT_LISTS_NOT_NEWLINE;
46             our $RE_INTERVALS = RE_INTERVALS;
47             our $RE_LIMITED_OPS = RE_LIMITED_OPS;
48             our $RE_NEWLINE_ALT = RE_NEWLINE_ALT;
49             our $RE_NO_BK_BRACES = RE_NO_BK_BRACES;
50             our $RE_NO_BK_PARENS = RE_NO_BK_PARENS;
51             our $RE_NO_BK_REFS = RE_NO_BK_REFS;
52             our $RE_NO_BK_VBAR = RE_NO_BK_VBAR;
53             our $RE_NO_EMPTY_RANGES = RE_NO_EMPTY_RANGES;
54             our $RE_UNMATCHED_RIGHT_PAREN_ORD = RE_UNMATCHED_RIGHT_PAREN_ORD;
55             our $RE_NO_POSIX_BACKTRACKING = RE_NO_POSIX_BACKTRACKING;
56             our $RE_NO_GNU_OPS = RE_NO_GNU_OPS;
57             our $RE_DEBUG = RE_DEBUG;
58             our $RE_INVALID_INTERVAL_ORD = RE_INVALID_INTERVAL_ORD;
59             our $RE_ICASE = RE_ICASE;
60             our $RE_CARET_ANCHORS_HERE = RE_CARET_ANCHORS_HERE;
61             our $RE_CONTEXT_INVALID_DUP = RE_CONTEXT_INVALID_DUP;
62             our $RE_NO_SUB = RE_NO_SUB;
63             }
64              
65             sub import {
66 6     6   811 my $class = shift;
67              
68 6         31 $^H{regcomp} = ENGINE;
69              
70 6 50       20 if (@_) {
71 6         15 my %args = @_;
72 6 50       14 if ( exists $args{'-debug'} ) {
73 6         38 $^H{ __PACKAGE__ . '/debug' } = $args{'-debug'};
74             }
75 6 50       1116 if ( exists $args{'-syntax'} ) {
76 0         0 $^H{ __PACKAGE__ . '/syntax' } = $args{'-syntax'};
77             }
78             }
79              
80             }
81              
82             sub unimport {
83 6     6   48 my $class = shift;
84              
85 6 50 33     53 if ( exists( $^H{regcomp} ) && $^H{regcomp} == ENGINE ) {
86 6         1836 delete( $^H{regcomp} );
87             }
88              
89             }
90              
91             1;
92              
93             __END__