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)); }
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)); }
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); }
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); }
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; }
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); }