Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

primNode Class Reference

Primitive type node. More...

#include <ast.h>

Inheritance diagram for primNode::

typeNode Node List of all members.

Public Methods

 primNode (Type_qualifiers tq, basic_type basic, const Coord coord=Coord::Unknown)
 Create a new primitive type. More...

 primNode (Type_qualifiers tq, const Coord coord=Coord::Unknown)
 Create a new default type primitive type. More...

 primNode (const Coord coord)
 Create a new default primitive type. More...

 primNode (basic_type basic, const Coord coord=Coord::Unknown)
 Create a new primitive type without type qualifiers. More...

virtual ~primNode ()
 Destroy a primNode. More...

bool qualified_equal_to (typeNode *node2, bool strict_toplevel, bool strict_recursive)
 Virtual type comparison routine. More...

virtual Nodeclone () const
 Clone the input node. More...

virtual void output_type (output_context &ct, Node *par, Assoc context, Type_qualifiers q)
 Output a type. More...

Accessors
Methods to get and set fields in the class.

const basic_typebasic () const
basic_typebasic ()
void basic (basic_type basic)
Parser methods
These methods are only used during parsing.

void finish ()
primNode * finish_and ()
void merge_in (primNode *other)
primNode * merge_in_and (primNode *other)
Type predicates
These methods support a variety of useful type predicates, most of which are self-explanatory. Each typeNode subclass overrides the methods for which it returns true. See typeNode for details.

virtual bool is_int () const
virtual bool is_char () const
virtual bool is_float () const
virtual bool is_void () const
virtual bool is_ellipsis () const
virtual bool is_integer () const
virtual bool is_arithmetic () const
virtual bool is_scalar () const
AST Traversal
Methods to uniformly traverse the AST. See the documentation in the Node class.

virtual void visit (Visitor *the_visitor)
 Dispatch a Visitor. More...

virtual void walk (Walker &the_walker)
 Dispatch a Walker. More...

virtual Nodechange (Changer &the_changer, bool redispatch=false)
 Dispatch a Changer. More...


Private Attributes

basic_type _basic
 The basic type. More...


Detailed Description

Primitive type node.

This class represents a primitive type and is really just an AST node container for a basic_type. Note that this includes the void type.

The NodeType is Prim.


Constructor & Destructor Documentation

primNode::primNode Type_qualifiers    tq,
basic_type    basic,
const Coord    coord = Coord::Unknown
 

Create a new primitive type.

The new type has the given basic type and type qualifiers.

Parameters:
tq  the type qualifiers
basic  the underlying basic type
coord  the location of the construct in the source file.

primNode::primNode Type_qualifiers    tq,
const Coord    coord = Coord::Unknown
 

Create a new default type primitive type.

The new type has the given type qualifiers and the default basic type of int. This default is determined by calling the no-arg constructor for basic_type. (Was MakeDefaultPrimType in type.c)

Parameters:
tq  the type qualifiers
coord  the location of the construct in the source file.

primNode::primNode const Coord    coord
 

Create a new default primitive type.

The new type has no type qualifiers and the default basic type of int. This default is determined by calling the no-arg constructor for basic_type.

Parameters:
coord  the location of the construct in the source file.

primNode::primNode basic_type    basic,
const Coord    coord = Coord::Unknown
 

Create a new primitive type without type qualifiers.

The new type has the given basic type and no type qualifiers. (Was StartPrimType in type.c)

Parameters:
basic  the underlying basic type
coord  the location of the construct in the source file.

primNode::~primNode   [virtual]
 

Destroy a primNode.

Warning:
Do not use the destructors to delete AST nodes. Instead, rely on the node garbage collector.


Member Function Documentation

void primNode::basic basic_type    basic [inline]
 

basic_type& primNode::basic   [inline]
 

const basic_type& primNode::basic   const [inline]
 

Node * primNode::change Changer   the_changer,
bool    redispatch = false
[virtual]
 

Dispatch a Changer.

This abstract method works much the walker, but allows the tree to be changed.

Parameters:
the_changer  the specific Changer object to use.
redispatch  pass true to revisit parts of the tree that have changed.

Reimplemented from Node.

virtual Node* primNode::clone   const [inline, virtual]
 

Clone the input node.

This is not a "deep" clone, so be careful. For a deep clone, use the clone_changer class.

Returns:
a shallow copy of the node (no subtrees are copied).

Reimplemented from Node.

void primNode::finish  
 

Reimplemented from typeNode.

primNode * primNode::finish_and  
 

Reimplemented from typeNode.

virtual bool primNode::is_arithmetic   const [inline, virtual]
 

Reimplemented from typeNode.

virtual bool primNode::is_char   const [inline, virtual]
 

Reimplemented from typeNode.

virtual bool primNode::is_ellipsis   const [inline, virtual]
 

Reimplemented from typeNode.

virtual bool primNode::is_float   const [inline, virtual]
 

Reimplemented from typeNode.

virtual bool primNode::is_int   const [inline, virtual]
 

Reimplemented from typeNode.

virtual bool primNode::is_integer   const [inline, virtual]
 

Reimplemented from typeNode.

virtual bool primNode::is_scalar   const [inline, virtual]
 

Reimplemented from typeNode.

virtual bool primNode::is_void   const [inline, virtual]
 

Reimplemented from typeNode.

void primNode::merge_in primNode *    other
 

primNode * primNode::merge_in_and primNode *    other
 

void primNode::output_type output_context   ct,
Node   parent,
Assoc    context,
Type_qualifiers    q
[virtual]
 

Output a type.

Reimplemented from typeNode.

bool primNode::qualified_equal_to typeNode   node2,
bool    strict_toplevel,
bool    strict_recursive
[virtual]
 

Virtual type comparison routine.

Each typeNode subclass overrides this routine to provide its specific type comparison. This is used by the static equal_to() method to perform general deep type comparison.

See also:
equal_to()
Parameters:
other  the type to compare against
strict_toplevel  pass true to require strict comparison of top-level types
strict_recursive  pass true to require strict comparson of sub-types
Returns:
true, if the types pass the equality test

Reimplemented from typeNode.

void primNode::visit Visitor   the_visitor [virtual]
 

Dispatch a Visitor.

This abstract method is the entry point for the visitor design pattern. Each node subclass defines a visit() method that calls the appropriate at_ method in the visitor. For more information see the Visitor documentation.

Parameters:
the_visitor  the specific Visitor object to use.

Reimplemented from Node.

void primNode::walk Walker   the_walker [virtual]
 

Dispatch a Walker.

This abstract method works much like the visitor, but instead walks the entire underlying subtree calling the appropriate at_ method at each node. For more information see the Walker documentation.

Parameters:
the_walker  the specific Walker object to use.

Reimplemented from Node.


Member Data Documentation

basic_type primNode::_basic [private]
 

The basic type.

The basic_type class represents all the different variations of primitive types, such as int, char, float, etc.


The documentation for this class was generated from the following files:
Generated on Thu Jan 10 12:06:31 2002 for C-Breeze by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001