type_def : TYPEDEF declaration SEMI

def p_type_def_1(t):
    """type_def : TYPEDEF declaration SEMI"""
    # declarations is a type_info
    d = t[2]
    lineno = t.lineno(1)
    sortno = t.lineno(3) + 0.5
    if d.type == 'void':
        global error_occurred
        error_occurred = True
        print(
            u"ERROR - can't use void in typedef at line {0:d}".format(lineno))
        return
    d.lineno = lineno
    if id_unique(d.id, d.type, lineno):
        if d.type == 'enum':
            info = d.create_enum(lineno, sortno)
        elif d.type == 'struct':
            info = d.create_struct(lineno, sortno)
        elif d.type == 'union':
            info = d.create_union(lineno, sortno)
        else:
            info = d
        name_dict[d.id] = info