def resolve_name(rule, tokens, id, args):
    if id in [x[0] for x in tokens]:
        # It's a token
        if args:
            print('Warning: ignoring parameters on TOKEN %s<<%s>>' % (id, args))
        return parsetree.Terminal(rule, id)
    else:
        # It's a name, so assume it's a nonterminal
        return parsetree.NonTerminal(rule, id, args)


# Begin -- grammar generated by Yapps
dataset/ETHPy150Open smurfix/yapps/yapps/grammar.py/resolve_name/original