Sophie

Sophie

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

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

use v5.10;
use warnings;
use strict;

use Regexp::Grammars;

my $list_nonempty = qr{
    <List>

    <rule: List>
        \(  <[Value]>+ % (,)  \)

    <token: Value>
        \d+
}xms;

my $list_empty = qr{
    <List>

    <rule: List>
        \(  <[Value]>* % <_Sep=(,)>  \)

    <token: Value>
        \d+
}xms;

use Smart::Comments;


while (my $input = <>) {
    my $input2 = $input;
    if ($input =~ $list_nonempty) {
        ### nonempty: $/{List}
    }
    if ($input2 =~ $list_empty) {
        ### empty: $/{List}
    }
}