public SkryptEngine Execute(string code, ParserOptions parserOptions, bool isImporting = false, LexicalEnvironment lexicalEnvironment = null) { var program = ParseProgram(code, parserOptions); return(Execute(program, isImporting, lexicalEnvironment)); }
internal SkryptEngine Execute(SkryptParser.ProgramContext program, bool isImporting = false, LexicalEnvironment lexicalEnvironment = null) { if (SW == null) { SW = Stopwatch.StartNew(); } else { SW.Start(); } ProgramContext = program; if (MemoryLimit > 0) { ResetMemoryUsage(); } Visitor.CurrentEnvironment = lexicalEnvironment ?? GlobalEnvironment; Visitor.Visit(ProgramContext); foreach (var kv in InitializeOnParse) { if (!kv.Value.IsInitialized) { kv.Value.Initialize(); } } if (!_discardGlobal) { CreateGlobals(); } SW.Stop(); return(this); }