Пример #1
0
 public Class(CompilationUnit cu, ClassType t, Modifier m, IRegion region)
 {
     this.cu = cu;
     classType = t;
     this.region = region;
     modifiers = (ModifierEnum)m;
 }
Пример #2
0
 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.ToLower() == "#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.ToLower()) {
                             case "#region":
                                 ++deep;
                                 break;
                             case "#end":
                                 if (nextDirective.Arg.ToLower() == "region") {
                                     --deep;
                                     if (deep == 0) {
                                         cu.FoldingRegions.Add(new FoldingRegion(directive.Arg.Trim('"'), new DefaultRegion(directive.Start, nextDirective.End)));
                                         goto end;
                                     }
                                 }
                                 break;
                         }
                     }
                 }
                 end: ;
             }
         }
     }
 }