What we're looking for was what is termed a "follow set" in LL(k) parsers. I assume from your answer that actipro's grammars don't have any easy way to get this, so we'll have to use the computation of follow set.
To compute a follow set for a production, you find all occurrences of the production in the grammar, and you look at the first sets of all non-optional terms that appear after these occurrences. If there are optional terms, you have to include everything up to the first non-optional term as well.
The follow set is the best way to give a good error message for what you're expecting when a error occurs after matching a given node. However, I suppose this can also be done via a first set for the next node - it just becomes problematic when you want to show a good error for a node based on its context.
I'll try to come up with an example of what we're trying to do and see if you can give us a better alternative.
Kelly
Kelly Leahy
Software Architect
Milliman, USA