Switching between X-Pyrano-, X-Furano-, and Anhydro-X-pyranoside Synthesis (X = C, N) under Lewis acid Catalyzed Conditions.