Hi Laurent,
Here I set my example up along the lines of your second suggestion.
grammar Sum {
token TOP { ^ $ }
rule Sum { + % }
rule Expr { | { self.incr } '[' ~ ']' { self.decr } }
token op { <[-+]> }
token num { \d+ }
token flag { }
method incr { self.actions.incr }
Is this what you want?
perl6 -e 'say "12345" ~~ /^<+alnum -alpha>+$/'
「12345」
perl6 -e 'say "123a45" ~~ /^<+alnum -alpha>+$/'
Nil
HTH
- Timo
Set operations seem to be unsupported on predefined character classes (or
subrules). (Or, if they are supported, I don't know what the right syntax
might be.)
Set operations seem to work properly, though, with escaped character
classes. For example:
perl6 -e 'my $x = "9.0v1"; say so $x ~~ /<[\w]
\d and both match Unicode characters as well.
If that's not the intention then it's best to be explicit.
die("Horribly") unless "9.b1" ~~ / <[0-9]+> % '.' /;
Typing from my phone so unable to test the above***
On Thu, Aug 2, 2018, 12:56 AM ToddAndMargo wrote:
> Hi All,
>
> If there are any