In certain grammars, C3 may return a collection of candidate rules which logically start at different tokens in the string.
For example the following grammar rule
clause: leftOperand operator rightOperand;
leftOperand: string;
operator: WAS | WAS IN
rightOperand: string;
For the clause status WAS I| we could receive the following candidate rules:
In my case I'm showing suggestions to the user based on these rules and replacing text in the string when a suggestion is selected. However currently there's no way to determine which text/tokens should be replaced for a given rule.
To get around this I've forked the library and updated the rule collection to include the token index at which a candidate rule starts, e.g.
In certain grammars, C3 may return a collection of candidate rules which logically start at different tokens in the string. For example the following grammar rule
For the clause
status WAS I|
we could receive the following candidate rules:In my case I'm showing suggestions to the user based on these rules and replacing text in the string when a suggestion is selected. However currently there's no way to determine which text/tokens should be replaced for a given rule.
To get around this I've forked the library and updated the rule collection to include the token index at which a candidate rule starts, e.g.
I think this makes sense to include for other consumers so they can solve similar use cases in a grammar agnostic way.