Skip to content

Latest commit

 

History

History
73 lines (41 loc) · 1.4 KB

Match.pod

File metadata and controls

73 lines (41 loc) · 1.4 KB

NAME

Tree::Pattern::Match - the result object from matching a Tree::Pattern

DESCRIPTION

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.

Tree::Pattern::Match

Attributes

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 or g 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.

Methods

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.

Vtable overrides

get_bool()

1 if the match was successful, 0 otherwise.

close