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 ...
nonparenas stuff I don't want, and an action class that will collect theparenmatches... but that gets complicated fast... It's just very hard to believe P6 regular expressions dropped support for something Perl basically pioneered.