Tree::Pattern::Match - the result object from matching a Tree::Pattern
Tree::Pattern::Match objects are returned by matching operations on Tree::Patterns.
It can be used to determine whether the match was successful, find the matching node, and to find the match results of subpatterns.
- success([value])
This attribute is true if the match was successful and false otherwise.
- orig([value])
This attribute holds the original matching node if there is one.
It is not present for matches with the
global
org
options if more than one match was found.It is meaningless for an unsuccessful match.
- ast()
This attribute, like the ast attribute of regex match results, holds an abstract object that has been associated with the match result with the "!make" method or the NQP-rx make statement.
- new([success], [orig])
Creates a new match result object with the supplied values for the success and orig attributes, if supplied.
- Bool()
Converts the match result to a boolean value, 1 if the match was successful; otherwise, 0.
- !make(ast)
Set the match result's ast attribute to the supplied value.
- get_bool()
1 if the match was successful, 0 otherwise.