PCT::Node - base class for PAST and POST nodes
This file implements the base class for abstract syntax tree (PAST) and opcode syntax tree (POST) nodes in the Parrot Compiler Toolkit.
PCT::Node is the base class for all PAST and POST nodes.
It's derived from class
so that it has both array and hash components.
The array component is used to maintain a node's children,
while the hash component contains the attributes of the node.
In general we provide and use accessor methods for a node's attributes,
instead of accessing the hash component directly.
Every PAST/POST node has
name attribute is the node's name,
pos are used to identify the location in the original source code for the node.
pos values are generally set by the
node method below.
Other node attributes are generally defined by subclasses of
Initialize a node with the given children and attributes.
Adds each child to the node (using the
below) and calls the appropriate accessor method for each attribute.
And returns the node.
Create a new PAST node of initialized with the given children and attributes. Returns the newly created node.
Clone the node.
child to the beginning of the invocant's list of children.
Remove the first child from the invocant's list of children. Returns the child.
child to the end of the invocant's list of children.
Remove the last child from the invocant's list of children. Returns the child.
(Deprecated.) Creates a new node of type
initializes it with the given children and attributes,
and adds it to the end of the invocant's array of children.
Returns the newly created node.
Returns a newly initialized iterator for the invocant's list of children.
Sets the invocant's
pos attributes to those of
val is another PAST node,
pos are simply copied from that node,
val is assumed to be a
Match object and obtains source/position information from that.
Accessor method -- sets/returns the
name attribute of the invocant.
Helper method for accessors.
has_value is true then set the invocant's value of
Returns the (resulting) value of
attrname in the invocant.
Generate a unique number that can be used as an identifier.
fmt is provided,
then it will be used as a prefix to the unique number.
Ask the current object's metaclass if
self is a
else return 0.
Return true since the node is defined.
Patrick Michaud <firstname.lastname@example.org> is the author and maintainer. Please send patches and suggestions to the Parrot porters or Perl 6 compilers mailing lists.
2006-11-20 Patrick Michaud added first draft of POD documentation. 2007-11-21 Re-implementation with pdd26 compliance, compiler toolkit 2007-12-07 Refactor PAST::Node into separate PCT::Node component.
Copyright (C) 2006-2008, Parrot Foundation.