Exemplo n.º 1
0
        public static Parser <DoNotAwaitAction> GetParser(
            int indentLevel,
            IAudioService audioService,
            IDelayService delayService,
            ILoggerService loggerService,
            ISpeechService speechService)
        {
            if (indentLevel < 0)
            {
                throw new ArgumentException("indentLevel must be greater than or equal to 0.", "indentLevel");
            }

            audioService.AssertNotNull(nameof(audioService));
            delayService.AssertNotNull(nameof(delayService));
            loggerService.AssertNotNull(nameof(loggerService));
            speechService.AssertNotNull(nameof(speechService));

            return
                (from _ in Parse.IgnoreCase("don't")
                 from __ in HorizontalWhitespaceParser.Parser.AtLeastOnce()
                 from ___ in Parse.IgnoreCase("wait:")
                 from ____ in VerticalSeparationParser.Parser.AtLeastOnce()
                 from actions in ActionListParser.GetParser(indentLevel + 1, audioService, delayService, loggerService, speechService)
                 let child = new SequenceAction(actions)
                             select new DoNotAwaitAction(
                     loggerService,
                     child));
        }
Exemplo n.º 2
0
 // parses a typed event matcher. e.g. "before set: ..." or "after rep: ..."
 // returns a matcher with action, where all specified actions are enclosed in a single sequence action
 private static Parser <MatcherWithAction> GetTypedEventMatcherWithActionParser <T>(
     Parser <Unit> nameParser,
     IAudioService audioService,
     IDelayService delayService,
     ISpeechService speechService)
     where T : IEvent =>
 from _ in Parse.String("*")
 from __ in HorizontalWhitespaceParser.Parser.AtLeastOnce()
 from ___ in nameParser
 from ____ in Parse.Char(':').Token(HorizontalWhitespaceParser.Parser)
 from _____ in NewLineParser.Parser
 from actions in ActionListParser.GetParser(1, audioService, delayService, speechService)
 let action = new SequenceAction(actions)
              select new MatcherWithAction(new TypedEventMatcher <T>(), action);
Exemplo n.º 3
0
        public static Parser <ParallelAction> GetParser(
            int indentLevel,
            IAudioService audioService,
            IDelayService delayService,
            ISpeechService speechService)
        {
            Ensure.ArgumentCondition(indentLevel >= 0, "indentLevel must be greater than or equal to 0.", "indentLevel");
            Ensure.ArgumentNotNull(audioService, nameof(audioService));
            Ensure.ArgumentNotNull(delayService, nameof(delayService));
            Ensure.ArgumentNotNull(speechService, nameof(speechService));

            return
                (from _ in Parse.IgnoreCase("parallel:")
                 from __ in VerticalSeparationParser.Parser.AtLeastOnce()
                 from actions in ActionListParser.GetParser(indentLevel + 1, audioService, delayService, speechService)
                 select new ParallelAction(actions));
        }
Exemplo n.º 4
0
 // parses a typed event matcher. e.g. "before set 3: ..." or "after reps first+1..last: ..."
 // returns a matcher with action, where all specified actions are enclosed in a single sequence action
 private static Parser <MatcherWithAction> GetNumberedEventMatcherWithActionParser <T>(
     Parser <Unit> nameParser,
     Func <ExecutionContext, int> getActual,
     Func <ExecutionContext, int> getFirst,
     Func <ExecutionContext, int> getLast,
     IAudioService audioService,
     IDelayService delayService,
     ISpeechService speechService)
     where T : NumberedEvent =>
 from _ in Parse.String("*")
 from __ in HorizontalWhitespaceParser.Parser.AtLeastOnce()
 from ___ in nameParser
 from ____ in HorizontalWhitespaceParser.Parser.AtLeastOnce()
 from numericalConstraint in NumericalConstraintParser.GetParser(getActual, getFirst, getLast)
 from _____ in Parse.String(":").Token(HorizontalWhitespaceParser.Parser)
 from ______ in NewLineParser.Parser
 from actions in ActionListParser.GetParser(1, audioService, delayService, speechService)
 let action = new SequenceAction(actions)
              select new MatcherWithAction(new NumberedEventMatcher <T>(e => numericalConstraint(e.ExecutionContext)), action);
        public static Parser <DoNotAwaitAction> GetParser(
            int indentLevel,
            IAudioService audioService,
            IDelayService delayService,
            ISpeechService speechService)
        {
            Ensure.ArgumentCondition(indentLevel >= 0, "indentLevel must be greater than or equal to 0.", "indentLevel");
            Ensure.ArgumentNotNull(audioService, nameof(audioService));
            Ensure.ArgumentNotNull(delayService, nameof(delayService));
            Ensure.ArgumentNotNull(speechService, nameof(speechService));

            return
                (from _ in Parse.IgnoreCase("don't")
                 from __ in HorizontalWhitespaceParser.Parser.AtLeastOnce()
                 from ___ in Parse.IgnoreCase("wait:")
                 from ____ in VerticalSeparationParser.Parser.AtLeastOnce()
                 from actions in ActionListParser.GetParser(indentLevel + 1, audioService, delayService, speechService)
                 let child = new SequenceAction(actions)
                             select new DoNotAwaitAction(
                     child));
        }
        public static Parser <ParallelAction> GetParser(
            int indentLevel,
            IAudioService audioService,
            IDelayService delayService,
            ILoggerService loggerService,
            ISpeechService speechService)
        {
            if (indentLevel < 0)
            {
                throw new ArgumentException("indentLevel must be greater than or equal to 0.", "indentLevel");
            }

            audioService.AssertNotNull(nameof(audioService));
            delayService.AssertNotNull(nameof(delayService));
            loggerService.AssertNotNull(nameof(loggerService));
            speechService.AssertNotNull(nameof(speechService));

            return
                (from _ in Parse.IgnoreCase("parallel:")
                 from __ in VerticalSeparationParser.Parser.AtLeastOnce()
                 from actions in ActionListParser.GetParser(indentLevel + 1, audioService, delayService, loggerService, speechService)
                 select new ParallelAction(actions));
        }