Exemplo n.º 1
0
        private static MalList ReadReaderMacro(string macro, Reader reader, int argumentCount = 1)
        {
            reader.Next(); // Drop the reader macro token
            var list = new MalList();

            list.Add(new MalAtom(macro));
            Enumerable.Range(0, argumentCount)
            .Select(x => ReadForm(reader))
            .Reverse()     // The one reader macro that has more than 1 argument, reverses its arguments.
            .ForEach(form => list.Add(form));

            return(list);
        }
Exemplo n.º 2
0
 private static MalList ReadList(Reader reader, string close, MalList list)
 {
     reader.Next(); // Swallow the brace
     while (reader.Peek() != close)
     {
         list.Add(ReadForm(reader));
     }
     reader.Next(); // Swallow the brace
     return(list);
 }