Fix segfault when grammar consists of a single token