Refactor placeholder parser

This is to allow yield and await everywhere.

Also, restructur the code to reduce code size.