I have something like the following:
ChoiceOf
{
Regex( /X\ X....../ )
Regex( /X\ X....../ )
}
Is there some way, beyond the matched substring, of determining which choice was made? I was trying something like:
ChoiceOf
{
TryCapture{ /XX\ ....../ } transform: { _ in 1}
TryCapture{ /X\ X....../ } transform: { _ in 2}
}
Which almost worked, but I don't want to create a new tuple element for each match, I'd like to have the expression return (Substring, Int) where the second element of the tuple is the integer.
Thanks.