示例#1
0
        public static CScript CreateRunner(string[] srcs, ScriptConfig scriptConfig = null, RunConfig config = null)
        {
            if (srcs == null || srcs.Length == 0)
            {
                throw new ArgumentException(nameof(srcs));
            }

            if (scriptConfig == null)
            {
                scriptConfig = ScriptConfig.Default;
            }
            if (config == null)
            {
                config = RunConfig.Default;
            }

            var r     = new Runner(scriptConfig, config);
            var roots = new List <SyntaxNode>();

            foreach (var src in srcs)
            {
                var root = ParseAndValidate(src, scriptConfig.PredefinedSymbols);
                r.LoadSyntax(root);
                roots.Add(root);
            }

            return(new CScript(r, roots.ToArray()));
        }
示例#2
0
        public static CScript CreateRunner(string[] srcs, ScriptConfig scriptConfig = null, RunConfig config = null)
        {
            if (srcs == null || srcs.Length == 0)
            {
                throw new ArgumentException(nameof(srcs));
            }

            if (scriptConfig == null)
            {
                scriptConfig = ScriptConfig.Default;
            }
            if (config == null)
            {
                config = RunConfig.Default;
            }

            var r = new Runner(scriptConfig, config);

            foreach (var src in srcs)
            {
                var root = ParseAndValidate(src);
                r.LoadSyntax(root);
            }

            return(new CScript(r));
        }
示例#3
0
        public void LoadScript(string src)
        {
            var root = ParseAndValidate(src);

            Runner.LoadSyntax(root);
        }