예제 #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])