예제 #1
0
        private void read_from_buffer()
        {
            var chunk  = new byte[4096];
            var buffer = new List <byte>();

            while (running)
            {
                stream.Read(chunk, 0, 4096);
                buffer.AddRange(chunk);
                var length = 0;
                do
                {
                    length = parser.Check(buffer.ToArray());
                    if (length > 0)
                    {
                        var objdata = buffer.GetRange(0, length).ToArray();
                        int index;
                        var obj = parser.Parse(objdata, out index);
                        lock (queue)
                            queue.Enqueue(obj, index);
                        buffer.RemoveRange(0, length);
                    }
                } while (length > 0);
            }
        }
예제 #2
0
 public bool Compile()
 {
     _lexer.Analyze();
     return(_parser.Check());
 }