fix parsing of ternary op expressions, add ternary tests