protected string FormatOwnLine(Formatter.ParseUnit pu) { if (this.shouldSingleReturn(pu)) { return this.GetNewLine(pu) + pu.token.Value.Text.ToUpper() + this.GetNewLine(pu); } return this.GetNewLine(pu) + this.GetNewLine(pu) + pu.token.Value.Text.ToUpper() + this.GetNewLine(pu); }
protected string GetNewLine(Formatter.ParseUnit pu) { string newLine = ""; for (int i = 0; i < pu.indentDepth; i = i + 1) { newLine = newLine + this.indentString; } return Environment.NewLine + newLine; }
protected bool shouldSingleReturn(Formatter.ParseUnit pu) { LinkedListNode<Token> t = pu.token; for (int i = 0; i < 3; i = i + 1) { if (t.Previous == null) { // there is nothing before the select statement... so we can just do the normal stuff and it will get trimmed off return false; } if (t.Previous.Value.Type == "(" || t.Previous.Value.Type == "LEX_END_OF_LINE_COMMENT") { return true; } t = t.Previous; } return false; }
public virtual string Interpret(ref Formatter.ParseUnit pu) { return pu.token.Value.Text; }