Example #1
0
        public void TestPeekCharOffset(string text, char expected1, char expected2)
        {
            ZeroCopyReader reader = new ZeroCopyReader(text);

            Assert.That(expected1.EqualsSpans(reader.PeekCharSpan()));
            Assert.That(expected2.EqualsSpans(reader.PeekCharSpan(1)));
        }
Example #2
0
        public void TestPeekChar(string text, char expected)
        {
            ZeroCopyReader reader = new ZeroCopyReader(text);

            Assert.That(expected.EqualsSpans(reader.PeekCharSpan()));
            Assert.That(expected.EqualsSpans(reader.PeekCharSpan()));
            Assert.That(expected.EqualsSpans(reader.PeekCharSpan()));
        }
Example #3
0
        public void TestExpectChar(string text, char expectedChr, bool expected, char?peek)
        {
            ZeroCopyReader reader = new ZeroCopyReader(text);

            Assert.AreEqual(expected, reader.ReadCharIf(expectedChr));
            Assert.True(peek.EqualsSpans(reader.PeekCharSpan()));
        }
Example #4
0
        private void SkipComment()
        {
            while (_reader.IsNotEof)
            {
                while (_reader.IsNotEof &&
                       !_reader.SkipEol())
                {
                    _reader.Position += 1;
                }

                if (_reader.PeekCharSpan().IsEqual('#'))
                {
                    _reader.Position += 1;
                }
                else
                {
                    return;
                }
            }
        }