Exemplo n.º 1
0
        public void AddNode(object node)
        {
            object value = node;

            while (lists.Peek().Item2.Count > 0)
            {
                switch (lists.Peek().Item2.Pop())
                {
                    case QuoteType.Quote:
                        value = new QuoteNode(value);
                        break;

                    case QuoteType.Backquote:
                        value = new BackquoteNode(value);
                        break;

                    case QuoteType.Unquote:
                        value = new UnquoteNode(value);
                        break;

                    case QuoteType.Splice:
                        value = new SpliceNode(value);
                        break;
                }
            }

            lists.Peek().Item1.Add(value);
        }
Exemplo n.º 2
0
 private void PrettyPrintSub(UnquoteNode node)
 {
     stringWriter.Write("~");
     PrettyPrint(node.InnerValue);
 }
Exemplo n.º 3
0
        public object ExpandUnquote(UnquoteNode node, int backquoteDepth, Environment environment)
        {
            if (backquoteDepth < 1)
            {
                throw new ArgumentException("Unquote appeared outside of backquote!");
            }

            return evaluator.Evaluate(Expand(node.InnerValue, backquoteDepth - 1, environment), environment);
        }