Ancestry.QueryProcessor.Parse.Tokenizer.SkipComments C# (CSharp) Method

SkipComments() public method

Skips all comments and whitepace.
public SkipComments ( ) : void
return void
        public void SkipComments()
        {
            SkipWhiteSpace();
            while (!PeekEOF) // There is only the possibility of a comment if there are at least two characters
            {
                if (SkipLineComments())
                    continue;

                // Skip block comments
                if ((_next == '/') && !PeekEOF && (Peek == '*'))
                {
                    Advance();
                    Advance();
                    int blockCommentDepth = 1;
                    while (blockCommentDepth > 0)
                    {
                        if (SkipLineComments())		// Line comments may be \\* block delimiters, so ignore them inside block comments
                            continue;
                        if (PeekEOF)
                            throw new LexerException(LexerException.Codes.UnterminatedComment);
                        Char peek = Peek;
                        bool peekEOF = PeekEOF;
                        if ((_next == '/') && !peekEOF && (peek == '*'))
                        {
                            blockCommentDepth++;
                            Advance();
                        }
                        else if ((_next == '*') && !peekEOF && (peek == '/'))
                        {
                            blockCommentDepth--;
                            Advance();
                        }
                        Advance();
                    }
                    SkipWhiteSpace();
                    continue;
                }
                break;
            }
        }