Improved rules for parsing angular js code