Need help with a grammar rule

I’m trying to write a grammar that recognizes a kind of state table. The lines in that table work as follow :

All of these words are basic identifiers separated by WHITESPACES that I chose to leave in the AST.

The problem is that when I specify in my rules that there can be 0 or more keywords, it will consider the last two words as keywords too and then won’t recognize the line because it won’t find the next states.

Is there a way for my rule to be built so that the last two words are the states, but the ones before are keywords ?

Sorry if my question isn’t clear, and thank you for any help you might provide.

Rémi