コード例 #1
0
        /// <summary>
        /// Advances the current position and returns the current character.
        /// </summary>
        public char NextChar(out bool wasCRLF)
        {
            Debug.Assert(ich >= 0);
            Debug.Assert(ich < text.Length);

            wasCRLF = false;
            char ch = PeekChar();

            ich    += 1;
            column += 1;
            if (Lexer.IsLineSeparator(ch))
            {
                column = 0;
                line  += 1;

                // carriage return followed by a line feed is considered one line break
                if (ch == '\xD' && ich < text.Length && PeekChar() == '\xA')
                {
                    ich    += 1;
                    wasCRLF = true;
                }
            }

            Debug.Assert(ich <= text.Length);

            return(ch);
        }
コード例 #2
0
 /// <summary>
 /// Returns whether a character is a C# line separator.
 /// </summary>
 public static bool IsLineSeparator(char ch)
 {
     return(Lexer.IsLineSeparator(ch));
 }
コード例 #3
0
 private bool IsLineSeparator(char ch)
 {
     return(Lexer.IsLineSeparator(ch));
 }