Esempio n. 1
0
        static public Object[] read_vector(TextReader str)
        {
            ArrayList vec = new ArrayList();

            object token = null;

            while (!right_paren_token.Equals(token))
            {
                token = read_token(str);
                if (token == null)
                {
                    throw new Exception("Error parsing vector: #" + Util.Dump(vec).TrimEnd(new char[] { ')' }).Substring(10));
                }
                // a continuation would be handy here // also, the magic # 10 is to take off the ArrayList: at the beginning of the dump
                if (right_paren_token.Equals(token))
                {
                    return(vec.ToArray());
                }
                else if (left_paren_token.Equals(token))
                {
                    vec.Add(read_list(null, str));
                }
                else if (start_vector_token.Equals(token))
                {
                    vec.Add(read_vector(str));
                }
                else
                {
                    vec.Add(token);
                }
            }
            return(null);            // thisshouldneverhappen
        }
Esempio n. 2
0
        static public object read(TextReader str)
        {
            object next_token = read_token(str);

            if (left_paren_token.Equals(next_token))
            {
//              if (str is DocumentReader)
//              {
//                  DocumentReader documentReader = (DocumentReader) str;
//                  //EditPoint startEditPoint = documentReader.editPoint.CreateEditPoint();
//                  int startEditPointLine = documentReader.Line;
//                  int startEditPointCol = documentReader.Col;// - 1;
//                  //startEditPoint.CharLeft(1);

//                  Pair result = read_list(null, str);

// //                   if (result != null)
// //                       result.marker = new Marker(documentReader.document, startEditPointLine, startEditPointCol, documentReader.Line, documentReader.Col + 1, "");//startEditPoint.GetText(documentReader.editPoint));

//                  return result;
//              }
//              else
                return(read_list(null, str));
            }
            if (start_vector_token.Equals(next_token))
            {
                return(read_vector(str));
            }
            else
            {
                return(next_token);
            }
        }