Autocomplete for keywords is a surprisingly nuanced problem.
public |
In this case you need to work out what keywords can appear next, and there may be multiple valid syntaxes!
public | function
In this case you want to narrow the modifiers based on context before and after.