More robust formula parsing.