private Token PeekToken(int depth = 0) { Debug.Assert(depth >= 0); // depth can not be negative return(depth == 0 ? TokensToProcess.Peek() // for 0 depth take crrent context : TokensProcessed.Skip(depth - 1).First()); // otherwise dig through processed tokens }
private Token PeekToken(int depth = 0) { if (depth < 0) { throw new ArgumentOutOfRangeException("depth", "Depth can not be negative, surprisingly."); } return(depth == 0 ? TokensToProcess.Peek() // for 0 depth take crrent context : TokensProcessed.Skip(depth - 1).First()); // otherwise dig through processed tokens }
private ParseState PeekContext(int depth = 0) { if (depth < 0) { throw new ArgumentOutOfRangeException("depth", "Depth can not be negative, surprisingly."); } return(depth == 0 ? TokensToProcess.Peek().Context // for 0 depth take crrent context : TokensProcessed.Skip(depth - 1).Take(1).Single().Context); // otherwise dig through processed tokens }
private string PeekRawValue() // to be displayed in error messages, e.g. instead of converted 0.1 gets raw .1 { return(TokensToProcess.Peek().RawValue); }
private object PeekValue() { return(TokensToProcess.Peek().Value); }
private TokenType PeekType() { return(TokensToProcess.Peek().Type); }