1 module orelang.operator.AliasOperator; 2 import orelang.operator.IOperator, 3 orelang.Engine, 4 orelang.Value; 5 6 class AliasOperator : IOperator { 7 /** 8 * call 9 */ 10 public Value call(Engine engine, Value[] args) { 11 string _new = args[0].getString; 12 string base = args[1].getString; 13 14 if (base in engine.variables) { 15 Value v = engine.variables[base]; 16 17 engine.variables.set(_new, v); 18 19 return v; 20 } else { 21 throw new Exception("No such variable or operator - " ~ base); 22 } 23 } 24 }