File Coverage

blib/lib/MarpaX/Languages/ECMAScript/AST/Grammar/ECMAScript_262_5/Program/Semantics.pm
Criterion Covered Total %
statement 12 26 46.1
branch 0 2 0.0
condition n/a
subroutine 4 7 57.1
pod 3 3 100.0
total 19 38 50.0


line stmt bran cond sub pod time code
1 1     1   7 use strict;
  1         2  
  1         43  
2 1     1   6 use warnings FATAL => 'all';
  1         2  
  1         104  
3              
4             package MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Program::Semantics;
5 1     1   791 use MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Lexical::StringLiteral;
  1         4  
  1         127  
6              
7             our $StringLiteral = MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Lexical::StringLiteral->new();
8             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             our $VERSION = '0.018'; # VERSION
13              
14 1     1   8 use constant AST => 'MarpaX::Languages::ECMAScript::AST';
  1         2  
  1         314  
15              
16              
17             sub new {
18 0     0 1   my $class = shift;
19 0           my $self = {};
20 0           bless($self, $class);
21 0           return $self;
22             }
23              
24              
25             sub valuesAndRuleId {
26 0     0 1   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 0         if (! defined($self->{ruleId2Lhs}->[$ruleId])) {
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             sub StringLiteral {
46 0     0 1   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             1;
60              
61             __END__