Browse Source

add current column in the node annotation tuple

pull/219/head
Eusebiu Marcu 14 years ago
parent
commit
c81abc97ab
  1. 2
      ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs
  2. 1
      ICSharpCode.Decompiler/ITextOutput.cs
  3. 8
      ICSharpCode.Decompiler/PlainTextOutput.cs

2
ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs

@ -152,7 +152,7 @@ namespace ICSharpCode.Decompiler.Ast @@ -152,7 +152,7 @@ namespace ICSharpCode.Decompiler.Ast
int c = 0;
if (n != null)
c = n.Attributes.Count;
node.AddAnnotation(Tuple.Create(output.CurrentLine + c, 0));
node.AddAnnotation(Tuple.Create(output.CurrentLine + c, output.CurrentColumn));
}
nodeStack.Push(node);

1
ICSharpCode.Decompiler/ITextOutput.cs

@ -24,6 +24,7 @@ namespace ICSharpCode.Decompiler @@ -24,6 +24,7 @@ namespace ICSharpCode.Decompiler
public interface ITextOutput
{
int CurrentLine { get; }
int CurrentColumn { get; }
void Indent();
void Unindent();

8
ICSharpCode.Decompiler/PlainTextOutput.cs

@ -27,6 +27,7 @@ namespace ICSharpCode.Decompiler @@ -27,6 +27,7 @@ namespace ICSharpCode.Decompiler
int indent;
bool needsIndent;
int lineNumber = 1;
int columnNumber = 1;
public PlainTextOutput(TextWriter writer)
{
@ -44,6 +45,10 @@ namespace ICSharpCode.Decompiler @@ -44,6 +45,10 @@ namespace ICSharpCode.Decompiler
get { return lineNumber; }
}
public int CurrentColumn {
get { return columnNumber; }
}
public override string ToString()
{
return writer.ToString();
@ -65,6 +70,7 @@ namespace ICSharpCode.Decompiler @@ -65,6 +70,7 @@ namespace ICSharpCode.Decompiler
needsIndent = false;
for (int i = 0; i < indent; i++) {
writer.Write('\t');
columnNumber += 4;
}
}
}
@ -73,12 +79,14 @@ namespace ICSharpCode.Decompiler @@ -73,12 +79,14 @@ namespace ICSharpCode.Decompiler
{
WriteIndent();
writer.Write(ch);
columnNumber++;
}
public void Write(string text)
{
WriteIndent();
writer.Write(text);
columnNumber += text.Length;
}
public void WriteLine()

Loading…
Cancel
Save