CAB/Token.pm

filter: Statementstmt 91.6% 11 / 12 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 51.7% 15 / 29 CC 4 SCAR 24.7
CC
4
Cov
55%
new
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 11.9
« CAB/Analyzer/Dict/BDB.pm ↑ Summary CAB/Format/Raw/HTTP.pm »
1 ## -*- Mode: CPerl -*-
2 ##
3 ## File: DTA::CAB::Token.pm
4 ## Author: Bryan Jurish <moocow@cpan.org>
5 ## Description: generic API for tokens passed to/from DTA::CAB::Analyzer
6  
7 package DTA::CAB::Token;
8 1 ▶use DTA::CAB::Datum;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 ##==============================================================================
13 ## Globals
14 ##==============================================================================
15  
16 1 our @ISA = qw(DTA::CAB::Datum);
17  
18 ##==============================================================================
19 ## Constructors etc.
20 ##==============================================================================
21  
22 ## $tok = CLASS_OR_OBJ->new($text)
23 ## $tok = CLASS_OR_OBJ->new($text,%args)
24 ## $tok = CLASS_OR_OBJ->new(%args)
25 ## + object structure: HASH
26 ## {
27 ## ##-- Required Attributes
28 ## text => $raw_text, ##-- raw token text
29 ## ##
30 ## ##-- Optional Attributes
31 ## _attrs => \%attrs, ##-- scalar attributes ($key=>$val, e.g. for xml pass-through)
32 ## _dtrs => \@dtrs, ##-- structural daughters (DTA::CAB::Datum objects, e.g. for xml pass-through)
33 ## $key => $value, ##-- perl-level structure (e.g. analyzer output)
34 ## ##
35 ## ##-- DTA::CAB Attributes (post-analysis)
36 ## #loc => {off=>$offset, len=>$len}, ##-- parsed & passed through by some formats
37 ## #xlit => $a_xlit, ##-- analysis output by DTA::CAB::Analyzer::Transliterator
38 ## #morph => $a_morph, ##-- analysis output by DTA::CAB::Analyzer::Morph subclass for literal morphology lookup
39 ## #safe => $a_safe, ##-- analysis output by DTA::CAB::Analyzer::MorphSafe (?)
40 ## #rw => $a_rw, ##-- analysis output by DTA::CAB::Analyzer::Rewrite subclass for rewrite lookup
41 ## }
42 0 ▶sub new {
Subroutine new: not called CC=4 SCAR=30.0
Pod documented
43 0 ▶ return bless({
Branch: 1 branch
BranchTrueFalseTotal
@_ < 2 || @_ % 2 != 0 ? : 0 0 0
Condition0%0/6
@_ < 2 or @_ % 2 != 0
l!l&&r!l&&!r
000
ref $_[0] || $_[0]
l!l&&r!l&&!r
000
MC/DC0%0/2
@_ < 2 or @_ % 2 != 0
@_ < 2 @_ % 2 != 0
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
Truth table0%0/3
A or B
A= @_ < 2B= @_ % 2 != 0
ABresult
1X1
011
000
Truth table0%0/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
44 ((@_ < 2 || @_ % 2 != 0)
45 ? @_[1..$#_]
46 : (text=>$_[1],@_[2..$#_]))
47 },
48 ref($_[0]) || $_[0]);
49 }
50  
51 ##==============================================================================
52 ## Methods: Formatting : OBSOLETE!
53 ##==============================================================================
54  
55  
56 1 1; ##-- be happy
57  
58 __END__
« CAB/Analyzer/Dict/BDB.pm ↑ Summary CAB/Format/Raw/HTTP.pm »