Parrot Perl 6 regexes #17

Subrule metacharacters

# capture to $/<ident> and $/<expr>
regex assign { <ident> '=' <expr> }  
# capture to $/<name> and $/<value>
regex assign { $<name>=<ident> '=' $<value>=<expr> }

# shorter form of above
regex assign { <name=ident> '=' <value=expr> } }
regex ident { <.alpha> \w* }    # <alpha> not captured
regex { 'abc' <!digit> }        # abc not followed by a digit
regex { <?sigil> <variable> }   # parse variable only if sigil found
Copyright © 2009
http://www.pmichaud.com/2009/pres/