Parse-Eyapp

 view release on metacpan or  search on metacpan

lib/Parse/Eyapp/Base.pm  view on Meta::CPAN

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
    lastval
    part
  );
  our %EXPORT_TAGS = ( 'all' => [ @EXPORT_OK ] );
 
}
 
our $FILENAME=__FILE__;
 
sub firstval(&@) {
  my $handler = shift;
   
  return (grep { $handler->($_) } @_)[0]
}
 
sub lastval(&@) {
  my $handler = shift;
   
  return (grep { $handler->($_) } @_)[-1]
}
 
# Receives a handler $h and a list @_
# Elements of @_ with the same value of $h go to the same sublist
# Returns a list of lists
sub part(&@) {
  my $h = shift;
 
  my @p;
  push @{$p[$h->($_)]}, $_ for (@_);
  return @p;
}
 
####################################################################
# Usage      : $input = slurp_file($filename, 'trg');
# Purpose    : opens  "$filename.trg" and sets the scalar

lib/Parse/Eyapp/Node.pm  view on Meta::CPAN

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
use strict;
use Carp;
no warnings 'recursion';
 
use List::Util qw(first);
 
our $FILENAME=__FILE__;
 
sub firstval(&@) {
  my $handler = shift;
   
  return (grep { $handler->($_) } @_)[0]
}
 
sub lastval(&@) {
  my $handler = shift;
   
  return (grep { $handler->($_) } @_)[-1]
}
 
####################################################################
# Usage      :
# line: %name PROG
#        exp <%name EXP + ';'>
#                 { @{$lhs->{t}} = map { $_->{t}} ($lhs->child(0)->children()); }

lib/Parse/Eyapp/YATW.pm  view on Meta::CPAN

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
# (c) Parse::Eyapp Copyright 2006-2008 Casiano Rodriguez-Leon, all rights reserved.
use strict;
use Carp;
use List::Util qw(first);
 
sub firstval(&@) {
  my $handler = shift;
   
  return (grep { $handler->($_) } @_)[0]
}
 
sub lastval(&@) {
  my $handler = shift;
   
  return (grep { $handler->($_) } @_)[-1]
}
 
sub valid_keys {
  my %valid_args = @_;
 
  my @valid_args = keys(%valid_args);
  local $" = ", ";



( run in 0.243 second using v1.01-cache-2.11-cpan-94b05bcf43c )