Program.cs 810 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using Jint.Native;
  3. using Jint.Runtime;
  4. namespace Jint.Repl
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. var engine = new Engine();
  11. while (true)
  12. {
  13. Console.ForegroundColor = ConsoleColor.Green;
  14. Console.Write(" > ");
  15. var input = Console.ReadLine();
  16. if (input == "exit")
  17. {
  18. return;
  19. }
  20. var result = engine.GetValue(engine.Execute(input));
  21. var str = engine.Json.Stringify(engine.Json, Arguments.From(result, Undefined.Instance, " "));
  22. Console.ForegroundColor = ConsoleColor.Magenta;
  23. Console.WriteLine("=> {0}", str);
  24. }
  25. }
  26. }
  27. }