NAME
MarpaX::Languages::C::AST::Util::Data::Find - Find data in C AST
VERSION
version 0.48
SYNOPSIS
use strict;
use warnings FATAL => 'all';
use MarpaX::Languages::C::AST::Util::Data::Find;
my $data = bless [], 'C::AST::Something';
MarpaX::Languages::C::AST::Util::Data::Find->new(
wanted => sub { my $o = shift;
my $class = blessed($o) || '';
return ($class eq 'C::AST::directDeclaratorIdentifier');
},
callback => sub { my ($datap, $o) = @_;
#
# This object has matched.
#
},
callbackArgs => [ $data ],
)->process($data);
DESCRIPTION
This modules is a minimalist Data::Find designed for the parse tree values of Marpa on a C source file.
SUBROUTINES/METHODS
new($class, %options)
Instance a new object. Takes as optional argument a hash that may contain the following key/values:
- endOfElement
-
End of element callback (CODE ref).
- endOfElementArgs
-
End-Of-Element callback arguments (ARRAY ref). The endOfElement callback is called like: &$endOfElement(@{$endOfElementArgs}, $object) where $object is a reference to the object that finishes. If wanted callback is set, only wanted objects are concerned.
End of element callback (CODE ref).
- wanted
-
Match callback (CODE ref).
- wantedArgs
-
Match callback arguments (ARRAY ref). The matched callback is called like: &$wanted(@{$wantedArgs}, $object). Any true value means that $object has matched and will be a candidate to the processing callback.
- callback
-
Process callback (CODE ref).
- callbackArgs
-
Process callback arguments (ARRAY ref). The process callback is called like: &$callback(@{$callbackArgs}, $object) on every object that matched.
process($self, $value)
Process search on the object $value. Returns a true value is something wanted was found.
SEE ALSO
L<Data::Find>, L<Marpa::R2>
AUTHOR
Jean-Damien Durand <jeandamiendurand@free.fr>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Jean-Damien Durand.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.