public Reply <Token> Parse(TokenStream tokens) { if (tokens.Current.Literal == expectation) { return(new Parsed <Token>(tokens.Current, tokens.Advance())); } return(new Error <Token>(tokens, ErrorMessage.Expected(expectation))); }
public Reply <Token> Parse(TokenStream tokens) { if (tokens.Current.Kind == kind) { return(new Parsed <Token>(tokens.Current, tokens.Advance())); } return(new Error <Token>(tokens, ErrorMessage.Expected(kind.Name))); }
public LabeledParser(Parser <T> parser, string expectation) { this.parser = parser; errors = ErrorMessageList.Empty.With(ErrorMessage.Expected(expectation)); }