示例#1
0
        public static string PrintPrimitiveValue(object value)
        {
            TextWriter            writer      = new StringWriter();
            TextWriterTokenWriter tokenWriter = new TextWriterTokenWriter(writer);

            tokenWriter.WritePrimitiveValue(value);
            return(writer.ToString());
        }
示例#2
0
        public static TokenWriter CreateWriterThatSetsLocationsInAST(TextWriter writer, string indentation = "\t")
        {
            var target = new TextWriterTokenWriter(writer)
            {
                IndentationString = indentation
            };

            return(new InsertSpecialsDecorator(new InsertRequiredSpacesDecorator(new InsertMissingTokensDecorator(target, target))));
        }
示例#3
0
        public static TokenWriter Create(TextWriter writer, string indentation = "\t")
        {
            TokenWriter textwriter;

            if (writer != null)
            {
                textwriter = new TextWriterTokenWriter(writer)
                {
                    IndentationString = indentation
                };
            }
            else
            {
                textwriter = new NullWriterTokenWriter();
            }

            return(new InsertSpecialsDecorator(new InsertRequiredSpacesDecorator(textwriter)));
        }
示例#4
0
 public string ConvertConstantValue(object constantValue)
 {
     return(TextWriterTokenWriter.PrintPrimitiveValue(constantValue));
 }