Class Query.QuantifiedCapture

A quantified set of Query.Captures provided to predicates.

Methods

QuantifiedCapture:index () Get the index of the captures.
QuantifiedCapture:match () Get the QueryMatch the captures belongs to.
QuantifiedCapture:name () Get the name of the captures.
QuantifiedCapture:quantifier () Get the quantifier of the captures.
QuantifiedCapture:one_capture () Get one capture.
QuantifiedCapture:one_node () Get one node.
QuantifiedCapture:captures () Get all the captures in the set in a table.
QuantifiedCapture:nodes () Get all the nodes in the set in a table.


Methods

QuantifiedCapture:index ()
Get the index of the captures.

Returns:

    integer
QuantifiedCapture:match ()
Get the QueryMatch the captures belongs to.

Returns:

    Match
QuantifiedCapture:name ()
Get the name of the captures.

Returns:

    string
QuantifiedCapture:quantifier ()

Get the quantifier of the captures.

The quantifier can be one of 5 values:

  1. "Zero"

  2. "ZeroOrOne"

  3. "One"

  4. "ZeroOrMore"

  5. "OneOrMore"

Returns:

    string
QuantifiedCapture:one_capture ()
Get one capture.

This is useful when there are only 0 or 1 captures in the set.

If you only need the node, which is the usual use-case, use one_node instead.

Returns:

    Capture or nil
QuantifiedCapture:one_node ()
Get one node.

This is useful when there are only 0 or 1 captures in the set.

Returns:

    Node or nil
QuantifiedCapture:captures ()
Get all the captures in the set in a table.

If you only need the nodes, which is the usual use-case, use nodes instead.

Returns:

    {Capture}
QuantifiedCapture:nodes ()
Get all the nodes in the set in a table.

Returns:

    {Node}
generated by LDoc 1.5.0 Last updated 2024-04-16 14:22:44