AST/Grammar/ECMAScript_262_5/Lexical/StringLiteral/Semantics.pm

filter: Statementstmt 37.8% 14 / 37 Branchbran 0.0% 0 / 18 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 28.5% 4 / 14 Podpod 100% 1 / 1 totaltotal 27.1% 19 / 70 CC 10 SCAR 38.9
CC
10
Cov
25%
_SingleEscapeCharacter
110.0
new
2.0
_secondArg
2.0
CRAP 48.8
« AST/Grammar/Base.pm ↑ Summary AST/Grammar/ECMAScript_262_5/Template.pm »
1 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 8 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Lexical::StringLiteral::Semantics;
5 8 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 8 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
7 8 BS => "\N{U+0008}",
8 HT => "\N{U+0009}",
9 LF => "\N{U+000A}",
10 VT => "\N{U+000B}",
11 FF => "\N{U+000C}",
12 CR => "\N{U+000D}",
13 DQUOTE => "\N{U+0022}",
14 SQUOTE => "\N{U+0027}",
15 BACKSLASH => "\N{U+005C}"
16 8 };
17  
18 # ABSTRACT: ECMAScript 262, Edition 5, lexical string grammar actions
19  
20 8 our $VERSION = '0.020'; # VERSION
21  
22  
23  
24 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
25 0 my $class = shift;
26 0 my $self = {};
27 0 bless($self, $class);
28 0 return $self;
29 }
30  
31 0 ▶sub _secondArg { return $_[2] }
Subroutine _secondArg: not called CC=1 SCAR=6.9
32 0 ▶sub _emptyString { return ''; }
Subroutine _emptyString: not called CC=1 SCAR=6.9
33 0 ▶sub _concat { return join('', @_[1..$#_]); }
Subroutine _concat: not called CC=1 SCAR=6.9
34  
35 0 ▶sub _OctalEscapeSequence01 { return chr( oct($_[1])); }
Subroutine _OctalEscapeSequence01: not called CC=1 SCAR=6.9
36 0 ▶sub _OctalEscapeSequence02 { return chr( 8 * oct($_[1]) + oct($_[2])); }
Subroutine _OctalEscapeSequence02: not called CC=1 SCAR=6.9
37 0 ▶sub _OctalEscapeSequence03 { return chr(64 * oct($_[1]) + 8 * oct($_[2]) + oct($_[3])); }
Subroutine _OctalEscapeSequence03: not called CC=1 SCAR=6.9
38  
39 0 ▶sub _SingleEscapeCharacter {
Subroutine _SingleEscapeCharacter: not called CC=10 SCAR=47.0
40 0 ▶ if ($_[1] eq 'b') { return BS; }
Branch: 9 branches
BranchTrueFalseTotal
if ($_[1] eq 'b') { } 0 0 0
elsif ($_[1] eq 't') { } 0 0 0
elsif ($_[1] eq 'n') { } 0 0 0
elsif ($_[1] eq 'v') { } 0 0 0
elsif ($_[1] eq 'f') { } 0 0 0
elsif ($_[1] eq 'r') { } 0 0 0
elsif ($_[1] eq '"') { } 0 0 0
elsif ($_[1] eq q[']) { } 0 0 0
elsif ($_[1] eq '\\') { } 0 0 0
41 0 elsif ($_[1] eq 't') { return HT; }
42 0 elsif ($_[1] eq 'n') { return LF; }
43 0 elsif ($_[1] eq 'v') { return VT; }
44 0 elsif ($_[1] eq 'f') { return FF; }
45 0 elsif ($_[1] eq 'r') { return CR; }
46 0 elsif ($_[1] eq '"') { return DQUOTE; }
47 0 elsif ($_[1] eq '\'') { return SQUOTE; }
48 0 elsif ($_[1] eq '\\') { return BACKSLASH; }
49 else {
50 0 croak "Invalid single escape character: $_[1]";
51 }
52 }
53  
54 0 ▶sub _HexEscapeSequence { return chr(16 * hex($_[1]) + hex($_[2])); }
Subroutine _HexEscapeSequence: not called CC=1 SCAR=6.9
55 0 ▶sub _UnicodeEscapeSequence { return chr(4096 * hex($_[2]) + 256 * hex($_[3]) + 16 * hex($_[4]) + hex($_[5])); }
Subroutine _UnicodeEscapeSequence: not called CC=1 SCAR=6.9
56  
57 8 1;
58  
59 __END__
« AST/Grammar/Base.pm ↑ Summary AST/Grammar/ECMAScript_262_5/Template.pm »