def getTokenName(context, funcList, Dict, defaultVal):
    """Get the token name of a rule context that triggered a grammar rule.
    It is used only for Code Laws and Courts

    Args:
        context: the context rule
        
        funcList: this is a list containing all available functions of context
                (grammar tokens are represented as functions)
                
        Dict: dictionary that will be used to search the token
        
        defaultVal: If no key is found, return a user defined value

    returns:
        gramar token as a string
    """ 
    try:
        indx = funcList.index('__class__')
    except ValueError:
        indx = 0
    #print indx
    methodTriggered = ''
    for method in funcList[0:indx]:
        method_to_call = getattr(context, method)
        if callable(method_to_call):
            result = method_to_call()
            if result is not None:
                methodTriggered = method_to_call.__name__
                #print method_to_call.__name__
                #print courts.get(method_to_call.__name__, defaultVal)
    return Dict.get(methodTriggered, defaultVal)