CONTRIB-4149 Improve define/defined handling

This avoids zillions of unnecesary findNext() calls, that
for big files have a very negative impact. Instead, let's
handle it progresively (current token).