예제 #1
0
파일: Script.cs 프로젝트: qhta/NRefactory
        protected NodeOutput OutputNode(int indentLevel, AstNode node, bool startWithNewLine = false)
        {
            var stringWriter = new StringWriter();
            var formatter    = new SegmentTrackingOutputFormatter(stringWriter);

            formatter.Indentation       = indentLevel;
            formatter.IndentationString = Options.TabsToSpaces ? new string (' ', Options.IndentSize) : "\t";
            stringWriter.NewLine        = Options.EolMarker;
            if (startWithNewLine)
            {
                formatter.NewLine();
            }
            var visitor = new CSharpOutputVisitor(formatter, formattingOptions);

            node.AcceptVisitor(visitor);
            string text = stringWriter.ToString().TrimEnd();

            return(new NodeOutput(text, formatter.NewSegments));
        }
예제 #2
0
        protected NodeOutput OutputNode(int indentLevel, AstNode node, bool startWithNewLine = false)
        {
            var stringWriter = new StringWriter();
            var formatter    = new SegmentTrackingOutputFormatter(stringWriter);

            formatter.Indentation = indentLevel;
            stringWriter.NewLine  = eolMarker;
            if (startWithNewLine)
            {
                formatter.NewLine();
            }
            var visitor = new CSharpOutputVisitor(formatter, formattingOptions);

            node.AcceptVisitor(visitor);
            string text = stringWriter.ToString().TrimEnd();

            if (node is FieldDeclaration)
            {
                text += eolMarker;
            }
            return(new NodeOutput(text, formatter.NewSegments));
        }
예제 #3
0
        protected NodeOutput OutputNode(int indentLevel, AstNode node, bool startWithNewLine = false)
        {
            var result       = new NodeOutput();
            var stringWriter = new StringWriter();
            var formatter    = new SegmentTrackingOutputFormatter(result, stringWriter);

            formatter.Indentation = indentLevel;
            stringWriter.NewLine  = Context.EolMarker;
            if (startWithNewLine)
            {
                formatter.NewLine();
            }
            var visitor = new CppOutputVisitor(formatter, Context.FormattingOptions);

            node.AcceptVisitor(visitor, null);
            result.Text = stringWriter.ToString().TrimEnd();
            if (node is FieldDeclaration)
            {
                result.Text += Context.EolMarker;
            }

            return(result);
        }
예제 #4
0
파일: Script.cs 프로젝트: riviti/NRefactory
        protected NodeOutput OutputNode(int indentLevel, AstNode node, bool startWithNewLine = false)
        {
            var stringWriter = new StringWriter ();
            var formatter = new SegmentTrackingOutputFormatter (stringWriter);
            formatter.Indentation = indentLevel;
            formatter.IndentationString = Options.TabsToSpaces ? new string (' ', Options.IndentSize) : "\t";
            stringWriter.NewLine = Options.EolMarker;
            if (startWithNewLine)
                formatter.NewLine ();
            var visitor = new CSharpOutputVisitor (formatter, formattingOptions);
            node.AcceptVisitor (visitor);
            string text = stringWriter.ToString().TrimEnd();

            return new NodeOutput(text, formatter.NewSegments);
        }
예제 #5
0
파일: Script.cs 프로젝트: Netring/ILSpy
		protected NodeOutput OutputNode (int indentLevel, AstNode node, bool startWithNewLine = false)
		{
			var result = new NodeOutput ();
			var stringWriter = new StringWriter ();
			var formatter = new SegmentTrackingOutputFormatter (result, stringWriter);
			formatter.Indentation = indentLevel;
			stringWriter.NewLine = Context.EolMarker;
			if (startWithNewLine)
				formatter.NewLine ();
			var visitor = new CSharpOutputVisitor (formatter, Context.FormattingOptions);
			node.AcceptVisitor (visitor, null);
			result.Text = stringWriter.ToString ().TrimEnd ();
			if (node is FieldDeclaration)
				result.Text += Context.EolMarker;

			return result;
		}
예제 #6
0
        protected NodeOutput OutputNode(int indentLevel, AstNode node, bool startWithNewLine = false)
        {
            var stringWriter = new StringWriter ();
            var formatter = new SegmentTrackingOutputFormatter (stringWriter);
            formatter.Indentation = indentLevel;
            stringWriter.NewLine = eolMarker;
            if (startWithNewLine)
                formatter.NewLine ();
            var visitor = new CSharpOutputVisitor (formatter, formattingOptions);
            node.AcceptVisitor (visitor);
            string text = stringWriter.ToString().TrimEnd();

            if (node is FieldDeclaration)
                text += eolMarker;
            return new NodeOutput(text, formatter.NewSegments);
        }