I have a grammar with the following rule - > verb and verb has 3 token values get, put change see below . if i was to read a file that has more than 3 verbs (get,put and change ) I would like the parser to print an error message . Would it be best to have this embedded in the listener or is there a neat way to do inside the grammar?
Is there a way i can count the token values inside the verb for example ?
verb :
GET |
PUT |
CHANGE ;