calculator: fix parsing sequences