line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Used to generate a grammar containing spaces only |
3
|
|
|
|
|
|
|
# |
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
63
|
|
5
|
1
|
|
|
1
|
|
8
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
90
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::SpacesAny; |
8
|
1
|
|
|
1
|
|
8
|
use parent qw/MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::Base/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
13
|
|
9
|
1
|
|
|
1
|
|
115
|
use SUPER; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
475
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# ABSTRACT: ECMAScript-262, Edition 5, spaces only grammar written in Marpa BNF |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.019'; # VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
# We reuse Program grammar, only a subset of it -; |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
our $grammar_content = do {local $/; }; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub make_grammar_content { |
23
|
0
|
|
|
0
|
1
|
|
my ($class) = @_; |
24
|
0
|
|
|
|
|
|
return $grammar_content; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub parse { |
29
|
0
|
|
|
0
|
1
|
|
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
|
|
|
|
|
|
|
sub endReached { |
44
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
45
|
0
|
|
|
|
|
|
return $self->{endReached}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub _failureCallback { |
49
|
0
|
|
|
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
|
|
|
|
|
|
|
sub _endCallback { |
59
|
0
|
|
|
0
|
|
|
my ($self, $source, $pos, $max, $impl) = @_; |
60
|
|
|
|
|
|
|
|
61
|
0
|
0
|
0
|
|
|
|
$self->{endReached} //= ($pos > $max) ? 1 : 0; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
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.019 |
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. 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 |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 AUTHOR |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Jean-Damien Durand |
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__ |