line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
40
|
|
2
|
1
|
|
|
1
|
|
4
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
52
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::StringNumericLiteral; |
5
|
1
|
|
|
1
|
|
5
|
use parent qw/MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Base/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
6
|
1
|
|
|
1
|
|
686
|
use MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::StringNumericLiteral::NativeNumberSemantics; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
37
|
|
7
|
1
|
|
|
1
|
|
8
|
use MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::CharacterClasses; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
8
|
1
|
|
|
1
|
|
4
|
use SUPER; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
940
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: ECMAScript-262, Edition 5, string numeric literal grammar written in Marpa BNF |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.018'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
# Note that this grammar is NOT supposed to be injected in Program |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
our $grammar_content = do {local $/; }; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
0
|
|
|
0
|
1
|
|
my ($class, $optionsp) = @_; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
0
|
|
|
|
$optionsp //= {}; |
25
|
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
|
my $semantics_package = exists($optionsp->{semantics_package}) ? $optionsp->{semantics_package} : join('::', $class, 'NativeNumberSemantics'); |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
my $self = $class->SUPER(); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# |
31
|
|
|
|
|
|
|
# Add semantics package to self |
32
|
|
|
|
|
|
|
# |
33
|
0
|
|
|
|
|
|
$self->{_semantics_package} = $semantics_package; |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
return $self; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub make_grammar_content { |
40
|
0
|
|
|
0
|
1
|
|
my ($class) = @_; |
41
|
0
|
|
|
|
|
|
return $grammar_content; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub recce_option { |
46
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
47
|
|
|
|
|
|
|
# |
48
|
|
|
|
|
|
|
# Get default hash |
49
|
|
|
|
|
|
|
# |
50
|
0
|
|
|
|
|
|
my $default = $self->SUPER(); |
51
|
|
|
|
|
|
|
# |
52
|
|
|
|
|
|
|
# And overwrite the semantics_package |
53
|
|
|
|
|
|
|
# |
54
|
0
|
|
|
|
|
|
$default->{semantics_package} = $self->{_semantics_package}; |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
return $default; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# |
60
|
|
|
|
|
|
|
# INTERNAL ACTIONS |
61
|
|
|
|
|
|
|
# |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub _secondArg { |
64
|
0
|
|
|
0
|
|
|
return $_[2]; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub _value { |
68
|
0
|
|
|
0
|
|
|
return _secondArg(@_)->host_value; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub _value_zero { |
72
|
0
|
|
|
0
|
|
|
return $_[0]->pos_zero->host_value; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub _Infinity { |
76
|
0
|
|
|
0
|
|
|
return $_[0]->pos_inf; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
# |
80
|
|
|
|
|
|
|
# Note that HexIntegerLiteral output is a HexDigit modified |
81
|
|
|
|
|
|
|
# |
82
|
|
|
|
|
|
|
sub _HexIntegerLiteral_HexDigit { |
83
|
0
|
|
|
0
|
|
|
my $sixteen = $_[0]->clone_init->int("16"); |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
|
|
|
return $_[1]->mul($sixteen)->add($_[2]); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# |
89
|
|
|
|
|
|
|
# Note that DecimalDigits output is a DecimalDigit modified |
90
|
|
|
|
|
|
|
# |
91
|
|
|
|
|
|
|
sub _DecimalDigits_DecimalDigit { |
92
|
0
|
|
|
0
|
|
|
my $ten = $_[0]->clone_init->int("10"); |
93
|
0
|
|
|
|
|
|
return $_[1]->mul($ten)->add($_[2])->inc_length; |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub _Dot_DecimalDigits_ExponentPart { |
97
|
0
|
|
|
0
|
|
|
my $n = $_[2]->new_from_length; |
98
|
0
|
|
|
|
|
|
my $tenpowexponentminusn = $_[0]->clone_init->int("10")->pow($_[3]->sub($n)); |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
$_[2]->decimalOn; |
101
|
0
|
|
|
|
|
|
return $_[2]->mul($tenpowexponentminusn); |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub _DecimalDigits_Dot { |
105
|
0
|
|
|
0
|
|
|
$_[1]->decimalOn; |
106
|
0
|
|
|
|
|
|
return $_[1]; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub _DecimalDigits_Dot_DecimalDigits_ExponentPart { |
110
|
|
|
|
|
|
|
# |
111
|
|
|
|
|
|
|
# Done using polish logic -; |
112
|
|
|
|
|
|
|
# |
113
|
0
|
|
|
0
|
|
|
$_[1]->decimalOn; |
114
|
0
|
|
|
|
|
|
return $_[1]->add( |
115
|
|
|
|
|
|
|
_DecimalDigits_ExponentPart( |
116
|
|
|
|
|
|
|
$_[0], |
117
|
|
|
|
|
|
|
_Dot_DecimalDigits($_[0], '.', $_[3]), |
118
|
|
|
|
|
|
|
$_[4]) |
119
|
|
|
|
|
|
|
); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub _DecimalDigits_Dot_ExponentPart { |
123
|
0
|
|
|
0
|
|
|
my $tenpowexponent = $_[0]->clone_init->int("10")->pow($_[3]); |
124
|
0
|
|
|
|
|
|
$_[1]->decimalOn; |
125
|
0
|
|
|
|
|
|
return $_[1]->mul($tenpowexponent); |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub _DecimalDigits_Dot_DecimalDigits { |
129
|
0
|
|
|
0
|
|
|
$_[1]->decimalOn; |
130
|
0
|
|
|
|
|
|
return $_[1]->add(_Dot_DecimalDigits($_[0], '.', $_[3])); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub _Dot_DecimalDigits { |
134
|
0
|
|
|
0
|
|
|
my $n = $_[2]->new_from_length; |
135
|
0
|
|
|
|
|
|
my $tenpowminusn = $_[0]->clone_init->int("10")->pow($n->neg); |
136
|
0
|
|
|
|
|
|
$_[2]->decimalOn; |
137
|
0
|
|
|
|
|
|
return $_[2]->mul($tenpowminusn); |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub _DecimalDigits_ExponentPart { |
141
|
0
|
|
|
0
|
|
|
my $tenpowexponent = $_[0]->clone_init->int("10")->pow($_[2]); |
142
|
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
|
$_[1]->decimalOn; |
144
|
0
|
|
|
|
|
|
return $_[1]->mul($tenpowexponent); |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub _HexDigit { |
148
|
0
|
|
|
0
|
|
|
return $_[0]->clone_init->hex("$_[1]"); |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
sub _DecimalDigit { |
152
|
0
|
|
|
0
|
|
|
return $_[0]->clone_init->int("$_[1]"); |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub _neg { |
156
|
0
|
|
|
0
|
|
|
return $_[2]->neg; |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
1; |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=pod |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=encoding utf-8 |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 NAME |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::StringNumericLiteral - ECMAScript-262, Edition 5, string numeric literal grammar written in Marpa BNF |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 VERSION |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
version 0.018 |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 SYNOPSIS |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
use strict; |
177
|
|
|
|
|
|
|
use warnings FATAL => 'all'; |
178
|
|
|
|
|
|
|
use MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::StringNumericLiteral; |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
my $grammar = MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::StringNumericLiteral->new(); |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
my $grammar_content = $grammar->content(); |
183
|
|
|
|
|
|
|
my $grammar_option = $grammar->grammar_option(); |
184
|
|
|
|
|
|
|
my $recce_option = $grammar->recce_option(); |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head1 DESCRIPTION |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
This modules returns describes the ECMAScript 262, Edition 5 string numeric literal grammar written in Marpa BNF, as of L, section 9.3.1. This module inherits the methods from MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Base package. |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head2 new($optionsp) |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
$optionsp is a reference to hash that may contain the following key/value pair: |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=over |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=item semantics_package |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
As per Marpa::R2, The semantics package is used when resolving action names to fully qualified Perl names. This package must support and behave as documented in the NativeNumberSemantics (c.f. SEE ALSO). |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=back |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=head2 make_grammar_content($class) |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
Returns the grammar. This will be injected in the Program's grammar. |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head2 recce_option($self) |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
Returns option for Marpa::R2::Scanless::R->new(), returned as a reference to a hash. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head1 SEE ALSO |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
L |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
L |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
L |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
L |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
L |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=head1 AUTHOR |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
Jean-Damien Durand |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
This software is copyright (c) 2013 by Jean-Damien Durand. |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
233
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=cut |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
__DATA__ |