def p_attrs_prec(psr_val):
    #           1     2         3
    #attrs :  ATTR_PREC SOMEINT2
    """
    attrs :  ATTR_PREC SOMEINT
    """
    goto_initial(psr_val)  # begin the string group
def p_attrs_strg3(psr_val):
    "str_attrs : STRG SOMESTRG"
    m = psr_val[2]
    if m:
        # print "simple string '%s'" % m
        psr_val[0] = gcc.tree.tuast.String2(m)
    goto_initial(psr_val)
def p_node_id(psr_val):
    # the identifier node declaration
    'node : NODE HEXVAL attr_list' # len_attrs
    psr_val[0] = { 'node' : nodes.declare(psr_val[1]),
                   'hexval' :psr_val[2],
                   'attr_list' : psr_val[3]
    }
    goto_initial(psr_val)  # begin the string group
def p_attrs_addrs3(psr_val):
    "addr_attrs : ADDR_ATTR SOMEHEX4"
    m = psr_val[2]
    if m:
        # print "address is set to", m
        psr_val[0] = Something(**{"addr": m})
        gcc.tree.nodes.attrs(psr_val[0])
    goto_initial(psr_val)
def p_attrs_addrs3(psr_val):
    'addr_attrs : ADDR_ATTR SOMEHEX4'
    m=psr_val[2]
    if m:
        #print "address is set to", m
        psr_val[0] = { 'addr': m }
        gcc.tree.nodes.attrs(psr_val[0])
    goto_initial(psr_val)
def p_attrs_strg3(psr_val):
    'str_attrs : STRG SOMESTRG'
    m=psr_val[2]
    if m:
        #print "simple string '%s'" % m
        psr_val[0] = {'string':gcc.tree.tuast.String2(m)}
    goto_initial(psr_val)
    gcc.tree.nodes.attrs(psr_val[0])
def p_node_id(psr_val):
    # the identifier node declaration
    "node : NODE HEXVAL attr_list"  # len_attrs
    psr_val[0] = Node({
        "node": nodes.declare(psr_val[1]),
        "hexval": psr_val[2],
        "attr_list": psr_val[3],
    })
    goto_initial(psr_val)  # begin the string group
def p_attrs_type6(psr_val):
    #           type_     2     3
    "type_attrs : TYPE_ATTR NODE INT SOMEINT2"
    goto_initial(psr_val)  # go back
    # print 'finished TYPE_ATTR NODE'
    # psr_val[0] = std_attrs(psr_val)
    nd = psr_val[2]
    field_value = NodeRef(nd, "type")
    psr_val[0] = IntegerCst(type_node=field_value, value=psr_val[4])
def p_attrs_addrs(psr_val):
    "addr_attrs : ADDR_ATTR HEXVAL"
    m = psr_val[2]
    # if m:
    # print "address is set to", m
    # psr_val[0] = [tuast.String(m)]
    # print 'after hexval'
    goto_initial(psr_val)
    psr_val[0] = Something(**{"addr": m})
    gcc.tree.nodes.attrs({"addr": m})
def p_attrs_addrs(psr_val):
    'addr_attrs : ADDR_ATTR HEXVAL'
    m=psr_val[2]
    #if m:
        #print "address is set to", m
        #psr_val[0] = [tuast.String(m)]
    #print 'after hexval'
    goto_initial(psr_val)
    psr_val[0] = { 'addr': m }
    gcc.tree.nodes.attrs({ 'addr': m })
def p_attrs_strg_empty(psr_val):
    "str_attrs : STRG "  # no string....
    m = psr_val[1]
    if m:
        # print "simple string list '%s'" % m
        if isinstance(m, str):
            psr_val[0] = Something(**{"string_val": m})
        else:
            psr_val[0] = Something(**{"string_val": m.val})
        gcc.tree.nodes.attrs(psr_val[0])
    goto_initial(psr_val)
def p_attrs_strg_empty(psr_val):
    'str_attrs : STRG ' # no string....
    m=psr_val[1]
    if m:
        #print "simple string list '%s'" % m
        if isinstance(m, str):
            psr_val[0] = { 'string_val' : m}
        else:
            psr_val[0] = { 'string_val' :m.val}
        gcc.tree.nodes.attrs(psr_val[0])
    goto_initial(psr_val)
def p_attrs_type3(psr_val):
    #           type_     2     3
    'type_attrs : TYPE_ATTR NODE INT SOMEHEX2'
    goto_initial(psr_val)  # go back
    #print 'finished TYPE_ATTR NODE'
    #psr_val[0] = std_attrs(psr_val)
    nd=gcc.tree.nodes.reference(psr_val[2],'type')
    psr_val[0] = {
        #'type': 'type',
        #'val': {
        #'type': psr_val[2],
            'type_name': 'int',
            'type_value': psr_val[4]
        #}
    }
    #nd.ref(psr_val[0])
    gcc.tree.nodes.attrs(psr_val[0])
def p_attrs_type6(psr_val):
    #           type_     2     3
    'type_attrs : TYPE_ATTR NODE INT SOMEINT2'
    goto_initial(psr_val)  # go back
    #print 'finished TYPE_ATTR NODE'
    #psr_val[0] = std_attrs(psr_val)
    nd= psr_val[2]
    field_value = gcc.tree.nodes.reference(nd,"type")
    psr_val[0] = {
        #'type': 'type',
        #'val': {
        #'type' : nd,
        'type_name' : 'int',
        'type_value':psr_val[4]
        #}
    }
    gcc.tree.nodes.attrs(psr_val[0])
def p_attrs_type4b(psr_val):
    #           type_     2     3
    "type_attrs : TYPE_ATTR NODE INT SOMEHEX4"
    goto_initial(psr_val)  # go back
    # print 'finished TYPE_ATTR NODE'
    # psr_val[0] = std_attrs(psr_val)
    # psr_val[0] = [psr_val[1],psr_val[2],psr_val[3],psr_val[4]]
    nd = NodeRef(psr_val[2], "type")
    psr_val[0] = Something(
        **{
            # 'type': 'type',
            # 'val' : {
            # 'type': psr_val[2],
            "type_name": "int",
            "type_value": psr_val[4]
            # }
        })

    gcc.tree.nodes.attrs(psr_val[0])
def p_attr_used_hex(psr_val):
    "attrs : ATTR_USED SOMEHEX4"
    goto_initial(psr_val)  # go back
def p_attrs_prec2(psr_val):
    #           1     2         3
    "attrs :  ATTR_PREC SOMEHEX4"
    goto_initial(psr_val)  # begin the string group
def p_attrs_algn2(psr_val):
    #           1     2         3
    "attrs :  ATTR_ALGN SOMEHEX4"
    goto_initial(psr_val)  # begin the string group
def p_attrs_algn2(psr_val):
    #           1     2         3
    'attrs :  ATTR_ALGN SOMEHEX4'
    #psr_val[0] = std_attrs(psr_val)
    goto_initial(psr_val)  # begin the string group
def p_attrs_prec2(psr_val):
    #           1     2         3
    'attrs :  ATTR_PREC SOMEHEX4'
    goto_initial(psr_val)  # begin the string group
def p_attr_used_hex(psr_val):
    'attrs : ATTR_USED SOMEHEX4'
    goto_initial(psr_val)  # go back
def p_attr_used(psr_val):
    'attrs : ATTR_USED SOMEINT2'
    goto_initial(psr_val)  # go back
def p_attr_used(psr_val):
    "attrs : ATTR_USED SOMEINT2"
    goto_initial(psr_val)  # go back
def p_attrs_type3(psr_val):
    #           type_     2     3
    "type_attrs : TYPE_ATTR NODE INT SOMEHEX2"
    goto_initial(psr_val)  # go back
    psr_val[0] = IntegerCst(type_node=NodeRef(psr_val[2], "type"),
                            value=psr_val[4])