public void Parse(Stream s)
        {
            TrigraphStream stream = new TrigraphStream(s, trigraphs, digraphs);

            this.Scanner = new C_CPLUSPLUS_CSHARPScanner(stream, trigraphs, digraphs);
            this.Parse();
        }
Exemplo n.º 2
0
        public void TestTrigraphStreamNewlines7()
        {
            // test broken line endings (linux file opened on old mac.)
            String code = "s\r\n\na";
            char   ch;

            MemoryStream   ms = new MemoryStream(Encoding.ASCII.GetBytes(code));
            TrigraphStream ts = new TrigraphStream(ms);

            IEnumerable <char> enumerable = ts.GetCharEnumerable();
            IEnumerator <char> i          = enumerable.GetEnumerator();

            i.MoveNext();
            ch = i.Current;

            Assert.AreEqual(ch, 's');

            i.MoveNext();
            ch = i.Current;

            Assert.AreEqual(ch, '\n');

            i.MoveNext();
            ch = i.Current;

            Assert.AreEqual(ch, '\n');

            i.MoveNext();
            ch = i.Current;

            Assert.AreEqual(ch, 'a');
        }
Exemplo n.º 3
0
        public void TestTrigraphStreamNewlines()
        {
            // test Windows/Mac OSX line endings.
            String code = "s\r\na";
            char   ch;

            MemoryStream   ms = new MemoryStream(Encoding.ASCII.GetBytes(code));
            TrigraphStream ts = new TrigraphStream(ms);

            IEnumerable <char> enumerable = ts.GetCharEnumerable();
            IEnumerator <char> i          = enumerable.GetEnumerator();

            i.MoveNext();
            ch = i.Current;

            Assert.AreEqual(ch, 's');

            i.MoveNext();
            ch = i.Current;

            Assert.AreEqual(ch, '\n');

            i.MoveNext();
            ch = i.Current;

            Assert.AreEqual(ch, 'a');
        }
        public void Parse(string s)
        {
            byte[]         inputBuffer = System.Text.Encoding.Default.GetBytes(s);
            MemoryStream   str         = new MemoryStream(inputBuffer);
            TrigraphStream stream      = new TrigraphStream(str, trigraphs, digraphs);

            this.Scanner = new C_CPLUSPLUS_CSHARPScanner(stream, trigraphs, digraphs);
            this.Parse();
        }