Switch parsePrimaryExpression to if-else style

Due to a JavaScript engine issue, the switch statement in parsePrimaryExpression is not executing correctly. I've switched it to an if-else to get around this issue.