// Path: ngscript-core/src/main/java/org/ngscript/runtime/VmRuntimeException.java
// public class VmRuntimeException extends RuntimeException {
// 
//     VirtualMachine vm;
// 
//     public VmRuntimeException(String message) {
//         super(message);
//     }
// 
//     public VmRuntimeException(Throwable cause) {
//         super(cause);
//     }
// 
//     public VmRuntimeException(VirtualMachine vm, String message) {
//         super(genInfoString(vm, message));
//         this.vm = vm;
//     }
// 
//     final static String genInfoString(VirtualMachine vm, String message) {
//         try {
//             StringBuilder sb = new StringBuilder();
//             sb
//                     .append("\r\n========== VM ERROR ==========\r\n")
//                     .append(message)
//                     .append("\r\nnear code line ").append(vm.helptext.paramExtended).append("\r\n")
//                     .append(vm.helptext.toString())
//                     .append("\r\n========== VM STATUS ==========\r\n")
//                     .append("%eip = ").append(vm.getEip()).append("\r\n")
//                     .append("ins = ").append(vm.instructions[vm.getEip() - 1]).append("\r\n")
//                     .append("%env = ").append((vm.env.read()).toString()).append("\r\n")
//                     .append("%eax = ").append(vm.eax.read() == null ? "null" : vm.eax.read().toString()).append("\r\n")
//                     .append("==============================\r\n");
//             return sb.toString();
//         } catch (Exception ex) {
//             return message;
//         }
//     }
// 
// }


import org.ngscript.runtime.VmRuntimeException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.logging.Level;
import java.util.logging.Logger;
/*
 * Copyright 2021 wssccc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.ngscript.runtime.utils;



/**
 * @author wssccc
 */
public class TypeOp {

    public static final int OP_ADD = '+';
    public static final int OP_SUB = '-';
    public static final int OP_MUL = '*';
    public static final int OP_DIV = '/';
    public static final int OP_EQ = '=';
    public static final int OP_MOD = '%';

// Path: ngscript-core/src/main/java/org/ngscript/runtime/VmRuntimeException.java
// public class VmRuntimeException extends RuntimeException {
// 
//     VirtualMachine vm;
// 
//     public VmRuntimeException(String message) {
//         super(message);
//     }
// 
//     public VmRuntimeException(Throwable cause) {
//         super(cause);
//     }
// 
//     public VmRuntimeException(VirtualMachine vm, String message) {
//         super(genInfoString(vm, message));
//         this.vm = vm;
//     }
// 
//     final static String genInfoString(VirtualMachine vm, String message) {
//         try {
//             StringBuilder sb = new StringBuilder();
//             sb
//                     .append("\r\n========== VM ERROR ==========\r\n")
//                     .append(message)
//                     .append("\r\nnear code line ").append(vm.helptext.paramExtended).append("\r\n")
//                     .append(vm.helptext.toString())
//                     .append("\r\n========== VM STATUS ==========\r\n")
//                     .append("%eip = ").append(vm.getEip()).append("\r\n")
//                     .append("ins = ").append(vm.instructions[vm.getEip() - 1]).append("\r\n")
//                     .append("%env = ").append((vm.env.read()).toString()).append("\r\n")
//                     .append("%eax = ").append(vm.eax.read() == null ? "null" : vm.eax.read().toString()).append("\r\n")
//                     .append("==============================\r\n");
//             return sb.toString();
//         } catch (Exception ex) {
//             return message;
//         }
//     }
// 
// }


// Path: ngscript-core/src/main/java/org/ngscript/runtime/utils/TypeOp.java
import org.ngscript.runtime.VmRuntimeException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.logging.Level;
import java.util.logging.Logger;

/*
 * Copyright 2021 wssccc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.ngscript.runtime.utils;



/**
 * @author wssccc
 */
public class TypeOp {

    public static final int OP_ADD = '+';
    public static final int OP_SUB = '-';
    public static final int OP_MUL = '*';
    public static final int OP_DIV = '/';
    public static final int OP_EQ = '=';
    public static final int OP_MOD = '%';

    public static Object eval(int op, Object o1, Object o2) throws VmRuntimeException {