Use a switch statement for readability reasons

Add a test for comments parsing as well.