BracketFragment

FragmentReferences
public sealed class BracketFragment : Fragment
One side of a bracket pair. Pairing is by nesting position only; the most recent unclosed bracket is matched regardless of shape.

Properties

After

Gets the index of the character after this fragment.
public int After { get; }
inherited fromFragment

Defect

Gets a description of what is wrong with this fragment, or null when no problem exists.
public string Defect { get; }
inherited fromFragment

Depth

#
Gets how many bracket pairs enclose this one.
public int Depth { get; }

Interior

#
Gets a view of the fragments enclosed by this pair, excluding the brackets themselves. Null when this bracket has no Partner.
public Fragments Interior { get; }

IsOpening

#
Gets whether this is the opening side.
public bool IsOpening { get; }

Kind

#
Gets the category of this fragment.
public override FragmentKind Kind { get; }
Fragment.Kind

Length

Gets the number of characters covered by this fragment.
public int Length { get; }
inherited fromFragment

NextMeaningful

Gets the following fragment, skipping whitespace and single line comments. Line breaks and multi line comments are boundaries rather than trivia, and are returned rather than skipped.
public Fragment NextMeaningful { get; }
inherited fromFragment

Partner

#
Gets the other side of this pair, or null when this bracket is unmatched, or when the view it belongs to contains only one side of the pair.
public BracketFragment Partner { get; }

PrevMeaningful

Gets the preceding fragment, skipping whitespace and single line comments. Line breaks and multi line comments are boundaries rather than trivia, and are returned rather than skipped.
public Fragment PrevMeaningful { get; }
inherited fromFragment

Shape

#
Gets the shape of this bracket.
public BracketShape Shape { get; }

Start

Gets the index of the first character of this fragment within Fragments.Source. This index is absolute, and remains valid in every view derived from the original collection.
public int Start { get; }
inherited fromFragment

Text

Gets the characters covered by this fragment.
public string Text { get; }
inherited fromFragment

Methods

IsAdjacentTo

Gets whether this fragment is directly adjacent to the given one, with no intervening characters. Used to match multi character operators.
public bool IsAdjacentTo(
other
)
inherited fromFragment

IsAll

Tests whether this fragment matches all of the provided filter kinds. Note: this fragment may have additional kinds not covered by the filter, if you want an exact match, just compare against Fragment.Kind.
public bool IsAll(
params FragmentKind[]
filter
)
inherited fromFragment

IsAny

Tests whether this fragment is any of the provided filter kinds.
public bool IsAny(
params FragmentKind[]
filter
)
inherited fromFragment

ToString

Gets a description of this fragment, for debugging purposes.
public override string ToString()
inherited fromFragment
Object.ToString