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