コード例 #1
0
        public static bool AreEqualIgnoreEol(BufferT left, BufferT right)
        {
            if (ReferenceEquals(left, right))
            {
                return(true);
            }
            else if (left == null)
            {
                return(false);
            }
            else if (right == null)
            {
                return(false);
            }

            ReadIteratorT l = left.getReadIterator();
            ReadIteratorT r = right.getReadIterator();

            while (l.isData() && r.isData())
            {
                // \r\n == \n
                if (l.getChar() == '\r' && r.getChar() == '\n')
                {
                    l.inc();
                    if (!l.isData() || l.getChar() != '\n')
                    {
                        return(false);
                    }
                }
                // \n == \r\n
                else if (l.getChar() == '\n' && r.getChar() == '\r')
                {
                    r.inc();
                    if (!r.isData() || r.getChar() != '\n')
                    {
                        return(false);
                    }
                }
                else if (l.getChar() != r.getChar())
                {
                    return(false);
                }

                l.inc();
                r.inc();
            }

            return(!l.isData() && !r.isData());
        }
コード例 #2
0
        public void parseString(out string s)
        {
            StringBuilder sb = new StringBuilder();

            while (riter.isData() && riter.getChar() != '\0')
            {
                sb.Append(riter.getChar());
                riter.inc();
            }
            if (!riter.isData())
            {
                throw new Exception();                 // TODO
            }
            riter.inc();

            s = sb.ToString();
        }
コード例 #3
0
 public void skipSpacesEtc()
 {
     while (riter.isData() && (riter.getChar() == ' ' || riter.getChar() == '\t' || riter.getChar() == '\r' || riter.getChar() == '\n'))
     {
         riter.inc();
     }
 }