I have an ambiguity in my language in which two nonterminals start with @identifier. Unfortunately, that terminal is within yet another nonterminal that is rather complex. Here are the ambiguous nonterminals alond with the ambiguous "varOrMethod" nonterminal.
assignmentStatement.Production = varOrMethod + postfixExpression.Optional() + (@plus | @minus | @colon).Optiona() + @equalsign + expression + endOfStatement;
methodStatement.Production = varOrMethod + endOfStatement;
varOrMethod.Production = @identifier + (@openparenthesis + expressionList.Optional() + @closeparenthesis).Optional();
To clarify these rules, the language I am parsing allows for the following:
// This is a method
A(1)
// This is a variable
A(1) = 2
How to I check for a valid varOrMethod nonterminal within the CanMatchCallback delegate so I can then check for an endOfStatement immediately following? In other words, I'm not sure how to manually validate a production rule.