BP check tool

Hi,

I am trying to develop a BP check Tool for AX2012 (using X++) which should check for flower braces after looping statement(if,for,while,do while,switch) and even missing break statements after each case and default satement at the end of switch case etc. I could parse through the code (using xppScanner class) and search for missing flower braces,but in switch construct,I can not parse since I dunno which condition to stop parsing at. Any help or idea would be halpful.