/// <summary> /// Parses the #else-#endif part of an #if-#elif-#else-#endif construct, starting at the character following "else". /// Updates the last IfDirective instance added to this.preprocessorInformation with an ElsePart. /// Leaves this.fragmentIndex pointing to the start of the first line after the #endif directive. /// Returns all source locations that are to be included in the preprocessor output. (No locations are returned if the include parameter is false.) /// </summary> /// <param name="include">True if the definition is part of an included block. If false, the directive is parsed but ignored. (No locations are returned.)</param> private IEnumerable<ISourceLocation> ParseElse(bool include) { ElsePart @else = new ElsePart(this.GetSourceLocation(this.startOfCurrentLine, this.fragmentIndex-this.startOfCurrentLine)); this.preprocessorInformation.AddElse(@else); this.SkipPastBlanksCommentAndNewLine(); foreach (ISourceLocation includedSourceFragment in this.ParseSection(false, true, false, include, false)) yield return includedSourceFragment; }
internal void AddElse(ElsePart @else) { for (int i = this.directives.Count; i > 0; i--) { IfDirective/*?*/ ifDirective = this.directives[i-1] as IfDirective; if (ifDirective == null) continue; ifDirective.@else = @else; return; } }