Class PiecewiseSourceDocumentBuilder
Builds a PiecewiseSourceDocument incrementally.
public sealed class PiecewiseSourceDocumentBuilder
- Inheritance
-
PiecewiseSourceDocumentBuilder
- Inherited Members
Constructors
PiecewiseSourceDocumentBuilder(string)
Creates a piecewise source document builder.
public PiecewiseSourceDocumentBuilder(string identifier)
Parameters
identifierstringThe identifier for the assembled document.
Methods
AddSource(SourceSpan)
Adds a source-backed piece to the assembled document.
public PiecewiseSourceDocumentBuilder AddSource(SourceSpan origin)
Parameters
originSourceSpanThe source span to copy into the assembled document.
Returns
- PiecewiseSourceDocumentBuilder
This builder.
AddText(string)
Adds generated text with no known source provenance.
public PiecewiseSourceDocumentBuilder AddText(string text)
Parameters
textstringThe generated text.
Returns
- PiecewiseSourceDocumentBuilder
This builder.
AddText(string, SourceSpan)
Adds generated text anchored to a source span for diagnostics.
public PiecewiseSourceDocumentBuilder AddText(string text, SourceSpan anchor)
Parameters
textstringThe generated text.
anchorSourceSpanThe source span that caused the generated text to exist.
Returns
- PiecewiseSourceDocumentBuilder
This builder.
Build()
Creates a piecewise source document from the pieces added so far.
public PiecewiseSourceDocument Build()
Returns
- PiecewiseSourceDocument
A piecewise source document.