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

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

Defect

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

Depth

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

Interior

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

IsOpening

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

Kind

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

Length

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

NextMeaningful

public Fragment NextMeaningful { get; }
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.
inherited fromFragment

Partner

#
public BracketFragment Partner { get; }
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.

PrevMeaningful

public Fragment PrevMeaningful { get; }
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.
inherited fromFragment

Shape

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

Start

public int Start { get; }
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.
inherited fromFragment

Text

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

Methods

IsAdjacentTo

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

IsAll

public bool IsAll(params FragmentKind[] filter)
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.
inherited fromFragment
filter (params FragmentKind[])

IsAny

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

ToString

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