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()); }
public SimpleGrammar(string text, GrammarAction action) : base(text) { _action = action; }
public EmbeddedSectionGrammar <T> Before(GrammarAction action) { _before = action; return(this); }
public TableGrammar After(GrammarAction action) { _after = action; return this; }
public DoGrammar(GrammarAction action) { _action = action; }
/// <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)); }
public static DoGrammar Do(GrammarAction action) { return(new DoGrammar(action)); }
// TODO: tests! public static DoGrammar CreateNewObject <T>() where T : new() { GrammarAction createObject = (step, context) => context.CurrentObject = new T(); return(new DoGrammar(createObject)); }
public virtual void PerformAction(IStep step, GrammarAction action) { Action continuation = () => action(step, this); performAction(step, continuation); }
public TableGrammar Before(GrammarAction action) { _before = action; return(this); }
public TableGrammar Before(GrammarAction action) { _before = action; return this; }
public TableGrammar After(GrammarAction action) { _after = action; return(this); }