| 1 | # | ||||||||||||||||||||
| 2 | # Used to generate a grammar containing spaces only | ||||||||||||||||||||
| 3 | # | ||||||||||||||||||||
| 4 | 5 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 5 | ▶ | use warnings FATAL => 'all'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | package MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::SpacesAny; | ||||||||||||||||||||
| 8 | 5 | ▶ | use parent qw/MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Base/; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 5 | ▶ | use SUPER; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | # ABSTRACT: ECMAScript-262, Edition 5, spaces only grammar written in Marpa BNF | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 5 | our $VERSION = '0.020'; # VERSION | |||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | # | ||||||||||||||||||||
| 16 | # We reuse Program grammar, only a subset of it -; | ||||||||||||||||||||
| 17 | # | ||||||||||||||||||||
| 18 | 5 | our $grammar_content = do {local $/; <DATA>}; | |||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 0 | ▶ | sub make_grammar_content { | ||||||||||||||||||
|
Subroutine
make_grammar_content: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 23 | 0 | my ($class) = @_; | |||||||||||||||||||
| 24 | 0 | return $grammar_content; | |||||||||||||||||||
| 25 | } | ||||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 0 | ▶ | sub parse { | ||||||||||||||||||
|
Subroutine
parse: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 29 | 0 | my ($self, $source, $impl, $start) = @_; | |||||||||||||||||||
| 30 | 0 | $self->{endReached} = undef; | |||||||||||||||||||
| 31 | 0 | return $self->SUPER($source, $impl, | |||||||||||||||||||
| 32 | { | ||||||||||||||||||||
| 33 | failure => \&_failureCallback, | ||||||||||||||||||||
| 34 | failureargs => [ $self ], | ||||||||||||||||||||
| 35 | end => \&_endCallback, | ||||||||||||||||||||
| 36 | endargs => [ $self ], | ||||||||||||||||||||
| 37 | }, | ||||||||||||||||||||
| 38 | $start | ||||||||||||||||||||
| 39 | ); | ||||||||||||||||||||
| 40 | } | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | 0 | ▶ | sub endReached { | ||||||||||||||||||
|
Subroutine
endReached: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 44 | 0 | my ($self) = @_; | |||||||||||||||||||
| 45 | 0 | return $self->{endReached}; | |||||||||||||||||||
| 46 | } | ||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | 0 | ▶ | sub _failureCallback { | ||||||||||||||||||
|
Subroutine
_failureCallback: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 49 | 0 | my ($self, $source, $pos, $max, $impl) = @_; | |||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | 0 | $self->{endReached} = 0; | |||||||||||||||||||
| 52 | # | ||||||||||||||||||||
| 53 | # This is forcing the parsing to end | ||||||||||||||||||||
| 54 | # | ||||||||||||||||||||
| 55 | 0 | return $max+1; | |||||||||||||||||||
| 56 | } | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 0 | ▶ | sub _endCallback { | ||||||||||||||||||
|
Subroutine
_endCallback: not called CC=3 SCAR=24.8
| |||||||||||||||||||||
| 59 | 0 | my ($self, $source, $pos, $max, $impl) = @_; | |||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | 0 | ▶ | $self->{endReached} //= ($pos > $max) ? 1 : 0; | ||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$self->{"endReached"} //= $pos > $max ? 1 : 0
MC/DC0%0/1
$self->{"endReached"} //= $pos > $max ? 1 : 0
$self->{"endReached"}
Truth table0%0/2
A
A= $self->{"endReached"}
| |||||||||||||||||||||
| 62 | } | ||||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | 5 | 1; | |||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | =pod | ||||||||||||||||||||
| 68 | |||||||||||||||||||||
| 69 | =encoding UTF-8 | ||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | =head1 NAME | ||||||||||||||||||||
| 72 | |||||||||||||||||||||
| 73 | MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::SpacesAny - ECMAScript-262, Edition 5, spaces only grammar written in Marpa BNF | ||||||||||||||||||||
| 74 | |||||||||||||||||||||
| 75 | =head1 VERSION | ||||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | version 0.020 | ||||||||||||||||||||
| 78 | |||||||||||||||||||||
| 79 | =head1 SYNOPSIS | ||||||||||||||||||||
| 80 | |||||||||||||||||||||
| 81 | use strict; | ||||||||||||||||||||
| 82 | use warnings FATAL => 'all'; | ||||||||||||||||||||
| 83 | use MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::SpacesAny; | ||||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | my $grammar = MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::SpacesAny->new(); | ||||||||||||||||||||
| 86 | |||||||||||||||||||||
| 87 | my $grammar_content = $grammar->content(); | ||||||||||||||||||||
| 88 | my $grammar_option = $grammar->grammar_option(); | ||||||||||||||||||||
| 89 | my $recce_option = $grammar->recce_option(); | ||||||||||||||||||||
| 90 | |||||||||||||||||||||
| 91 | =head1 DESCRIPTION | ||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | This modules returns describes the ECMAScript 262, Edition 5 spaces only grammar written in Marpa BNF, as of L<http://www.ecma-international.org/publications/standards/Ecma-262.htm>. This module inherits the methods from MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Base package. | ||||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | =head1 SUBROUTINES/METHODS | ||||||||||||||||||||
| 96 | |||||||||||||||||||||
| 97 | =head2 make_grammar_content($class) | ||||||||||||||||||||
| 98 | |||||||||||||||||||||
| 99 | Returns the grammar. | ||||||||||||||||||||
| 100 | |||||||||||||||||||||
| 101 | =head2 parse($self, $source, $impl, $start) | ||||||||||||||||||||
| 102 | |||||||||||||||||||||
| 103 | Parse the source given as $source, from position $start up to the end, using implementation $impl. | ||||||||||||||||||||
| 104 | |||||||||||||||||||||
| 105 | =head2 endReached($self) | ||||||||||||||||||||
| 106 | |||||||||||||||||||||
| 107 | Returns a boolean indicating if the parse() method succeeded up to the end of the source or not. Meaningful only after a call to parse(). | ||||||||||||||||||||
| 108 | |||||||||||||||||||||
| 109 | =head1 SEE ALSO | ||||||||||||||||||||
| 110 | |||||||||||||||||||||
| 111 | L<MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Base> | ||||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | =head1 AUTHOR | ||||||||||||||||||||
| 114 | |||||||||||||||||||||
| 115 | Jean-Damien Durand <jeandamiendurand@free.fr> | ||||||||||||||||||||
| 116 | |||||||||||||||||||||
| 117 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||
| 118 | |||||||||||||||||||||
| 119 | This software is copyright (c) 2013 by Jean-Damien Durand. | ||||||||||||||||||||
| 120 | |||||||||||||||||||||
| 121 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||
| 122 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||
| 123 | |||||||||||||||||||||
| 124 | =cut | ||||||||||||||||||||
| 125 | |||||||||||||||||||||
| 126 | __DATA__ | ||||||||||||||||||||