Exemple #1
0
        public override ReaderMacroStep NextStep()
        {
            Cons   head = null;
            object tail = null;

            Readtable currentReadtable = CL.Readtable;

            while (true)
            {
                int  xx;
                char x;
                // Discard whitespace
                do
                {
                    xx = this.context.InputStream.Peek();
                    if (xx == -1)
                    {
                        throw new NotImplementedException();
                    }
                    else
                    {
                        x = (char)xx;
                    }
                }while (currentReadtable.IsWhitespaceSyntax(x) && (this.context.InputStream.Read() != -1));
                if (x == ')')
                {
                    this.context.InputStream.Read();  // discard the close paren
                    return((CL.ReadSuppress == true)
                    ? new FinalReaderMacroStep()
                    : new FinalReaderMacroStep(CL.Reconc(head, tail)));
                }
                //else if (x == '.') {
                //    throw new NotImplementedException ();
                //}
                else
                {
                    object next = CL.Read(this.context.InputStream, true, null, true);  // recursive read
                    if (CL.ReadSuppress != true)
                    {
                        head = CL.Cons(next, head);
                    }
                }
            }
        }
Exemple #2
0
 public static ConsCollection <T> Append <T> (System.Collections.Generic.IList <T> left, ConsCollection <T> right)
 {
     return(CL.Reconc <T> (CL.Reverse <T> (left), right));
 }
Exemple #3
0
 // Append
 public static object Append(object left, object right)
 {
     return(CL.Reconc(CL.Reverse(left), right));
 }
Exemple #4
0
 static public object Reverse(object list)
 {
     return(CL.Reconc(list, null));
 }
Exemple #5
0
 static public ConsCollection <T> Reverse <T> (System.Collections.Generic.IList <T> list)
 {
     return(CL.Reconc <T> (list, null));
 }
Exemple #6
0
 static public Cons Reverse(Cons list)
 {
     return((Cons)CL.Reconc(list, null));
 }