private static void RecursivePrettyPrint(ISExpression x, int depth)
        {
            Console.Write(new String('\t', depth));

            if ((x.Type & Types.Atom) == Types.Atom)
            {
                if ((x.Type & Types.String) == Types.String)
                {
                    Console.WriteLine(String.Format("string: \"{0}\"", x.ToString()));
                }
                else if ((x.Type & Types.Symbol) == Types.Symbol)
                {
                    Console.WriteLine(String.Format("symbol: {0}", x.ToString()));
                }
                else if ((x.Type & Types.Number) == Types.Number)
                {
                    Console.WriteLine(String.Format("number: {0}", x.ToString()));
                }
            }
            else if ((x.Type & Types.List) == Types.List)
            {
                Console.WriteLine("list");
                SExprList list = x as SExprList;
                foreach (ISExpression y in list)
                {
                    SExpression.RecursivePrettyPrint(y, depth + 1);
                }
            }
        }
Exemple #2
0
 protected static void CheckNotIllegalSymbol(ISExpression expr)
 {
     if (CompilerConstants.IllegalVariables.Contains(expr))
     {
         throw new SchemeCompilerException("compiler", "name cannot be used as a variable", expr.ToString());
     }
 }