Exemple #1
0
        static void Main(string[] args)
        {
            GrammarAction.Init();
            LexAction.Init();
            IntermediateGenerator.Init();

            var  pcre = new PcreRegex("asdf");
            var  m    = pcre.Match("as", PcreMatchOptions.PartialSoft);
            bool b    = m.IsPartialMatch;

            if (args.Length < 1)
            {
                do
                {
                    if (args.Length > 0)
                    {
                        if (!SubCommandInvoker.TryInvokeSubcommand(args))
                        {
                            Console.WriteLine($"Unkown Redmond command '{args[0]}'");
                        }
                    }
                    args = Console.ReadLine().Split(' ');
                } while (args[0] != "");
            }
            else
            {
                if (!SubCommandInvoker.TryInvokeSubcommand(args))
                {
                    Console.WriteLine($"Unkown Redmond command '{args[0]}'");
                }
            }
        }
        public void CreateNew <U>() where U : new()
        {
            GrammarAction action  = (s, c) => c.CurrentObject = new U();
            var           grammar = new DoGrammar(action);

            _grammar.InsertBefore(grammar);
        }
 public void PerformAction(IStep step, GrammarAction action)
 {
     try
     {
         action(step, this);
     }
     catch (Exception ex)
     {
         IncrementExceptions();
         ResultsFor(step).CaptureException(ex.ToString());
     }
 }
 public void Before(GrammarAction action)
 {
     _befores.Add(action);
 }
        public static async Task <ICommandResult> Grammar(DiscordUserMessageContext context, GrammarAction command)
        {
            switch (command)
            {
            case GrammarAction.Enable:
                await context.Bot.Grammar.Start();

                break;

            case GrammarAction.Disable:
                await context.Bot.Grammar.Stop();

                break;

            default:
                return(new ErrorResult("Not an option"));
            }

            return(new SuccessResult());
        }
Exemple #6
0
 public SimpleGrammar(string text, GrammarAction action)
     : base(text)
 {
     _action = action;
 }
 public EmbeddedSectionGrammar <T> Before(GrammarAction action)
 {
     _before = action;
     return(this);
 }
 public SimpleGrammar(string text, GrammarAction action)
     : base(text)
 {
     _action = action;
 }
 public TableGrammar After(GrammarAction action)
 {
     _after = action;
     return this;
 }
Exemple #10
0
 public DoGrammar(GrammarAction action)
 {
     _action = action;
 }
Exemple #11
0
 /// <summary>
 /// Creates a simple Sentence grammar with no inputs that executes a GrammarAction lambda that
 /// allows you access to both the current IStep and the ITestContext
 /// </summary>
 /// <param name="text"></param>
 /// <param name="action"></param>
 /// <returns></returns>
 public static ActionGrammar Do(string text, GrammarAction action)
 {
     return(new ActionGrammar(text, action));
 }
Exemple #12
0
 public static DoGrammar Do(GrammarAction action)
 {
     return(new DoGrammar(action));
 }
Exemple #13
0
        // TODO: tests!
        public static DoGrammar CreateNewObject <T>() where T : new()
        {
            GrammarAction createObject = (step, context) => context.CurrentObject = new T();

            return(new DoGrammar(createObject));
        }
 public void Before(GrammarAction action)
 {
     _befores.Add(action);
 }
Exemple #15
0
        public virtual void PerformAction(IStep step, GrammarAction action)
        {
            Action continuation = () => action(step, this);

            performAction(step, continuation);
        }
Exemple #16
0
 public DoGrammar(GrammarAction action)
 {
     _action = action;
 }
Exemple #17
0
 public TableGrammar Before(GrammarAction action)
 {
     _before = action;
     return(this);
 }
 public TableGrammar Before(GrammarAction action)
 {
     _before = action;
     return this;
 }
Exemple #19
0
 public TableGrammar After(GrammarAction action)
 {
     _after = action;
     return(this);
 }