Add support for @for loops (#12600)

This change also refactors @each handling and adds support
for parsing @while directives, but not using them. 

Change-Id: I326b3353f0fe466bf11c7080f802989a5e28726e