コード例 #1
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_invokevirtual(p):
    '''invokevirtual : INVOKEVIRTUAL SHORT
                     | INVOKEVIRTUAL BYTE
                     | INVOKEVIRTUAL IDENTIFIER'''

    isString = False
    cp = cf.constant_pool

    print("Inside invokevirtual")

    try:
        p[2] = int(p[2])
    except:
        isString = True

    if not isString:
        p[0] = opc_compile(p[1])
        p[0] += struct.pack('>h', p[2])
    else:
        print("inside invokevirtual 2")
        p[0] = opc_compile(p[1])
        method_name = None
        found = False

        mri_index = 1
        for i in cp.entries[1:]:
            if i.tag == CONSTANT_METHODREF:
                nat_index = i.name_and_type_index
                method_name = cp.entries[
                    cp.entries[nat_index].name_index].get_bytes_as_str()
                print("method_name = %s" % method_name)
                if method_name == p[2]:
                    found = True
                    break

            mri_index += 1

        if found:
            print("Found on index %d" % mri_index)
            p[0] += struct.pack('>h', mri_index)
コード例 #2
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_invokevirtual(p):
    '''invokevirtual : INVOKEVIRTUAL SHORT
                     | INVOKEVIRTUAL BYTE
                     | INVOKEVIRTUAL IDENTIFIER'''

    isString = False
    cp = cf.constant_pool

    print("Inside invokevirtual")

    try:
        p[2] = int(p[2])
    except:
        isString = True

    if not isString:
        p[0] = opc_compile(p[1])
        p[0] += struct.pack('>h', p[2])
    else:
        print("inside invokevirtual 2")
        p[0] = opc_compile(p[1])
        method_name = None
        found = False

        mri_index = 1
        for i in cp.entries[1:]:
            if i.tag == CONSTANT_METHODREF:
                    nat_index = i.name_and_type_index
                    method_name = cp.entries[cp.entries[nat_index].name_index].get_bytes_as_str()
                    print("method_name = %s" % method_name)
                    if method_name == p[2]:
                        found = True
                        break

            mri_index += 1

        if found:
            print("Found on index %d" % mri_index)
            p[0] += struct.pack('>h', mri_index)
コード例 #3
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_aload_0(p):
    '''aload_0 : ALOAD_0'''
    p[0] = opc_compile(p[1])
コード例 #4
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_astore_0(p):
    '''astore_0 : ASTORE_0'''
    p[0] = opc_compile(p[1])
コード例 #5
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_astore_2(p):
    '''astore_2 : ASTORE_2'''
    p[0] = opc_compile(p[1])
コード例 #6
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_invokespecial(p):
    '''invokespecial : INVOKESPECIAL SHORT
                     | INVOKESPECIAL BYTE'''
    p[0] = opc_compile(p[1])
    p[0] += struct.pack('>h', p[2])
コード例 #7
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_ireturn(p):
    '''ireturn : IRETURN'''
    p[0] = opc_compile(p[1])
コード例 #8
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_iload_2(p):
    '''iload_2 : ILOAD_2'''
    p[0] = opc_compile(p[1])
コード例 #9
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_istore_1(p):
    '''istore_1 : ISTORE_1'''
    p[0] = opc_compile(p[1])
コード例 #10
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_iload_0(p):
    '''iload_0 : ILOAD_0'''
    p[0] = opc_compile(p[1])
コード例 #11
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_iload_1(p):
    '''iload_1 : ILOAD_1'''
    p[0] = opc_compile(p[1])
コード例 #12
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_aload_2(p):
    '''aload_2 : ALOAD_2'''
    p[0] = opc_compile(p[1])
コード例 #13
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_aload_3(p):
    '''aload_3 : ALOAD_3'''
    p[0] = opc_compile(p[1])
コード例 #14
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_aload_1(p):
    '''aload_1 : ALOAD_1'''
    p[0] = opc_compile(p[1])
コード例 #15
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_aload_0(p):
    '''aload_0 : ALOAD_0'''
    p[0] = opc_compile(p[1])
コード例 #16
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_astore_3(p):
    '''astore_3 : ASTORE_3'''
    p[0] = opc_compile(p[1])
コード例 #17
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_aload_2(p):
    '''aload_2 : ALOAD_2'''
    p[0] = opc_compile(p[1])
コード例 #18
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_iload_2(p):
    '''iload_2 : ILOAD_2'''
    p[0] = opc_compile(p[1])
コード例 #19
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_iload_0(p):
    '''iload_0 : ILOAD_0'''
    p[0] = opc_compile(p[1])
コード例 #20
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_iload_3(p):
    '''iload_3 : ILOAD_3'''
    p[0] = opc_compile(p[1])
コード例 #21
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_isub(p):
    '''isub : ISUB'''
    p[0] = opc_compile(p[1])
コード例 #22
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_isub(p):
    '''isub : ISUB'''
    p[0] = opc_compile(p[1])
コード例 #23
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_astore_2(p):
    '''astore_2 : ASTORE_2'''
    p[0] = opc_compile(p[1])
コード例 #24
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_istore_0(p):
    '''istore_0 : ISTORE_0'''
    p[0] = opc_compile(p[1])
コード例 #25
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_ldc(p):
    '''ldc : LDC BYTE'''
    p[0] = opc_compile(p[1])
    p[0] += bytes([p[2]])
コード例 #26
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_istore_1(p):
    '''istore_1 : ISTORE_1'''
    p[0] = opc_compile(p[1])
コード例 #27
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_astore_0(p):
    '''astore_0 : ASTORE_0'''
    p[0] = opc_compile(p[1])
コード例 #28
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_istore_2(p):
    '''istore_2 : ISTORE_2'''
    p[0] = opc_compile(p[1])
コード例 #29
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_astore_1(p):
    '''astore_1 : ASTORE_1'''
    p[0] = opc_compile(p[1])
コード例 #30
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_istore_3(p):
    '''istore_3 : ISTORE_3'''
    p[0] = opc_compile(p[1])
コード例 #31
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_astore_3(p):
    '''astore_3 : ASTORE_3'''
    p[0] = opc_compile(p[1])
コード例 #32
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_getstatic(p):
    '''getstatic : GETSTATIC SHORT
                 | GETSTATIC BYTE'''
    p[0] = opc_compile(p[1])
    p[0] += struct.pack('>h', p[2])
コード例 #33
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_aload_1(p):
    '''aload_1 : ALOAD_1'''
    p[0] = opc_compile(p[1])
コード例 #34
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_new(p):
    '''new : NEW SHORT
           | NEW BYTE'''
    p[0] = opc_compile(p[1])
    p[0] += struct.pack('>h', p[2])
コード例 #35
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_aload_3(p):
    '''aload_3 : ALOAD_3'''
    p[0] = opc_compile(p[1])
コード例 #36
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_dup(p):
    '''dup : DUP'''
    p[0] = opc_compile(p[1])
コード例 #37
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_iload_1(p):
    '''iload_1 : ILOAD_1'''
    p[0] = opc_compile(p[1])
コード例 #38
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_invokespecial(p):
    '''invokespecial : INVOKESPECIAL SHORT
                     | INVOKESPECIAL BYTE'''
    p[0] = opc_compile(p[1])
    p[0] += struct.pack('>h', p[2])
コード例 #39
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_iload_3(p):
    '''iload_3 : ILOAD_3'''
    p[0] = opc_compile(p[1])
コード例 #40
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_istore_3(p):
    '''istore_3 : ISTORE_3'''
    p[0] = opc_compile(p[1])
コード例 #41
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_istore_0(p):
    '''istore_0 : ISTORE_0'''
    p[0] = opc_compile(p[1])
コード例 #42
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_new(p):
    '''new : NEW SHORT
           | NEW BYTE'''
    p[0] = opc_compile(p[1])
    p[0] += struct.pack('>h', p[2])
コード例 #43
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_istore_2(p):
    '''istore_2 : ISTORE_2'''
    p[0] = opc_compile(p[1])
コード例 #44
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_astore_1(p):
    '''astore_1 : ASTORE_1'''
    p[0] = opc_compile(p[1])
コード例 #45
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_getstatic(p):
    '''getstatic : GETSTATIC SHORT
                 | GETSTATIC BYTE'''
    p[0] = opc_compile(p[1])
    p[0] += struct.pack('>h', p[2])
コード例 #46
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_ldc(p):
    '''ldc : LDC BYTE'''
    p[0] = opc_compile(p[1])
    p[0] += bytes([p[2]])
コード例 #47
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_dup(p):
    '''dup : DUP'''
    p[0] = opc_compile(p[1])
コード例 #48
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_bipush(p):
    '''bipush : BIPUSH BYTE'''
    p[0] = opc_compile(p[1])
    p[0] += bytes([p[2]])
コード例 #49
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_ireturn(p):
    '''ireturn : IRETURN'''
    p[0] = opc_compile(p[1])
コード例 #50
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_return(p):
    '''return : RETURN'''
    p[0] = opc_compile(p[1])
コード例 #51
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_bipush(p):
    '''bipush : BIPUSH BYTE'''
    p[0] = opc_compile(p[1])
    p[0] += bytes([p[2]])
コード例 #52
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_nop(p):
    '''nop : NOP'''
    p[0] = opc_compile(p[1])
コード例 #53
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_return(p):
    '''return : RETURN'''
    p[0] = opc_compile(p[1])
コード例 #54
0
ファイル: grammar.py プロジェクト: typoon/jdecompy
def p_nop(p):
    '''nop : NOP'''
    p[0] = opc_compile(p[1])