/usr/share/perl5/Devel/Declare/Parser/Emulate.pm is in libdevel-declare-parser-perl 0.020-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 | package Devel::Declare::Parser::Emulate;
use strict;
use warnings;
use base 'Devel::Declare::Parser';
use Data::Dumper;
use Carp;
__PACKAGE__->add_accessor( 'test_line' );
use Devel::Declare::Interface;
Devel::Declare::Interface::register_parser( 'test' );
sub line { shift->test_line( @_ )}
sub skipspace {
my $self = shift;
return unless $self->peek_remaining =~ m/^(\s+)/;
$self->advance(length($1));
}
#XXX !BEWARE! Will not work for nested quoting, even escaped
# This is a very dumb implementation.
sub _quoted_from_dd {
my $self = shift;
my $start = $self->peek_num_chars(1);
my $end = $self->end_quote( $start );
my $regex = "^\\$start\([^$end]*)\\$end";
$self->peek_remaining =~ m/$regex/;
my $quoted = $1;
croak( "qfdd regex: |$regex| did not get complete quote." )
unless $quoted;
return ( length( $quoted ) + 2, $quoted );
}
sub _peek_is_word {
my $self = shift;
my $start = $self->peek_num_chars(1);
return 0 unless $start =~ m/^[A-Za-z_]$/;
$self->peek_remaining =~ m/^(\w+)/;
return length($1);
}
sub _linestr_offset_from_dd {
my $self = shift;
return length($self->line);
}
sub rewrite {
my $self = shift;
$self->new_parts( $self->parts );
1;
}
sub write_line {
my $self = shift;
$self->SUPER::write_line();
$self->_scope_end("$self") if $self->end_char eq '{';
}
1;
=head1 NAME
Devel::Declare::Parser::Emulate - Parser that emulates Devel-Declare
=head1 TESTING ONLY
For testing purposes only.
=head1 AUTHORS
Chad Granum L<exodist7@gmail.com>
=head1 COPYRIGHT
Copyright (C) 2010 Chad Granum
Devel-Declare-Parser is free software; Standard perl licence.
Devel-Declare-Parser is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
|