Identifier terminal except certain keywords

Jun 18, 2015 at 7:40 PM
Edited Jun 18, 2015 at 7:42 PM
I'm using Irony framework and I have:

IdentifierTerminal variable = new IdentifierTerminal("variable");
a terminal for identifying an entry terminal.

This "variable" terminal can hold any string, except for a predefined list of reserved strings. This identifier does not start or any with quotes or double quotes.

I want something like:

IdentifierTerminal variable = any contiguos string EXCEPT "event", "delegate";

How can I enforce this rule for this "variable" terminal?

NOTE: this is linked to this SO question
Jun 18, 2015 at 8:22 PM
Why would you want this?
You can/should just give the reserved word terminals a higher priority than the variable terminal.
Jun 18, 2015 at 8:37 PM
use MarkReservedWords method to identify reserved words that cannot be identifiers
Jun 18, 2015 at 8:45 PM
The thing is that I have something like this:

IdentifierTerminal variable = new IdentifierTerminal("variable");
KeyTerm CONTAINS = new ToTerm("contains", "Contains");

I want to restrict variable of being identified with "contains": that is I know the variable will never have the value "contains" (and a list of other predefined terms).

Can I just CONTAINS.Priority = 10 and know that CONTAINS will be preferred to variable?