Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > 305b1dc429d7c74acab1cbc991003ded > files > 31

perl-Regexp-Grammars-1.49.0-1.mga7.noarch.rpm

#! /usr/bin/perl

use strict;
use warnings;
use 5.010;
use Regexp::Grammars;

my $grammar = qr{

    <delimited_text>

    <token: delimited_text>
        qq? <delim> <text=(.*?)> </delim>
    |   <matchpos> qq? <delim>
        <error: (?{"Unterminated string starting at index $MATCH{matchpos}"})>

    <token: delim>  [[:punct:]]++

}x;

use IO::Prompter;

while (my $input = prompt) {
    if ($input =~ $grammar) {
        use Data::Show;
        show %/;
    }
    else {
        say 'Failed: ';
        say for @!;
    }
}