protected object Expect(ParseRule rule, string message = null, ParseRule recoveryRule = null) { object result = ParseObject(rule); if (result == null) { if (message == null) { message = rule.GetMethodInfo().Name; } string butSaw; string lineRemainder = LineRemainder(); if (lineRemainder == null || lineRemainder.Length == 0) { butSaw = "end of line"; } else { butSaw = "'" + lineRemainder + "'"; } Error("Expected " + message + " but saw " + butSaw); if (recoveryRule != null) { result = recoveryRule(); } } return(result); }