private static IParserResult <T, Token> ParseEoF <T>(Parser <T, Token> parser, LexemeString <Token> lexemes) { var result = parser(lexemes); if (!result.IsSuccessful) { return(result); } if (result.RemainingLexemes.Length > 1) { var remaining = result.RemainingLexemes[0] + (result.RemainingLexemes.Length > 1 ? " " + result.RemainingLexemes[1] : ""); return(ParserResult.Error <T, Token>("Error matching " + remaining + " found " + result.Result, result.RemainingLexemes)); } return(result); }