public void TestMultipleDefinedTerminalWithDifferentRegEx() { try { var configurator = new ParserConfigurator<string>(); configurator.CreateTerminal("abc", f => "abc"); configurator.CreateTerminal("abc", f => "ABC"); Assert.Fail("No exception for multiple definition of terminal with different regex"); } catch (ParserConfigurationException) { } }
public void TestMultipleDefinedTerminalWithDifferentRegEx() { try { var configurator = new ParserConfigurator <string>(); configurator.CreateTerminal("abc", f => "abc"); configurator.CreateTerminal("abc", f => "ABC"); Assert.Fail("No exception for multiple definition of terminal with different regex"); } catch (ParserConfigurationException) { } }
public void AndReturns(Func <string, object> func) { // Create the terminal now to ensure that the tokens will be created in the right order terminal = (Terminal <object>)configurator.CreateTerminal(regex, func); }
private ITerminal <object>[] ParamsToTerminalArray(object[] p) { return(p.OfType <string>().Select(f => configurator.CreateTerminal(Regex.Escape(f))) .Concat(p.OfType <FluentExpression>().Select(f => f.Terminal)).ToArray()); }