Peek() 공개 메소드

public Peek ( ) : int
리턴 int
        static void NextCh()
        {
            if (oldEols > 0)
            {
                ch = EOL;
                oldEols--;
            }

            else
            {
                ch = (char)Buffer.Read();
                pos++;

                // replace isolated '\r' by '\n' in order to make

                // eol handling uniform across Windows, Unix and Mac

                if (ch == '\r' && Buffer.Peek() != '\n')
                {
                    ch = EOL;
                }

                else if (ch > '\u007f')
                {
                    ch = '?';
                }

                if (ch == EOL)
                {
                    line++;
                    lineStart = pos + 1;
                }
            }
        }
예제 #2
0
 void NextCh()
 {
     if (oldEols > 0)
     {
         ch = EOL; oldEols--;
     }
     else
     {
         pos = buffer.Pos;
         ch  = buffer.Read(); col++;
         // replace isolated '\r' by '\n' in order to make
         // eol handling uniform across Windows, Unix and Mac
         if (ch == '\r' && buffer.Peek() != '\n')
         {
             ch = EOL;
         }
         if (ch == EOL)
         {
             line++; col = 0;
         }
     }
 }
예제 #3
0
        /// <summary>
        /// Buffer helper, scans the buffer for line starts
        /// </summary>
        /// <param name="buffer">Buffer of the atg file</param>
        public BufferHelper(Buffer buffer)
        {
            this.buffer = buffer;
            int oldPos = buffer.Pos;

            buffer.Pos = 0;
            int ch;

            linePosition.Add(buffer.Pos);
            while ((ch = buffer.Read()) != Buffer.EOF)
            {
                if (ch == '\r' && buffer.Peek() != '\n')
                {
                    ch = '\n';
                }
                if (ch == '\n')
                {
                    linePosition.Add(buffer.Pos + 1);
                }
            }

            buffer.Pos = oldPos;
        }
예제 #4
0
 void NextCh()
 {
     if (oldEols > 0)
     {
         ch = EOL; oldEols--;
     }
     else
     {
         pos = buffer.Pos;
         // buffer reads unicode chars, if UTF8 has been detected
         ch = buffer.Read(); col++; charPos++;
         // replace isolated '\r' by '\n' in order to make
         // eol handling uniform across Windows, Unix and Mac
         if (ch == '\r' && buffer.Peek() != '\n')
         {
             ch = EOL;
         }
         if (ch == EOL)
         {
             line++; col = 0;
         }
     }
     //if (pos <= 10) Console.Write("{0:X} ", ch);
 }