private void AddSectionContent(Sections sections) { sections.AddSection("file") .AddLine("bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla") .AddLine("bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla") .AddLine("bla bla bla bla bla bla bla bla bla bla bla bla bla"); sections.AddSection("project") .AddLine("bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla") .AddLine("bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla") .AddLine("bla bla bla bla bla bla bla bla bla bla bla bla bla"); sections.AddSection("extension") .AddLine("bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla") .AddLine("bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla") .AddLine("bla bla bla bla bla bla bla bla bla bla bla bla bla"); sections.AddSection("beautiful-window") .AddLine("bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla") .AddLine("bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla") .AddLine("bla bla bla bla bla bla bla bla bla bla bla bla bla"); sections.AddSection("analyze") .AddLine("bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla") .AddLine("bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla") .AddLine("bla bla bla bla bla bla bla bla bla bla bla bla bla"); }
private void MergeSection(section otherSection) { if (!Sections.ContainsSection(otherSection.SectionName)) { Sections.AddSection(otherSection.SectionName); } Sections.GetSectionData(otherSection.SectionName).Merge(otherSection); }
/// <summary> /// Merge the sections into this by overwriting this sections. /// </summary> private void MergeSection(SectionData otherSection) { // no overlap -> create no section if (!Sections.ContainsSection(otherSection.SectionName)) { Sections.AddSection(otherSection.SectionName); } // merge section into the new one Sections.GetSectionData(otherSection.SectionName).Merge(otherSection); }
/// <summary> /// Parses the keyword «\section». /// </summary> private Section ParseSection(Sections sections) { Debug.Assert(sections != null); MoveToCode(); AssertSymbol(Symbol.Section); Section section = null; try { section = sections.AddSection(); ReadCode(); // read '[' or '{' if (Symbol == Symbol.BracketLeft) ParseAttributes(section); AssertSymbol(Symbol.BraceLeft); // Consider the case that the keyword «\paragraph» can be omitted. if (IsParagraphContent()) { Paragraph paragraph = section.Elements.AddParagraph(); ParseParagraphContent(section.Elements, paragraph); } else { ReadCode(); // read beyond '{' // 1st parse headers and footers while (IsHeaderFooter()) ParseHeaderFooter(section); // 2nd parse all other stuff ParseDocumentElements(section.Elements, Symbol.Section); } AssertSymbol(Symbol.BraceRight); ReadCode(); // read beyond '}' } catch (DdlParserException ex) { ReportParserException(ex); AdjustToNextBlock(); } return section; }