void RetrieveRegions(CompilationUnit cu, SpecialTracker tracker) { for (int i = 0; i < tracker.CurrentSpecials.Count; ++i) { PreProcessingDirective directive = tracker.CurrentSpecials[i] as PreProcessingDirective; if (directive != null) { if (directive.Cmd == "#region") { int deep = 1; for (int j = i + 1; j < tracker.CurrentSpecials.Count; ++j) { PreProcessingDirective nextDirective = tracker.CurrentSpecials[j] as PreProcessingDirective; if (nextDirective != null) { switch (nextDirective.Cmd) { case "#region": ++deep; break; case "#endregion": --deep; if (deep == 0) { cu.FoldingRegions.Add(new FoldingRegion(directive.Arg.Trim(), new DefaultRegion(directive.Start, new Point(nextDirective.End.X - 2, nextDirective.End.Y)))); goto end; } break; } } } end :; } } } }
public virtual void PrintPreProcessingDirective(PreProcessingDirective directive) { WriteInPreviousLine(directive.Cmd + " " + directive.Arg); }
public object Visit(PreProcessingDirective special, object data) { formatter.PrintPreProcessingDirective(special); return(data); }