/// <summary> /// Accepts the token from. /// </summary> /// <typeparam name="TResult">The type of the result.</typeparam> /// <param name="possibleTokens">The possible tokens.</param> /// <param name="ignoreWhitespace">if set to <c>true</c> white space will be TVoidd.</param> /// <param name="result">The result.</param> /// <returns> /// <c>true</c> if the token was accepted, otherwise <c>false</c>. /// </returns> public bool AcceptTokenFrom <TResult>( ILexemeRegistry <TResult> possibleTokens, bool ignoreWhitespace, out TResult result) { var ignoredWhiteSpace = this.TryIgnoreWhitespace(ignoreWhitespace, this.Current); if (possibleTokens.TryGet(this.Current.Token, out result)) { this.MoveToNext(); return(true); } if (ignoredWhiteSpace) { this.MoveToPrevious(); } return(false); }
/// <summary> /// Accepts the token from a registry. /// </summary> /// <typeparam name="TResult">The type of the result.</typeparam> /// <param name="possibleTokens">The possible tokens.</param> /// <param name="result">The result.</param> /// <returns><c>true</c> if the specified lexeme registry contains the token, otherwise <c>false</c>.</returns> public bool AcceptTokenFrom <TResult>(ILexemeRegistry <TResult> possibleTokens, out TResult result) { return(this.AcceptTokenFrom(possibleTokens, true, out result)); }