line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Tokenizer; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
72343
|
use strict; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
120
|
|
4
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
97
|
|
5
|
3
|
|
|
3
|
|
18
|
use Carp; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
383
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
3
|
|
|
3
|
|
3097
|
use AutoLoader; |
|
3
|
|
|
|
|
5459
|
|
|
3
|
|
|
|
|
16
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
13
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
14
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# This allows declaration use Tokenizer ':all'; |
17
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
18
|
|
|
|
|
|
|
# will save memory. |
19
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
20
|
|
|
|
|
|
|
TOK_UNDEF TOK_TEXT TOK_DQUOTE TOK_SQUOTE TOK_IQUOTE |
21
|
|
|
|
|
|
|
TOK_SIQUOTE TOK_BLANK TOK_ERROR TOK_EOL TOK_COMMENT TOK_EOF |
22
|
|
|
|
|
|
|
TOK_BASH_COMMENT TOK_C_COMMENT TOK_CC_COMMENT |
23
|
|
|
|
|
|
|
NOERR UNCLOSED_DQUOTE UNCLOSED_SQUOTE UNCLOSED_IQUOTE NOCONTEXT |
24
|
|
|
|
|
|
|
UNCLOSED_C_COMMENT |
25
|
|
|
|
|
|
|
TOK_OPT_DEFAULT TOK_OPT_NONE TOK_OPT_NOUNESCAPE |
26
|
|
|
|
|
|
|
TOK_OPT_SIQUOTE TOK_OPT_UNESCAPE TOK_OPT_UNESCAPE_CHARS |
27
|
|
|
|
|
|
|
TOK_OPT_UNESCAPE_LINES TOK_OPT_PASSCOMMENT TOK_OPT_PASS_COMMENT |
28
|
|
|
|
|
|
|
TOK_OPT_UNESCAPE_NQ_LINES TOK_OPT_C_COMMENT TOK_OPT_CC_COMMENT |
29
|
|
|
|
|
|
|
TOK_OPT_NO_BASH_COMMENT TOK_OPT_NO_IQUOTE |
30
|
|
|
|
|
|
|
tokenizer_options |
31
|
|
|
|
|
|
|
tokenizer_new |
32
|
|
|
|
|
|
|
tokenizer_new_strbuf |
33
|
|
|
|
|
|
|
tokenizer_scan |
34
|
|
|
|
|
|
|
tokenizer_exists |
35
|
|
|
|
|
|
|
tokenizer_switch |
36
|
|
|
|
|
|
|
tokenizer_delete |
37
|
|
|
|
|
|
|
tokenizer_flush |
38
|
|
|
|
|
|
|
tokenizer_destroy |
39
|
|
|
|
|
|
|
) ] ); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
our @EXPORT = qw( |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
TOK_UNDEF TOK_TEXT TOK_DQUOTE TOK_SQUOTE TOK_IQUOTE |
46
|
|
|
|
|
|
|
TOK_SIQUOTE TOK_BLANK TOK_ERROR TOK_EOL TOK_COMMENT TOK_EOF |
47
|
|
|
|
|
|
|
TOK_BASH_COMMENT TOK_C_COMMENT TOK_CC_COMMENT |
48
|
|
|
|
|
|
|
NOERR UNCLOSED_DQUOTE UNCLOSED_SQUOTE UNCLOSED_IQUOTE NOCONTEXT |
49
|
|
|
|
|
|
|
UNCLOSED_C_COMMENT |
50
|
|
|
|
|
|
|
TOK_OPT_DEFAULT TOK_OPT_NONE TOK_OPT_NOUNESCAPE |
51
|
|
|
|
|
|
|
TOK_OPT_SIQUOTE TOK_OPT_UNESCAPE TOK_OPT_UNESCAPE_CHARS |
52
|
|
|
|
|
|
|
TOK_OPT_UNESCAPE_LINES TOK_OPT_PASSCOMMENT TOK_OPT_PASS_COMMENT |
53
|
|
|
|
|
|
|
TOK_OPT_UNESCAPE_NQ_LINES TOK_OPT_C_COMMENT TOK_OPT_CC_COMMENT |
54
|
|
|
|
|
|
|
TOK_OPT_NO_BASH_COMMENT TOK_OPT_NO_IQUOTE |
55
|
|
|
|
|
|
|
tokenizer_options |
56
|
|
|
|
|
|
|
tokenizer_new |
57
|
|
|
|
|
|
|
tokenizer_new_strbuf |
58
|
|
|
|
|
|
|
tokenizer_scan |
59
|
|
|
|
|
|
|
tokenizer_exists |
60
|
|
|
|
|
|
|
tokenizer_switch |
61
|
|
|
|
|
|
|
tokenizer_delete |
62
|
|
|
|
|
|
|
tokenizer_flush |
63
|
|
|
|
|
|
|
tokenizer_destroy |
64
|
|
|
|
|
|
|
); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
our $VERSION = '0.4.6'; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub AUTOLOAD { |
69
|
|
|
|
|
|
|
# This AUTOLOAD is used to 'autoload' constants from the constant() |
70
|
|
|
|
|
|
|
# XS function. |
71
|
|
|
|
|
|
|
|
72
|
61
|
|
|
61
|
|
5960
|
my $constname; |
73
|
61
|
|
|
|
|
68
|
our $AUTOLOAD; |
74
|
61
|
|
|
|
|
257
|
($constname = $AUTOLOAD) =~ s/.*:://; |
75
|
61
|
50
|
|
|
|
149
|
croak "&Tokenizer::constant not defined" if $constname eq 'constant'; |
76
|
61
|
|
|
|
|
176
|
my ($error, $val) = constant($constname); |
77
|
61
|
50
|
|
|
|
114
|
if ($error) { croak $error; } |
|
0
|
|
|
|
|
0
|
|
78
|
|
|
|
|
|
|
{ |
79
|
3
|
|
|
3
|
|
774
|
no strict 'refs'; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
304
|
|
|
61
|
|
|
|
|
64
|
|
80
|
|
|
|
|
|
|
# Fixed between 5.005_53 and 5.005_61 |
81
|
|
|
|
|
|
|
#XXX if ($] >= 5.00561) { |
82
|
|
|
|
|
|
|
#XXX *$AUTOLOAD = sub () { $val }; |
83
|
|
|
|
|
|
|
#XXX } |
84
|
|
|
|
|
|
|
#XXX else { |
85
|
61
|
|
|
3557
|
|
293
|
*$AUTOLOAD = sub { $val }; |
|
3557
|
|
|
|
|
13352
|
|
86
|
|
|
|
|
|
|
#XXX } |
87
|
|
|
|
|
|
|
} |
88
|
61
|
|
|
|
|
186
|
goto &$AUTOLOAD; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
require XSLoader; |
92
|
|
|
|
|
|
|
XSLoader::load('Text::Tokenizer', $VERSION); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
# Preloaded methods go here. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# Autoload methods go after =cut, and are processed by the autosplit program. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
1; |
99
|
|
|
|
|
|
|
__END__ |