예제 #1
0
        private void InitializeContext()
        {
            Alchemist.Log($"Alchemist starting in directory \"{_currentWorkingDirectory}\"");

            var workingDirectoryFiles = new DirectoryInfo(_currentWorkingDirectory).GetFiles("*.ele");
            var packageFiles          = Packages.SelectMany(GetPackageFiles);

            _sourceContext.AddSourceFiles(workingDirectoryFiles.Concat(packageFiles));
            _sourceContext.Recompile(_compilationContext);
        }
예제 #2
0
        protected override int ExecuteImplementation()
        {
            var function = _sourceContext.GlobalScope.GetFunction(Function, _compilationContext);

            if (function == null)
            {
                Alchemist.LogError($"Could not find function \"{Function}\".");
                return(1);
            }

            var output   = function.EvaluateAndSerialize(Arguments.ToArray(), _compilationContext);
            var asString = string.Join(", ", output).Replace("∞", "Infinity");

            Alchemist.Log(asString);
            return(0);
        }