def getFirstIdentifier (pt): """getFirstIdentifier() Get the first identifier token found in the given parse tree.""" ret_val = None for pt_payload in TreeUtils.prefix_tree_iter(pt): if type(pt_payload) == tuple and pt_payload[0] == IDENTIFIER: ret_val = pt_payload break return ret_val
def isTypedef (pt): """isTypedef() Predicate function for determining if the current parse tree corresponds to a type definiton.""" ret_val = False typedef_tok = cTokenMap["TYPEDEF"] for pt_payload in TreeUtils.prefix_tree_iter(pt): if type(pt_payload) == tuple and pt_payload[0] == typedef_tok: ret_val = True break return ret_val