File: ws_redefine.t

package info (click to toggle)
libregexp-grammars-perl 1.058-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,328 kB
  • sloc: perl: 53,328; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 589 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use Test::More;

plan tests => 4;


use Regexp::Grammars;

my $grammar_implicit_ws = qr{
    <foo (arg => 42)>
    <rule:  foo>  foo bar  <param=(?{ $ARG{arg} })>
};

my $grammar_explicit_ws = qr{
    <foo (arg => 42)>
    <rule:  foo>  foo bar  <param=(?{ $ARG{arg} })>
    <token: ws>   \s*
};

ok 'foo bar' =~ $grammar_implicit_ws => 'Implicit grammar matched';
is $/{foo}{param}, 42                => 'Implicit grammar remembered param';

ok 'foo bar' =~ $grammar_explicit_ws => 'Explicit grammar matched';
is $/{foo}{param}, 42                => 'Explicit grammar remembered param';