Support @ operator

This commit is contained in:
Michael Hansen
2015-10-01 17:01:02 -07:00
parent aea5b2dab1
commit badd17bd21
4 changed files with 19 additions and 2 deletions

View File

@@ -34,7 +34,7 @@ const char* ASTBinary::op_str() const
".", " ** ", " * ", " / ", " // ", " % ", " + ", " - ",
" << ", " >> ", " & ", " ^ ", " | ", " and ", " or ",
" += ", " -= ", " *= ", " /= ", " %= ", " **= ", " <<= ",
" >>= ", " &= ", " ^= ", " |= ", " //= "
" >>= ", " &= ", " ^= ", " |= ", " //= ", " @ ", " @= ",
};
return s_op_strings[op()];
}

View File

@@ -96,7 +96,7 @@ public:
BIN_OR, BIN_LOG_AND, BIN_LOG_OR, BIN_IP_ADD, BIN_IP_SUBTRACT,
BIN_IP_MULTIPLY, BIN_IP_DIVIDE, BIN_IP_MODULO, BIN_IP_POWER,
BIN_IP_LSHIFT, BIN_IP_RSHIFT, BIN_IP_AND, BIN_IP_XOR, BIN_IP_OR,
BIN_IP_FLOOR,
BIN_IP_FLOOR, BIN_MAT_MULTIPLY, BIN_IP_MAT_MULTIPLY,
};
ASTBinary(PycRef<ASTNode> left, PycRef<ASTNode> right, int op,

View File

@@ -231,6 +231,14 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
stack.push(new ASTBinary(left, right, ASTBinary::BIN_XOR));
}
break;
case Pyc::BINARY_MATRIX_MULTIPLY:
{
PycRef<ASTNode> right = stack.top();
stack.pop();
PycRef<ASTNode> left = stack.top();
stack.pop();
stack.push(new ASTBinary(left, right, ASTBinary::BIN_MAT_MULTIPLY));
}
case Pyc::BREAK_LOOP:
curblock->append(new ASTKeyword(ASTKeyword::KW_BREAK));
break;
@@ -906,6 +914,15 @@ PycRef<ASTNode> BuildFromCode(PycRef<PycCode> code, PycModule* mod)
stack.push(new ASTBinary(left, right, ASTBinary::BIN_IP_XOR));
}
break;
case Pyc::INPLACE_MATRIX_MULTIPLY:
{
PycRef<ASTNode> right = stack.top();
stack.pop();
PycRef<ASTNode> left = stack.top();
stack.pop();
stack.push(new ASTBinary(left, right, ASTBinary::BIN_IP_MAT_MULTIPLY));
}
break;
case Pyc::JUMP_IF_FALSE_A:
case Pyc::JUMP_IF_TRUE_A:
case Pyc::JUMP_IF_FALSE_OR_POP_A:

Binary file not shown.