AST/Grammar/ECMAScript_262_5/Program/Semantics.pm

filter: Statementstmt 53.3% 16 / 30 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod 100% 3 / 3 totaltotal 54.7% 23 / 42 CC 2 SCAR 9.2
CC
2
Cov
50%
valuesAndRuleId
6.0
new
2.0
StringLiteral
2.0
CRAP 2.5
« AST/Grammar/ECMAScript_262_5/StringNumericLiteral.pm ↑ Summary AST/Grammar/CharacterClasses.pm »
1 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 6 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Program::Semantics;
5 6 ▶use MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Lexical::StringLiteral;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 6 our $StringLiteral = MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Lexical::StringLiteral->new();
8 6 our $StringLiteralImpl = MarpaX::Languages::ECMAScript::AST::Impl->new($StringLiteral->grammar_option(), $StringLiteral->recce_option());
9  
10 # ABSTRACT: ECMAScript 262, Edition 5, lexical expressions grammar actions
11  
12 6 our $VERSION = '0.020'; # VERSION
13  
14 6 ▶use constant AST => 'MarpaX::Languages::ECMAScript::AST';
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16  
17 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
18 0 my $class = shift;
19 0 my $self = {};
20 0 bless($self, $class);
21 0 return $self;
22 }
23  
24  
25 0 ▶sub valuesAndRuleId {
Subroutine valuesAndRuleId: not called CC=2 SCAR=17.9
Pod documented
26 0 my $self = shift;
27  
28 #
29 # Note: we do not include Marpa explicitely: this is done in one unique
30 # place, i.e. Impl.pm.
31 #
32 0 my $ruleId = $Marpa::R2::Context::rule;
33 #
34 # Note: $Marpa::R2::Context::grammar->rule($ruleId) returns an array
35 #
36 0 ▶ if (! defined($self->{ruleId2Lhs}->[$ruleId])) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"ruleId2Lhs"}[$ruleId]) 0 0 0
37 0 my ($lhs, @rhs) = $Marpa::R2::Context::grammar->rule($ruleId);
38 0 $self->{ruleId2Lhs}->[$ruleId] = $lhs;
39 0 $self->{ruleId2Rhs}->[$ruleId] = \@rhs;;
40 }
41 0 return {values => [ @_ ], ruleId => $ruleId, lhs => $self->{ruleId2Lhs}->[$ruleId], rhs => $self->{ruleId2Rhs}->[$ruleId]};
42 }
43  
44  
45 0 ▶sub StringLiteral {
Subroutine StringLiteral: not called CC=1 SCAR=6.9
Pod documented
46 0 my ($self, $lexemeActionValuep) = @_;
47  
48 #
49 # StringLiteral is already in the good lexeme value format: [start,length,value]
50 #
51 # We just re-evaluate the value. Per def there is no need to eval, the lexeme
52 # got matched.
53 #
54 0 $lexemeActionValuep->[2] = $StringLiteral->parse($lexemeActionValuep->[2], $StringLiteralImpl)->value($StringLiteralImpl);
55  
56 0 return $lexemeActionValuep;
57 }
58  
59 6 1;
60  
61 __END__
« AST/Grammar/ECMAScript_262_5/StringNumericLiteral.pm ↑ Summary AST/Grammar/CharacterClasses.pm »