PPIx::Regexp::Element(3)

NAME
PPIx::Regexp::Element - Base of the PPIx::Regexp hierarchy.

SYNOPSIS
No user-serviceable parts inside.

INHERITANCE
"PPIx::Regexp::Element" is not descended from any other class.

"PPIx::Regexp::Element" is the parent of PPIx::Regexp::Node and PPIx::Regexp::Token.

DESCRIPTION
This class is the base of the PPIx::Regexp object hierarchy. It provides the same kind of navigational functionality that is provided by PPI::Element.

METHODS
This class provides the following public methods. Methods not documented here are private, and unsupported in the sense that the author reserves the right to change or remove them without notice.

  ancestor_of
This method returns true if the object is an ancestor of the argument, and false otherwise. By the definition of this method, $self is its own ancestor.

  can_be_quantified
 $token->can_be_quantified()
     and print "This element can be quantified.\n";

This method returns true if the element can be quantified.

  class
This method returns the class name of the element. It is the same as "ref $self".

  comment
This method returns true if the element is a comment and false otherwise.

  content
This method returns the content of the element.

  descendant_of
This method returns true if the object is a descendant of the argument, and false otherwise. By the definition of this method, $self is its own descendant.

  is_quantifier
 $token->is_quantifier()
     and print "This element is a quantifier.\n";

This method returns true if the element is a quantifier. You can not tell this from the element's class, because a right curly bracket may represent a quantifier for the purposes of figuring out whether a greediness token is possible.

  next_sibling
This method returns the element's next sibling, or nothing if there is none.

  parent
This method returns the parent of the element, or undef if there is none.

  perl_version_introduced
This method returns the version of Perl in which the element was introduced. But in practice it will never return a number less than 5.006, since that is the minimum version supported by this package.

  perl_version_removed
This method returns the version of Perl in which the element was removed. If the element is still valid the return is "undef".

  previous_sibling
This method returns the element's previous sibling, or nothing if there is none.

  significant
This method returns true if the element is significant and false otherwise.

  snext_sibling
This method returns the element's next significant sibling, or nothing if there is none.

  sprevious_sibling
This method returns the element's previous significant sibling, or nothing if there is none.

  tokens
This method returns all tokens contained in the element.

  top
This method returns the top of the hierarchy.

  whitespace
This method returns true if the element is whitespace and false otherwise.

  nav
This method returns navigation information from the top of the hierarchy to this node. The return is a list of names of methods and references to their argument lists. The idea is that given $elem which is somewhere under $top,

 my @nav = $elem->nav();
 my $obj = $top;
 while ( @nav ) {
     my $method = shift @nav;
     my $args = shift @nav;
     $obj = $obj->$method( @{ $args } ) or die;
 }
 # At this point, $obj should contain the same object
 # as $elem.

SUPPORT
Support is by the author. Please file bug reports at <http://rt.cpan.org>, or in electronic mail to the author.

AUTHOR
Thomas R. Wyant, III wyant at cpan dot org

COPYRIGHT AND LICENSE
Copyright (C) 2009-2010, Thomas R. Wyant, III

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.

This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.