Java Code Examples for org.luaj.vm2.Lua#OP_NOT

The following examples show how to use org.luaj.vm2.Lua#OP_NOT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LuaParser.java    From VideoOS-Android-SDK with GNU General Public License v3.0 5 votes vote down vote up
public int Unop() throws ParseException {
    switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
        case 83:
            jj_consume_token(83);
        {
            if (true) return Lua.OP_UNM;
        }
        break;
        case NOT:
            jj_consume_token(NOT);
        {
            if (true) return Lua.OP_NOT;
        }
        break;
        case 69:
            jj_consume_token(69);
        {
            if (true) return Lua.OP_LEN;
        }
        break;
        default:
            jj_la1[33] = jj_gen;
            jj_consume_token(-1);
            throw new ParseException();
    }
    throw new Error("Missing return statement in function");
}
 
Example 2
Source File: Exp.java    From VideoOS-Android-SDK with GNU General Public License v3.0 5 votes vote down vote up
static int precedence(int op) {
    switch (op) {
        case Lua.OP_OR:
            return 0;
        case Lua.OP_AND:
            return 1;
        case Lua.OP_LT:
        case Lua.OP_GT:
        case Lua.OP_LE:
        case Lua.OP_GE:
        case Lua.OP_NEQ:
        case Lua.OP_EQ:
            return 2;
        case Lua.OP_CONCAT:
            return 3;
        case Lua.OP_ADD:
        case Lua.OP_SUB:
            return 4;
        case Lua.OP_MUL:
        case Lua.OP_DIV:
        case Lua.OP_MOD:
            return 5;
        case Lua.OP_NOT:
        case Lua.OP_UNM:
        case Lua.OP_LEN:
            return 6;
        case Lua.OP_POW:
            return 7;
        default:
            throw new IllegalStateException("precedence of bad op " + op);
    }
}
 
Example 3
Source File: Exp.java    From HtmlNative with Apache License 2.0 5 votes vote down vote up
static int precedence(int op) {
	switch ( op ) {
	case Lua.OP_OR: return 0;
	case Lua.OP_AND: return 1;
	case Lua.OP_LT: case Lua.OP_GT: case Lua.OP_LE: case Lua.OP_GE: case Lua.OP_NEQ: case Lua.OP_EQ: return 2;
	case Lua.OP_CONCAT: return 3;
	case Lua.OP_ADD: case Lua.OP_SUB: return 4;
	case Lua.OP_MUL: case Lua.OP_DIV: case Lua.OP_MOD: return 5;
	case Lua.OP_NOT: case Lua.OP_UNM: case Lua.OP_LEN: return 6;
	case Lua.OP_POW: return 7;
	default: throw new IllegalStateException("precedence of bad op "+op);
	}
}
 
Example 4
Source File: Exp.java    From luaj with MIT License 5 votes vote down vote up
static int precedence(int op) {
	switch ( op ) {
	case Lua.OP_OR: return 0;
	case Lua.OP_AND: return 1;
	case Lua.OP_LT: case Lua.OP_GT: case Lua.OP_LE: case Lua.OP_GE: case Lua.OP_NEQ: case Lua.OP_EQ: return 2;
	case Lua.OP_CONCAT: return 3;
	case Lua.OP_ADD: case Lua.OP_SUB: return 4;
	case Lua.OP_MUL: case Lua.OP_DIV: case Lua.OP_MOD: return 5;
	case Lua.OP_NOT: case Lua.OP_UNM: case Lua.OP_LEN: return 6;
	case Lua.OP_POW: return 7;
	default: throw new IllegalStateException("precedence of bad op "+op);
	}
}
 
Example 5
Source File: JavaBuilder.java    From luaj with MIT License 5 votes vote down vote up
public void unaryop(int o) {
	String op;
	switch (o) {
		default:
		case Lua.OP_UNM: op = "neg"; break;
		case Lua.OP_NOT: op = "not"; break;
		case Lua.OP_LEN: op = "len"; break;
	}
       append(factory.createInvoke(STR_LUAVALUE, op, TYPE_LUAVALUE, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
}