def p_enum_constant(t):
    """enum_constant : ID EQUALS value"""
    global name_dict, error_occurred
    id = t[1]
    value = t[3]
    lineno = t.lineno(1)
    if id_unique(id, 'enum', lineno):
        info = name_dict[id] = const_info(id, value, lineno, enum=True)
        if not (value[0].isdigit() or value[0] == '-'):
            # We have a name instead of a constant, make sure it is defined
            if value not in name_dict:
                error_occurred = True
                print("ERROR - can't derefence {0:s} at line {1:s}".format(
                    value, lineno))
            elif not isinstance(name_dict[value], const_info):
                error_occurred = True
                print(
                    "ERROR - reference to {0:s} at line {1:s} is not a constant".
                    format(value, lineno))
            else:
                info.positive = name_dict[value].positive
        t[0] = [info]
    else:
        t[0] = []
enum_constant : ID EQUALS value