Exemple #1
0
            public int ReadPage(int bufferLength, out Lexeme <TToken>[] lexemesBuffer, out int[] operandsBuffer)
            {
                RentBuffers(bufferLength, out var localLexemesBuffer, out var localOperandsBuffer);

                lexemesBuffer  = localLexemesBuffer;
                operandsBuffer = localOperandsBuffer;

                return(_lexemeSource.Read(localLexemesBuffer, localOperandsBuffer, 0, bufferLength, true));
            }
Exemple #2
0
        public bool MoveNext()
        {
            _pointer++;

            if (_pointer == _bufferSize)
            {
                if (_bufferSize < BufferSize)
                {
                    Current = default;

                    return(false);
                }

                _pointer = 0;

                for (var i = 0; i < BufferSize; i++)
                {
                    _lexemeBuffer[i] = new Lexeme <TToken>();
                }

                _bufferSize = _lexemeSource.Read(_lexemeBuffer, _operandBuffer, 0, BufferSize, true);

                if (_bufferSize == 0)
                {
                    Current = default;

                    return(false);
                }
            }

            Current = _lexemeBuffer[_pointer];

            return(true);
        }