line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
38
|
|
2
|
1
|
|
|
1
|
|
6
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
47
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Lexical::StringLiteral::Semantics; |
5
|
1
|
|
|
1
|
|
6
|
use Carp qw/croak/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
129
|
|
6
|
|
|
|
|
|
|
use constant { |
7
|
1
|
|
|
|
|
755
|
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
|
1
|
|
|
1
|
|
6
|
}; |
|
1
|
|
|
|
|
3
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# ABSTRACT: ECMAScript 262, Edition 5, lexical string grammar actions |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = '0.018'; # VERSION |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new { |
25
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
26
|
0
|
|
|
|
|
|
my $self = {}; |
27
|
0
|
|
|
|
|
|
bless($self, $class); |
28
|
0
|
|
|
|
|
|
return $self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
0
|
|
|
sub _secondArg { return $_[2] } |
32
|
0
|
|
|
0
|
|
|
sub _emptyString { return ''; } |
33
|
0
|
|
|
0
|
|
|
sub _concat { return join('', @_[1..$#_]); } |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
0
|
|
|
sub _OctalEscapeSequence01 { return chr( oct($_[1])); } |
36
|
0
|
|
|
0
|
|
|
sub _OctalEscapeSequence02 { return chr( 8 * oct($_[1]) + oct($_[2])); } |
37
|
0
|
|
|
0
|
|
|
sub _OctalEscapeSequence03 { return chr(64 * oct($_[1]) + 8 * oct($_[2]) + oct($_[3])); } |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _SingleEscapeCharacter { |
40
|
0
|
0
|
|
0
|
|
|
if ($_[1] eq 'b') { return BS; } |
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
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
|
|
|
0
|
|
|
sub _HexEscapeSequence { return chr(16 * hex($_[1]) + hex($_[2])); } |
55
|
0
|
|
|
0
|
|
|
sub _UnicodeEscapeSequence { return chr(4096 * hex($_[2]) + 256 * hex($_[3]) + 16 * hex($_[4]) + hex($_[5])); } |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |