fix operator and factor parsing
add additional tests to cover regressions while working on these changes