Corrected token start position calculation and the nodeHasTokens predicate.