Is it possible to dynamically assign possible values to a field in a Grammar file?
For example: I want the 'NAME' field of the example below to be one of the following words: 'name', 'age' or 'city'. So, I have define it in my Grammar file.
But, if later I want to accept another word ('job', for example), I need always to update this Grammar file, or is it possible to pass to the file a List < String > with the possible words for that field, and only update the list in my Java code?
equality_expr
: NAME equality_op atom -> ^(equality_op NAME atom)
;
NAME
: 'name'
| 'age'
| 'city'
;