I've been trying to figure out how to do a recursive regular expression in Perl 6. For a toy example, a balanced parentheses matcher, which would match ((())())
inside (((((())())
.
I thought this would do it:
my regex paren {
'(' ~ ')' <paren>*
}
or the simpler
my regex paren {
'(' <paren>* ')'
}
but that fails with
No such method 'paren' for invocant of type 'Match'
in regex paren at ...