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

            tokenWriter.WritePrimitiveValue(value);
            return(writer.ToString());
        }
Example #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))));
        }
Example #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)));
        }
Example #4
0
 public string ConvertConstantValue(object constantValue)
 {
     return(TextWriterTokenWriter.PrintPrimitiveValue(constantValue));
 }