Example #1
0
 public object Run(VM vm, IMeeValue args)
 {
     return(Directory
            .GetDirectories(Directory.GetCurrentDirectory())
            .Concat(Directory.GetFiles(Directory.GetCurrentDirectory()))
            .Select(path => Path.GetFileName(path)));
 }
Example #2
0
 public IMeeValue Add(IMeeValue other)
 {
     if (other is StringMeeValue s)
     {
         return(new StringMeeValue(Value + s.Value));
     }
     throw new NotSupportedException();
 }
Example #3
0
 public IMeeValue Substract(IMeeValue other)
 {
     if (other is DoubleMeeValue d)
     {
         return(new DoubleMeeValue(Value - d.Value));
     }
     throw new NotSupportedException();
 }
Example #4
0
 public IMeeValue Multiply(IMeeValue other)
 {
     if (other is DoubleMeeValue d)
     {
         return(new DoubleMeeValue(Value * d.Value));
     }
     throw new NotSupportedException();
 }
Example #5
0
 public IMeeValue Divide(IMeeValue other)
 {
     if (other is DoubleMeeValue d)
     {
         return(new DoubleMeeValue(Value / d.Value));
     }
     throw new NotSupportedException();
 }
Example #6
0
 public IMeeValue this[IMeeValue index]
 {
     get
     {
         if (index.Internal is string s)
         {
             return(this[s]);
         }
         throw new NotSupportedException();
     }
 }
Example #7
0
 public IMeeValue this[IMeeValue index]
 {
     get
     {
         if (index.Internal is double d)
         {
             return(this[(int)d]);
         }
         throw new NotSupportedException();
     }
 }
Example #8
0
 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);
 }
Example #9
0
 public void Push(IMeeValue value)
 {
     Stack.Add(value);
 }
Example #10
0
 public object Run(VM vm, IMeeValue args)
 {
     return(Environment.GetEnvironmentVariables());
 }
Example #11
0
 public object Run(VM vm, IMeeValue args)
 {
     return(args[0]);
 }
Example #12
0
 public IMeeValue this[IMeeValue index] => throw new NotSupportedException();
Example #13
0
 public IMeeValue Divide(IMeeValue value2)
 {
     throw new NotSupportedException();
 }
Example #14
0
 public IMeeValue Multiply(IMeeValue value2)
 {
     throw new NotSupportedException();
 }
Example #15
0
 public IMeeValue Substract(IMeeValue value2)
 {
     throw new NotSupportedException();
 }
Example #16
0
 public object Run(VM vm, IMeeValue args)
 {
     vm.SetVariable(args[0].Internal as string, args[1]);
     return(args[1]);
 }
Example #17
0
 public IMeeValue Add(IMeeValue other)
 {
     throw new NotSupportedException();
 }
Example #18
0
 public object Run(VM vm, IMeeValue args)
 {
     return(Environment.GetEnvironmentVariable(args[0].Internal as string));
 }
Example #19
0
 public object Run(VM vm, IMeeValue args)
 {
     return(vm.Variables);
 }
Example #20
0
 public object Run(VM vm, IMeeValue args)
 {
     Directory.SetCurrentDirectory(args[0].Internal as string);
     vm.SetVariable("cwd", Directory.GetCurrentDirectory());
     return(null);
 }
Example #21
0
 public object Run(VM vm, IMeeValue args)
 {
     return(Directory.GetCurrentDirectory());
 }