CASE statement parser