[svn:parrot] r47665 - branches/gsoc_past_optimization/docs/pct/pattern

tcurtis at svn.parrot.org tcurtis at svn.parrot.org
Wed Jun 16 22:54:58 UTC 2010


Author: tcurtis
Date: Wed Jun 16 22:54:58 2010
New Revision: 47665
URL: https://trac.parrot.org/parrot/changeset/47665

Log:
Added docs for PAST::Pattern::Constant.

Added:
   branches/gsoc_past_optimization/docs/pct/pattern/past_pattern_constant.pod

Added: branches/gsoc_past_optimization/docs/pct/pattern/past_pattern_constant.pod
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/gsoc_past_optimization/docs/pct/pattern/past_pattern_constant.pod	Wed Jun 16 22:54:58 2010	(r47665)
@@ -0,0 +1,63 @@
+=head1 NAME
+
+PAST::Pattern::Constant - A PAST::Pattern subclass for exact matching of constants.
+
+=head1 DESCRIPTION
+
+A PAST::Pattern::Constant matches objects that are equal to(according to the is_equal vtable) its value.
+
+=head1 PAST::Pattern::Constant is PAST::Pattern
+
+A PAST::Pattern::Constant contains a constant value. This constant value specifies what objects the pattern matches. The pattern matches if the is_equal vtable of the value produces a true result when called with the object to be matched.
+
+PAST::Pattern::patternize produces a PAST::Pattern::Constant when called with an object which neither has an ACCEPTS method nor provides the invokable role.
+
+=head2 Attributes
+
+=over 4
+
+=item value
+
+The value attribute holds the constant value that must be equal to any matching objects. If the value lacks an is_equal vtable, the ACCEPTSEXACTLY method will throw an exception.
+
+=back
+
+
+=head2 Methods
+
+=over 4
+
+=item new(value)
+
+Creates a PAST::Pattern::Constant with value as its constant target value.
+
+=item value([new_value])
+
+If new_value is provided, set the value attribute of the pattern to new_value. Otherwise, return the current value of the value attribute.
+
+=item ACCEPTSEXACTLY(node)
+
+Used internally by the inherited ACCEPTS method to determine whether a node exactly matches the pattern.
+
+=back
+
+=cut
+=head2 Methods
+
+=over 4
+
+=item new(code)
+
+Creates a PAST::Pattern::Closure with code as its associated predicate.
+
+=item code([value])
+
+If value is provided, set the code attribute of the pattern to value. Otherwise, return the current value of the code attribute.
+
+=item ACCEPTSEXACTLY(node)
+
+Used internally by the inherited ACCEPTS method. to determine whether a node exactly matches the pattern.
+
+=back
+
+=cut


More information about the parrot-commits mailing list