Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

ptree_util.cc File Reference

#include "ptree_util.h"
#include "ptree_util_i.h"

Include dependency graph for ptree_util.cc:

Include dependency graph

Go to the source code of this file.

Functions

Ptreedo_function (Ptree *lhs, Ptree *lpar, Ptree *args, Ptree *rpar)
void flatten_specifier_list (Ptree *tree, std::vector< Ptree * > *nodes)
void flatten_ptree (Ptree *tree, std::vector< Ptree * > *nodes)
bool ptree_is_name (Ptree *tree)
 True iff the given tree is a name. More...

Ptreeconvert_comma_expr_to_list (Ptree *input)
 Convert an expression [[[a , b] , c] , d] into [a , b , c , d]. More...

Ptreeconvert_node_to_name (Ptree *p)
Ptreeconvert_decl_to_expr (Ptree *lhs, Ptree *rhs)
 Convert a declaration (consisting of a type-specifier lhs and a declarator side rhs) into an expression. More...


Function Documentation

Ptree* convert_comma_expr_to_list Ptree   input
 

Convert an expression [[[a , b] , c] , d] into [a , b , c , d].

This is needed for expressions: "(foo)(1, 2, 3)" is parsed as [(foo) ( [[1 , 2] , 3] )] whereas the correct parse would be [[( foo )] ( [1 , 2 , 3] )].

Definition at line 53 of file ptree_util.cc.

References Ptree::Cons(), Ptree::First(), Ptree::Second(), and Ptree::Third().

Referenced by Expr_annotator::visit_cast().

Ptree* convert_decl_to_expr Ptree   lhs,
Ptree   rhs
 

Convert a declaration (consisting of a type-specifier lhs and a declarator side rhs) into an expression.

Definition at line 102 of file ptree_util.cc.

References Ptree::Car(), Ptree::Cdr(), compile_error(), CONST, convert_node_to_name(), Ptree::Display(), do_function(), Ptree::Eq(), expect_ptree(), Ptree::IsA(), Ptree::IsLeaf(), Ptree::List(), Ptree::Second(), Ptree::Third(), and VOLATILE.

Referenced by do_function(), and Expr_annotator::visit_cast().

Ptree* convert_node_to_name Ptree   p
 

Definition at line 86 of file ptree_util.cc.

References Ptree::GetLength(), Ptree::GetPosition(), Ptree::IsLeaf(), and ntName.

Referenced by convert_decl_to_expr().

Ptree * do_function Ptree   lhs,
Ptree   lpar,
Ptree   args,
Ptree   rpar
[static]
 

Definition at line 67 of file ptree_util.cc.

References Ptree::Car(), Ptree::Cdr(), convert_decl_to_expr(), Ptree::Eq(), Ptree::First(), Ptree::Length(), Ptree::List(), Ptree::Second(), and Ptree::Snoc().

Referenced by convert_decl_to_expr().

void flatten_ptree Ptree   tree,
std::vector< Ptree * > *    nodes
 

Definition at line 22 of file ptree_util.cc.

References Ptree::Car(), Ptree::Cdr(), and Ptree::IsLeaf().

void flatten_specifier_list Ptree   tree,
std::vector< Ptree * > *    nodes
 

Definition at line 14 of file ptree_util.cc.

bool ptree_is_name Ptree   tree
 

True iff the given tree is a name.

LeafName doesn't respond to "IsA(ntName)". D'ooh!

Definition at line 41 of file ptree_util.cc.

References Ptree::IsA(), and ntName.

Referenced by Expr_annotator::visit_funcall(), and Expr_annotator::visit_unary().


Generated on Mon Feb 10 17:34:28 2003 for VFiasco Semantics Compiler by doxygen1.2.15