示例#1
0
 public RunScript(string scriptPath, IFileSystemOperations fileSystemOperations,
                  IDeploymentContext deploymentContext, IOperationContext operationContext, IScriptRunner scriptRunner, IScriptParser scriptParser) : base(deploymentContext, fileSystemOperations, operationContext)
 {
     this.scriptPath   = scriptPath;
     this.scriptRunner = scriptRunner;
     this.scriptParser = scriptParser;
 }
示例#2
0
 public PythonScriptEngine(IScriptParser parser, IEnumerable <IGlobalProvider> globalProviders, IEventAggregator eventAggregator, IThreadTimingFactory threadTimingFactory)
 {
     this.parser              = parser;
     this.globalProviders     = globalProviders;
     this.eventAggregator     = eventAggregator;
     this.threadTimingFactory = threadTimingFactory;
 }
示例#3
0
 public WoaDeployer(IScriptRunner scriptRunner, IScriptParser parser, ITooling tooling, IPhone phone)
 {
     this.scriptRunner = scriptRunner;
     this.parser       = parser;
     this.tooling      = tooling;
     this.phone        = phone;
 }
        public void TestTokens(IScriptParser parser, string expression, int index, Token[] resultTokens, Range range)
        {
            var result = parser.GetTokensFromExpression(expression, index);

            result.Tokens.AssertSequenceEqual(resultTokens);
            Assert.AreEqual(range.NumberOfElements, result.LastTokenRange.NumberOfElements);
            Assert.AreEqual(range.Start, result.LastTokenRange.Start);
        }
示例#5
0
 public LuaEngine(IEnumerable<IGlobalProvider> globalProviders, IScriptParser scriptParser, IPluginInvoker pluginInvoker)
 {
     this.globalProviders = globalProviders;
     this.scriptParser = scriptParser;
     this.pluginInvoker = pluginInvoker;
     luaWorker = new BackgroundWorker();
     lua = new Lua();
 }
 public WoaDeployer(IScriptRunner scriptRunner, IScriptParser parser, ITooling tooling,
                    IFileSystemOperations fileSystemOperations)
 {
     this.scriptRunner         = scriptRunner;
     this.parser               = parser;
     this.tooling              = tooling;
     this.fileSystemOperations = fileSystemOperations;
 }
示例#7
0
 public WoaDeployer(IScriptRunner scriptRunner, IScriptParser parser, ITooling tooling, IPhone phone,
                    IDeploymentContext context,
                    IFileSystemOperations fileSystemOperations)
 {
     this.scriptRunner         = scriptRunner;
     this.parser               = parser;
     this.tooling              = tooling;
     this.phone                = phone;
     this.context              = context;
     this.fileSystemOperations = fileSystemOperations;
 }
示例#8
0
 public HumanEscalationWaitingResumption(ILoggerFactory factory
                                         , ISchedulerService schedulerService
                                         , IWorkItemService workItemService
                                         , IScriptParser parser
                                         , IHumanEscalationHelper helper)
 {
     this._log = factory.Create(typeof(HumanEscalationWaitingResumption));
     this._schedulerService = schedulerService;
     this._workItemService  = workItemService;
     this._parser           = parser;
     this._helper           = helper;
 }
 public HumanEscalationWaitingResumption(ILoggerFactory factory
     , ISchedulerService schedulerService
     , IWorkItemService workItemService
     , IScriptParser parser
     , IHumanEscalationHelper helper)
 {
     this._log = factory.Create(typeof(HumanEscalationWaitingResumption));
     this._schedulerService = schedulerService;
     this._workItemService = workItemService;
     this._parser = parser;
     this._helper = helper;
 }
示例#10
0
        public void OnTestInit()
        {
            var parser = new HierarchicalScriptParser();

            var speakers = new List <string>
            {
                "BIGTEX",
                "PROTAG",
                "PATIENT",
                "DANTE",
            };

            parser.Register(new PhaseDefParser(new PhaseParserSettings
            {
                KnownSpeakerNames = speakers,
                KnownInitGunks    = new List <string>
                {
                    "WOUND_CUT_SMALL",
                    "WOUND_CUT_LARGE",
                    "WOUND_GLASS",
                    "ULCER_SMALL",
                    "ULCER_LARGE",
                    "HEMORRHAGE",
                    "WOUND_STEEL_SMALL",
                },
                KnownIndexedGunks = new List <string>
                {
                    "STITCH_GEL_BANDAGE",
                    "SCALPEL",
                    "SPAWNER_HEMORRHAGE",
                    "BROKEN_RIBS",
                    "SUTURE",
                }
            }));

            var parseSettings = new ParserSettings()
            {
                KnownSpeakerNames = speakers
            };

            parser.Register(new OperationDefParser());
            parser.Register(new PatientDefParser());
            parser.Register(new CutSceneDefParser(parseSettings));
            parser.Register(new BriefingDefParser());
            parser.Register(new ActionChoiceDefParser());
            parser.Register(new ChoiceDefParser());
            parser.Register(new PreOpDefParser());
            parser.Register(new NewPatientDefParser(parseSettings));

            mScriptParser = parser;
        }
示例#11
0
 public WorkItemService(ILoggerFactory factory
                        , IScriptParser scriptParser
                        , IAgentService agentService
                        , IProcessService processService
                        , ISchedulerService resumptionService
                        , IEventBus bus)
 {
     this._log               = factory.Create(typeof(ProcessService));
     this._scriptParser      = scriptParser;
     this._agentService      = agentService;
     this._processService    = processService;
     this._resumptionService = resumptionService;
     this._bus               = bus;
 }
示例#12
0
        public void OnTestInit()
        {
            mParser = new HierarchicalScriptParser();

            mParser.Register(new LoveMinDefParser());
            mParser.Register(new CutSceneDefParser(new ParserSettings()
            {
                KnownSpeakerNames = new List <string>
                {
                    "DANTE",
                    "PROTAG"
                }
            }));
        }
示例#13
0
        /// <summary>
        /// Creates a new instance by parsing the provided script text.
        /// </summary>
        /// <param name="scriptName">Name of the script asset.</param>
        /// <param name="scriptText">The script text to parse.</param>
        /// <param name="errors">When an error occurs while parsing, will add it to the collection.</param>
        public static Script FromScriptText(string scriptName, string scriptText, ICollection <ScriptParseError> errors)
        {
            return(GetCachedParser().ParseText(scriptName, scriptText, errors));

            IScriptParser GetCachedParser()
            {
                if (cachedParser != null)
                {
                    return(cachedParser);
                }
                var typeName = Configuration.GetOrDefault <ScriptsConfiguration>().ScriptParser;

                cachedParser = Activator.CreateInstance(Type.GetType(typeName)) as IScriptParser;
                return(cachedParser);
            }
        }
示例#14
0
 public PythonScriptEngine(
     IScriptParser parser,
     IEnumerable <IGlobalProvider> globalProviders,
     IEventAggregator eventAggregator,
     IThreadTimingFactory threadTimingFactory,
     IPaths paths,
     ILog log,
     IFileSystem fileSystem)
 {
     this.parser              = parser;
     this.globalProviders     = globalProviders;
     this.eventAggregator     = eventAggregator;
     this.threadTimingFactory = threadTimingFactory;
     this.paths      = paths;
     this.log        = log;
     this.fileSystem = fileSystem;
 }
示例#15
0
        /// <summary>
        /// creates a new <see cref="ScriptCompiler"/>
        /// </summary>
        /// <param name="logger">access to logging</param>
        /// <param name="parser">parser used to parse scripts</param>
        /// <param name="cache">access to object cache</param>
        /// <param name="methodprovider">provides managed method hosts to scripts</param>
        /// <param name="scriptservice">used to load scripts if not found in cache</param>
        /// <param name="archive">archive used to load revisions</param>
        /// <param name="importservice">access to javascript imports</param>
        /// <param name="pythonservice">access to python script logic</param>
        /// <param name="luaservice">used to execute lua code</param>
        public ScriptCompiler(ILogger <ScriptCompiler> logger, IScriptParser parser, ICacheService cache, IMethodProviderService methodprovider, IScriptService scriptservice, IArchiveService archive, IScriptImportService importservice, IPythonService pythonservice, ILuaService luaservice)
        {
            this.parser        = parser;
            this.cache         = cache;
            this.scriptservice = scriptservice;
            this.archive       = archive;
            this.importservice = importservice;
            this.pythonservice = pythonservice;
            this.luaservice    = luaservice;
            this.logger        = logger;

            if (parser != null)
            {
                parser.Extensions.AddExtensions(typeof(Math));
                parser.Extensions.AddExtensions <ScriptEnumerations>();
                parser.ImportProvider = methodprovider;
            }

            ReactInitializer.Initialize();
        }
示例#16
0
        public ScriptsViewModel(UIServices uiServices, IScriptRunner scriptRunner,
                                IOperationProgress progress, IScriptDependencyResolver scriptDependencyResolver, IScriptParser parser, IDeploymentContext deploymentContext, IOperationContext operationContext)
        {
            this.uiServices               = uiServices;
            this.scriptRunner             = scriptRunner;
            this.scriptDependencyResolver = scriptDependencyResolver;
            this.parser            = parser;
            this.deploymentContext = deploymentContext;

            var canRun     = this.WhenAnyValue(x => x.SelectedScript).Select(s => s != null);
            var runCommand = ReactiveCommand.CreateFromTask(Run, canRun);

            RunCommand = new ProgressViewModel(runCommand, progress, this, this.uiServices.ContextDialog, operationContext);

            IsBusyObservable = Observable.Merge(RunCommand.Command.IsExecuting);

            Tree = GetTree(new DirectoryInfo(extraScriptsPath)).Children.ToList();

            MessageBus.Current.Listen <FolderNode>().Subscribe(x => SelectedScript = x);
        }
        public void GetTokensFromExpression()
        {
            Stub <IPluginInvoker>();

            IScriptParser parser = Get <PythonScriptParser>();

            TestTokens(parser,
                       Expression1,
                       Expression1.IndexOf('T'),
                       Expression1Result,
                       new Range(27, 4));

            TestTokens(parser,
                       Expression2,
                       Expression2.IndexOf('T'),
                       Expression2Result,
                       new Range(27, 4));

            TestTokens(parser,
                       Expression3,
                       Expression3.IndexOf('T'),
                       Expression3Result,
                       new Range(36, 2));
        }
示例#18
0
 public WoaDeployer(IScriptRunner scriptRunner, IScriptParser parser)
 {
     this.scriptRunner = scriptRunner;
     this.parser       = parser;
 }
 /// <summary>
 /// Initializes a new <see cref="PowerShellTestDiscoverer"/>.
 /// </summary>
 /// <param name="parser">The parser to use for scripts</param>
 /// <param name="logger">A message logger</param>
 internal PowerShellTestDiscoverer(IScriptParser parser, ILogger logger)
 {
     _parser = parser;
     _logger = logger;
 }
示例#20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScriptProjectProvider"/> class.
 /// </summary>
 /// <param name="commandRunner">The <see cref="ICommandRunner"/> that is responsible for executing the NuGet command.</param>
 /// <param name="scriptParser">The <see cref="IScriptParser"/> that is responsible for parsing NuGet references from script files.</param>
 public ScriptProjectProvider(ICommandRunner commandRunner, IScriptParser scriptParser)
 {
     this.commandRunner = commandRunner;
     this.scriptParser  = scriptParser;
 }
 /// <summary>
 /// creates a new <see cref="ResourceScriptMethodProvider"/>
 /// </summary>
 /// <param name="assembly">assembly from which to get script resources</param>
 /// <param name="parser">parser used to parse and compile scripts</param>
 public ResourceScriptMethodProvider(Assembly assembly, IScriptParser parser)
 {
     this.assembly = assembly;
     this.parser   = parser;
 }
 public HostVariableTests()
 {
     parser = new ScriptParser(new Variable("host", this));
 }
示例#23
0
 public CodeCompletionProvider(IScriptParser parser, IRuntimeInfoProvider infoProvider)
 {
     this.parser       = parser;
     this.infoProvider = infoProvider;
 }
 public void Setup()
 {
     parser = new ScriptParser();
     parser.Types.AddType <Disposable>();
 }
 /// <summary>
 /// creates a new <see cref="FileMethodProvider"/>
 /// </summary>
 /// <param name="scriptparser">parser used to parse and compile script code</param>
 public FileMethodProvider(IScriptParser scriptparser)
 {
     this.scriptparser = scriptparser;
 }
 /// <summary>
 /// creates a new <see cref="TokenExtractor"/>
 /// </summary>
 /// <param name="parser">parser to use to extract token</param>
 public TokenExtractor(IScriptParser parser)
 {
     this.parser = parser;
 }
 public ProjectSettings(IMigrationVersioning migrationVersioning, IScriptParser scriptParser, List <IScriptProvider> scriptProviders)
 {
     MigrationVersioning = migrationVersioning;
     ScriptProviders     = scriptProviders;
     ScriptParser        = scriptParser;
 }
示例#28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScriptProjectProvider"/> class.
 /// </summary>
 /// <param name="scriptParser">The <see cref="IScriptParser"/> that is responsible for parsing NuGet references from script files.</param>
 public ScriptProjectProvider(IScriptParser scriptParser, ILoggerFactory loggerFactory)
 {
     this.logger       = loggerFactory.CreateLogger <ScriptProjectProvider>();
     this.scriptParser = scriptParser;
 }
 /// <summary>
 /// creates a new <see cref="ScriptSenseService"/>
 /// </summary>
 /// <param name="logger">access to logging</param>
 /// <param name="parser">parser used to get script environment information</param>
 /// <param name="methodprovider">provider for installed host types</param>
 public ScriptSenseService(ILogger <ScriptSenseService> logger, IScriptParser parser, IMethodProviderService methodprovider)
 {
     this.logger         = logger;
     this.parser         = parser;
     this.methodprovider = methodprovider;
 }
示例#30
0
 public ScriptEnvironment(IScriptParser parser)
 {
     this.parser = parser;
 }
示例#31
0
 public PythonScriptEngine(IScriptParser parser, IEnumerable <IGlobalProvider> globalProviders, IEventAggregator eventAggregator)
 {
     this.parser          = parser;
     this.globalProviders = globalProviders;
     this.eventAggregator = eventAggregator;
 }
示例#32
0
 public void StartUp()
 {
     parser = new ScriptParser(new Variable("test", this));
 }
 public CodeCompletionProvider(IScriptParser parser, IRuntimeInfoProvider infoProvider)
 {
     this.parser = parser;
     this.infoProvider = infoProvider;
 }
示例#34
0
 public WorkItemService(ILoggerFactory factory
     , IScriptParser scriptParser
     , IAgentService agentService
     , IProcessService processService
     , ISchedulerService resumptionService
     , IEventBus bus)
 {
     this._log = factory.Create(typeof(ProcessService));
     this._scriptParser = scriptParser;
     this._agentService = agentService;
     this._processService = processService;
     this._resumptionService = resumptionService;
     this._bus = bus;
 }