fix operator and factor parsing, add additional tests to cover regressions due to these changes