public object Run(VM vm, IMeeValue args) { return(Directory .GetDirectories(Directory.GetCurrentDirectory()) .Concat(Directory.GetFiles(Directory.GetCurrentDirectory())) .Select(path => Path.GetFileName(path))); }
public IMeeValue Add(IMeeValue other) { if (other is StringMeeValue s) { return(new StringMeeValue(Value + s.Value)); } throw new NotSupportedException(); }
public IMeeValue Substract(IMeeValue other) { if (other is DoubleMeeValue d) { return(new DoubleMeeValue(Value - d.Value)); } throw new NotSupportedException(); }
public IMeeValue Multiply(IMeeValue other) { if (other is DoubleMeeValue d) { return(new DoubleMeeValue(Value * d.Value)); } throw new NotSupportedException(); }
public IMeeValue Divide(IMeeValue other) { if (other is DoubleMeeValue d) { return(new DoubleMeeValue(Value / d.Value)); } throw new NotSupportedException(); }
public IMeeValue this[IMeeValue index] { get { if (index.Internal is string s) { return(this[s]); } throw new NotSupportedException(); } }
public IMeeValue this[IMeeValue index] { get { if (index.Internal is double d) { return(this[(int)d]); } throw new NotSupportedException(); } }
public object Run(VM vm, IMeeValue args) { Console.WriteLine(".c Clear current multiline"); Console.WriteLine(".e Throw on Runtime exceptions"); Console.WriteLine(".q Quit REPL"); Console.WriteLine(".v Toggle dump AST"); Console.WriteLine(""); Console.WriteLine("Available commands:"); Console.WriteLine(""); foreach (var command in vm.RegisteredCommands) { Console.WriteLine(command.Name); } return(null); }
public void Push(IMeeValue value) { Stack.Add(value); }
public object Run(VM vm, IMeeValue args) { return(Environment.GetEnvironmentVariables()); }
public object Run(VM vm, IMeeValue args) { return(args[0]); }
public IMeeValue this[IMeeValue index] => throw new NotSupportedException();
public IMeeValue Divide(IMeeValue value2) { throw new NotSupportedException(); }
public IMeeValue Multiply(IMeeValue value2) { throw new NotSupportedException(); }
public IMeeValue Substract(IMeeValue value2) { throw new NotSupportedException(); }
public object Run(VM vm, IMeeValue args) { vm.SetVariable(args[0].Internal as string, args[1]); return(args[1]); }
public IMeeValue Add(IMeeValue other) { throw new NotSupportedException(); }
public object Run(VM vm, IMeeValue args) { return(Environment.GetEnvironmentVariable(args[0].Internal as string)); }
public object Run(VM vm, IMeeValue args) { return(vm.Variables); }
public object Run(VM vm, IMeeValue args) { Directory.SetCurrentDirectory(args[0].Internal as string); vm.SetVariable("cwd", Directory.GetCurrentDirectory()); return(null); }
public object Run(VM vm, IMeeValue args) { return(Directory.GetCurrentDirectory()); }