FragmentResult
Pennington.TreeSitter.Fragments
Outcome of a fragment lookup: either the extracted Text or an Error message.
Properties
Errorstring- The failure message when unsuccessful; otherwise null.
Succeededbool- True when extraction succeeded.
Textstring- The extracted source text when successful; otherwise null.
Constructors
FragmentResult
#public FragmentResult(string Text, string Error)
Outcome of a fragment lookup: either the extracted Text or an Error message.
Parameters
Textstring- The extracted source text when successful; otherwise null.
Errorstring- The failure message when unsuccessful; otherwise null.
Methods
Pennington.TreeSitter.Fragments.FragmentResult
namespace Pennington.TreeSitter.Fragments;
/// Outcome of a fragment lookup: either the extracted Text or an Error message.
public record FragmentResult
{
/// The failure message when unsuccessful; otherwise null.
public string Error { get; set; }
/// Creates a failed result with the given error message.
public static FragmentResult Fail(string error)
;
/// Outcome of a fragment lookup: either the extracted Text or an Error message.
public FragmentResult(string Text, string Error)
;
/// Creates a successful result wrapping text.
public static FragmentResult Ok(string text)
;
/// True when extraction succeeded.
public bool Succeeded { get; }
/// The extracted source text when successful; otherwise null.
public string Text { get; set; }
}