Using perl's Regexp::Grammars, how do I make a capture dependent on $MATCH?
- by Evan Carroll
I've got a token like such:
<delim2=((?{ $MATCH{delim} }))>
and what I want to happen is for delim2 to capture and be set to the value of delim. When I run this, delim2 is set, but the capture is never done. I think this is an error in my reasoning: I'm trying to chain this form:
<ALIAS= ( PATTERN )> Match pattern, save match in $MATCH{ALIAS}
and this form: (?{ MATCH{delim} }) into something like this
<ALIAS= ( (?{MATCH{delim}) )> Matches the value of $MATCH{delim} save to $MATCH{delim2}
but this simply doesn't seem valid. I can verify my original token works <delim2=((?{ die $MATCH{delim} }))> will die with the value, and, if I hard code it, I get the right capture and everything works <delim2=(')>? So how do I go about achieving sane results, while having a dynamic pattern?