Improve readability by extracting getPrecedingText(...).