예제 #1
0
        public static Input ReadArguments(string[] args)
        {
            var input = new Input();

            input.options   = PersistentHashMap.EMPTY;
            input.functions = PersistentVector.EMPTY;

            var argString = string.Join(" ", args);
            var pbtr      = new PushbackTextReader(new StringReader(argString));

            for (;;)
            {
                try
                {
                    var o = ArgumentReader.read(pbtr, true, null, false, null);
                    if (o is Keyword)
                    {
                        var val = ArgumentReader.read(pbtr, true, null, false, null);
                        input.options = input.options.assoc(o, val);
                    }
                    else if (o is Symbol)
                    {
                        input.functions = (PersistentVector)input.functions.cons(o);
                    }
                }
                catch (EndOfStreamException)
                {
                    return(input);
                }
            }
        }
예제 #2
0
        public static ISeq ReadArguments(string[] args)
        {
            var list = PersistentVector.EMPTY;             //PersistentList.EmptyList(null);

            var argString = string.Join(" ", args);
            var pbtr      = new PushbackTextReader(new StringReader(argString));

            for (;;)
            {
                try
                {
                    list = (PersistentVector)list.cons(ArgumentReader.read(pbtr, true, null, false, null));
                }
                catch (EndOfStreamException)
                {
                    return(list.seq());
                }
            }
        }