Program.cs 936 B

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