This file is indexed.

/usr/share/perl5/Pegex/Receiver.pod is in libpegex-perl 0.55-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
=pod

=for comment
DO NOT EDIT. This Pod was generated by Swim.
See http://github.com/ingydotnet/swim-pm#readme

=encoding utf8

=head1 NAME

Pegex::Receiver - Base Class for All Pegex Receivers

=head1 SYNOPSIS

    package MyReceiver;
    use base 'Pegex::Receiver';

    # Handle data for a specific rule
    sub got_somerulename {
        my ($self, $got) = @_;
        # ... process ...
        return $result;
    }

    # Handle data for any other rule
    sub gotrule {
        my ($self, $got) = @_;
        return $result;
    }

    # Pre-process
    sub initial { ... }

    # Post-process
    sub final {
        ...;
        return $final_result;
    }

=head1 DESCRIPTION

In Pegex, a B<receiver> is the class object that a B<parser> passes captured
data to when a B<rule> in a B<grammar> matches a part of an B<input> stream. A
receiver provides B<action methods> to turn parsed data into what the parser
is intended to do.

This is the base class of all Pegex receiver classes.

It doesn't do much of anything, which is the correct thing to do. If you use
this class as your receiver if won't do any extra work. See L<Pegex::Tree> for
a receiver base class that will help organize your matches by default.

=head2 How A Receiver Works

A Pegex grammar is made up of B<named-rules>, B<regexes>, and B<groups>. When
a B<regex> matches, the parser makes array of its capture strings. When a
B<group> matches, the parser makes an array of all the submatch arrays. In
this way a B<parse tree> forms.

When a B<named-rule> matches, an action method is called in the receiver
class. The method is passed the current B<parse tree> and returns what parser
will consider the new parse tree.

This makes for a very elegant and understandable API.

=head1 API

This section documents the methods that you can include in receiver subclass.

=over

=item C<got_$rulename($got)>

An action method for a specific, named rule.

    sub got_rule42 {
        my ($self, $got) = @_;
        ...
        return $result;
    }

The C<$got> value that is passed in is the current value of the parse tree.
What gets returned is whatever you want to new value to be.

=item C<gotrule($got)>

The action method for a named rule that does not have a specific action
method.

=item C<initial()>

Called at the beginning of a parse operation, before the parsing begins.

=item C<final($got)>

Called at the end of a parse operation. Whatever this action returns, will be
the result of the parse.

=back

=head2 Methods

=over

=item C<parser>

An attribute containing the parser object that is currently running. This can
be very useful to introspect what is happening, and possibly modify the
grammar on the fly. (Experts only!)

=item C<flatten($array)>

A utility method that can turn an array of arrays into a single array.
For example:

    $self->flatten([1, [2, [3, 4], 5], 6]);
    # produces [1, 2, 3, 4, 5, 6]

Hashes are left unchanged. The array is modified in place, but is also the
return value.

=back

=head1 AUTHOR

Ingy döt Net <ingy@cpan.org>

=head1 COPYRIGHT AND LICENSE

copyright 2010-2014. Ingy döt Net.

This program is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.

See L<http://www.perl.com/perl/misc/Artistic.html>

=cut