예제 #1
0
        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
        }
예제 #2
0
        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
        }
예제 #3
0
        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
        }
예제 #4
0
 private void ReadToken()
 {
     TokensProcessed.Push(TokensToProcess.Pop());
 }