For example, I currently have rules like this one, that matches 'p', 'pr', 'pro' or 'prod'.
prod
= 'p'i ('r'i ('o'i ('d'i)?)?)? { return 'prod'; }
Is there a more general way of doing this? It's rather painful to maintain for anything more than a 3 or 4 character literal.