Manual branch point as an alternative to adjusting regexes to be equivalent
SBNF ... Due to the complexities of regex, a branch point is only created with equivalent regexes.
Could an alternative solution to manually fixing the regexes to be equivalent (rather error-prone in more complicated composable regex rules) to manually indicate that a branch point needs to be created?
So you could write
main : 'aa?'{scope1 ⸙1} 'b'
| 'a' {scope2 ⸙1} 'c' ;
instead of
main : 'aa'{scope1} 'b'
| 'a'{scope1} 'b'
| 'a'{scope2} 'c' ;
I don't see how this is all that useful beyond tiny examples. Branch points can and do start anywhere, usually across different rules. Maybe a way to specify a "ambiguity regex" for this use case?
The need arose very much from a non-tiny example precisely because it wasn't tiny, and the rules were composed from many sub-rules, so you couldn't see whether the rules were equivalent (especially when tweaking those sub-rules) and thus track the changes progressively (with a manual branch you are certain it branched, so you can only focus on the post-branching rules)
Not sure what "ambiguity regex" is, so don't know whether it can help resolve this
By "ambiguity regex" I mean specifying a regex with which to check for equivalent regexes. ie. a way to say 'aa?' is equivalent to 'a'.
Here's a counterexample to the proposed behavior:
a : 'a' ;
aa : 'aa?' ;
aaa : 'aa*' ;
one : a | aa ;
two : a | aa | aaa ;
Both a and aa start two different branch points from different rules.
Maybe this could also work