/// <summary> /// Consume a token from the start of the list, returning a result with the token and remainder. /// </summary> /// <returns></returns> public TokenListParserResult <TKind, Token <TKind> > ConsumeToken() { EnsureHasValue(); if (IsAtEnd) { return(TokenListParserResult.Empty <TKind, Token <TKind> >(this)); } var token = _tokens ![Position];
/// <summary> /// Consume a token from the start of the list, returning a result with the token and remainder. /// </summary> /// <returns></returns> public TokenListParserResult <TKind, Token <TKind> > ConsumeToken() { EnsureHasValue(); if (IsAtEnd) { return(TokenListParserResult.Empty <TKind, Token <TKind> >(this)); } var token = _tokens[Position]; return(TokenListParserResult.Value(token, this, new TokenList <TKind>(_tokens, Position + 1))); }