public void Not_Success_ReturnsError() { var parser = Parse.Not(Chars.Any()); var result = parser.Parse("xyz"); ParseAssert.ErrorEquals("Unexpected \"x\"", result); }
public void Not_Error_ReturnsSuccess() { var parser = Parse.Not(Chars.String("xyz")); var result = parser.Parse("x"); ParseAssert.ValueEquals(Unit.Instance, result); }
/// <summary> /// Only succeeds when the second parser fails. Returns the result of the first parser. /// </summary> public static IParser <TValueA> NotFollowedBy <TValueA, TValueB>(this IParser <TValueA> parserA, IParser <TValueB> parserB) { return(from a in parserA from b in Parse.Not(parserB) select a); }