I think it's crazy, but to be honest I'm not sure what this code is supposed to do. Is it supposed to find all Ti.<blah> references? If so, you need to listen for AST_Dot and AST_Sub to get the sub-namespaced names (i.e. the UI.createButton) part, but more importantly you will need to listen for the AST_SymbolRef rule which will give you the 'Ti' or 'Titanium' value that you need to base the other checks off of.