Exemplo n.º 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
        }
Exemplo n.º 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
        }
Exemplo n.º 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
        }
Exemplo n.º 4
0
 private string PeekRawValue() // to be displayed in error messages, e.g. instead of converted 0.1 gets raw .1
 {
     return(TokensToProcess.Peek().RawValue);
 }
Exemplo n.º 5
0
 private object PeekValue()
 {
     return(TokensToProcess.Peek().Value);
 }
Exemplo n.º 6
0
 private TokenType PeekType()
 {
     return(TokensToProcess.Peek().Type);
 }