The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Pugs::Runtime::LrepMatch - Match object for bootstrapping

SYNOPSIS

    use Pugs::Compiler::LrepRule;

    my $rule = Pugs::Compiler::LrepRule->compile( '((.).).' );
    my $match = $rule->match( 'abc' );

    if ($match) {               # true
        print $match;           # "abc"
        print $match->from;     # 0
        print $match->to;       # 3
        print $match->[0];      # "ab"
        print $match->[0][0];   # "a"
    }

OVERLOAD INTERFACE

bool

When used as a boolean, the match object returns whether the match has succeeded or not.

@{}

When used as an array reference, the match object returns positional captures as match objects.

%{}

When used as a hash reference, the match object returns named captures as match objects, keyed by their names.

&{}

When used as a code reference, the match object returns the result object; this is normally the entire match string, but may be arbitrary objects returned from the rule using a return clause.

""

When used as a string, the match object returns the stringified version of the result object (usually the entire match string).

0+

When used as a number, the match object returns the numified version of the result object (usually the entire match string).

METHODS

from ()

Returns the initial position of the match.

to ()

Returns the final position of the match.

AUTHORS

The Pugs Team <perl6-compiler@perl.org>.

COPYRIGHT

Copyright 2006 by Flavio Soibelmann Glock and others.

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

See http://www.perl.com/perl/misc/Artistic.html