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:
- QuantifiedCapture:name ()
-
Get the name of the captures.
Returns:
- QuantifiedCapture:quantifier ()
-
Get the quantifier of the captures.
The quantifier can be one of 5 values:
"Zero"
"ZeroOrOne"
"One"
"ZeroOrMore"
"OneOrMore"
Returns:
- 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:
- QuantifiedCapture:nodes ()
-
Get all the nodes in the set in a table.
Returns: