core: add ternary conditions processing