Esempio n. 1
0
        public static Parser <IEnumerable <IAction> > 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.String("  ").Or(Parse.String("\t")).Repeat(indentLevel)
                  from __ in Parse.String("* ")
                  from action in ActionParser.GetParser(indentLevel, audioService, delayService, speechService).Token(HorizontalWhitespaceParser.Parser)
                  select action).DelimitedBy(NewLineParser.Parser));
        }
Esempio n. 2
0
        public static Parser <IEnumerable <IAction> > 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.String("  ").Or(Parse.String("\t")).Repeat(indentLevel)
                  from __ in Parse.String("* ")
                  from action in ActionParser.GetParser(indentLevel, audioService, delayService, loggerService, speechService).Token(HorizontalWhitespaceParser.Parser)
                  select action).DelimitedBy(NewLineParser.Parser));
        }