translator_pretty Class Reference

#include <pretty.h>

Inheritance diagram for translator_pretty:

translator List of all members.

Public Member Functions

virtual ~translator_pretty ()
 translator_pretty (const rcstring &filename="-")
void print_token (const rcstring &text)
void print_space ()
void print_eoln (int extra_wrap_indent=0)
void indent_more ()
void indent_less ()
void indent_reset ()

Protected Member Functions

scope::pointer program_scope_factory (const rcstring &name)
scope::pointer function_scope_factory (const rcstring &name, bool is_func, bool new_seg)
statement::pointer if_statement_factory (const expression::pointer &condition, const statement::pointer &then_clause, const statement::pointer &else_clause)
statement::pointer compound_statement_factory (statement_list *arg)
statement::pointer while_statement_factory (const expression::pointer &condition, const statement::pointer &body)
statement::pointer until_statement_factory (const statement::pointer &body, const expression::pointer &condition)
statement::pointer infinite_loop_factory (const statement::pointer &body)
statement::pointer writeln_statement_factory (expression_list *arg)
expression::pointer boolean_expression_factory (bool value)
expression::pointer integer_plus_integer_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer real_plus_real_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer integer_minus_integer_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer real_minus_real_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer set_difference_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer set_union_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer integer_times_integer_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer real_times_real_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer set_intersection_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer integer_div_integer_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer real_over_real_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer name_expression_factory (symbol *sp)
expression::pointer integer_expression_factory (const rcstring &value)
expression::pointer integer_negate_expression_factory (const expression::pointer &arg)
expression::pointer real_negate_expression_factory (const expression::pointer &arg)
expression::pointer real_expression_factory (const rcstring &value)
expression::pointer string_expression_factory (const rcstring &value)
expression::pointer boolean_eq_boolean_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer integer_eq_integer_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer real_eq_real_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer string_eq_string_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer boolean_ne_boolean_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer integer_ne_integer_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer real_ne_real_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer string_ne_string_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer boolean_lt_boolean_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer integer_lt_integer_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer real_lt_real_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer string_lt_string_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer boolean_le_boolean_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer integer_le_integer_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer real_le_real_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer string_le_string_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer boolean_gt_boolean_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer integer_gt_integer_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer real_gt_real_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer string_gt_string_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer boolean_ge_boolean_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer integer_ge_integer_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer real_ge_real_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer string_ge_string_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
symbolfunction_symbol_factory (const rcstring &name, const scope::pointer &scp, int lex_level)
expression::pointer dereference_expression_factory (const expression::pointer &arg)
expression::pointer logical_and_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer logical_or_expression_factory (const expression::pointer &lhs, const expression::pointer &rhs)
expression::pointer logical_not_expression_factory (const expression::pointer &arg)
expression::pointer real_from_integer_expression_factory (const expression::pointer &arg)
expression::pointer sizeof_expression_factory (const expression::pointer &arg)
expression::pointer sizeof_expression_factory (const type::pointer &arg)
symbolbuiltin_chr_factory ()
symbolbuiltin_dec_factory ()
symbolbuiltin_inc_factory ()
symbolbuiltin_odd_factory ()
symbolbuiltin_ord_factory ()
symbolbuiltin_pred_factory ()
symbolbuiltin_sqr_factory ()
symbolbuiltin_succ_factory ()
symbolbuiltin_time_factory ()
symbol_functionbuiltin_syscall_factory (const rcstring &name, int proc_num)
expression::pointer set2set_expression_factory (const type::pointer &to, const expression::pointer &from)
expression::pointer char_expression_factory (const location &locn, unsigned char value)
expression::pointer empty_set_expression_factory (const location &locn, const type::pointer &tp)
expression::pointer set_expression_factory (const expression::pointer &singleton)
expression::pointer set_expression_factory (const expression::pointer &lo, const expression::pointer &hi)

Private Member Functions

 translator_pretty (const translator_pretty &)
translator_prettyoperator= (const translator_pretty &)

Private Attributes

output_smart_pointer os
int page_width
int indent_width
int indent_depth
rcstring_list line
int undent
bool have_printed_var_keyword

Detailed Description

The translator_pretty class is used to represent a pretty printer for UCSD Pascal.

Definition at line 32 of file pretty.h.


Constructor & Destructor Documentation

virtual translator_pretty::~translator_pretty (  )  [virtual]

The destructor.

translator_pretty::translator_pretty ( const rcstring filename = "-"  ) 

The default constructor.

translator_pretty::translator_pretty ( const translator_pretty  )  [private]

The copy constructor. Do not use.


Member Function Documentation

scope::pointer translator_pretty::program_scope_factory ( const rcstring name  )  [protected, virtual]

The program_scope_factory method is used to create a new program scope instance. It is called by the non-virtual program_scope_factory method.

Implements translator.

scope::pointer translator_pretty::function_scope_factory ( const rcstring name,
bool  is_func,
bool  new_seg 
) [protected, virtual]

The function_scope_factory method is used to create a new function scope instance. It is called by the non-virtual function_scope_factory method.

Parameters:
name The name of the function or procedure.
is_func true for functions, false for procedures. This is needed because this information is needed long before the function return type is available.
new_seg The new_seg argument indicates whether this function or procedure starts a new segment (if true) or adds another function to the current segment (if false).

Implements translator.

statement::pointer translator_pretty::if_statement_factory ( const expression::pointer condition,
const statement::pointer then_clause,
const statement::pointer else_clause 
) [protected, virtual]

The if_statement_factory method is used to create a new not equal to expression object instance.

Parameters:
condition The controlling expression
then_clause The statement to perform if the condition is true
else_clause The statement to perform if the condition is false
Returns:
A pointer to an expression object.

Implements translator.

statement::pointer translator_pretty::compound_statement_factory ( statement_list arg  )  [protected, virtual]

The compound_statement_factory method is used to create a new compount statement instance in dynamic memory.

Parameters:
arg The statements which form the body of the compound statement.
Returns:
pointer to a statement in dynamic memory

Reimplemented from translator.

statement::pointer translator_pretty::while_statement_factory ( const expression::pointer condition,
const statement::pointer body 
) [protected, virtual]

The while_statement_factory method is used to create a new while statement object instance.

Parameters:
condition The loop control expression.
body The loop body.
Returns:
A pointer to an statement object.

Implements translator.

statement::pointer translator_pretty::until_statement_factory ( const statement::pointer body,
const expression::pointer condition 
) [protected, virtual]

The until_statement_factory method is used to create a new until statement object instance.

Parameters:
body The loop body.
condition The loop control expression.
Returns:
A pointer to an statement object.

Implements translator.

statement::pointer translator_pretty::infinite_loop_factory ( const statement::pointer body  )  [protected, virtual]

The infinite_loop_factory method is used to create a new not equal to expression object instance.

Parameters:
body The loop body.
Returns:
A pointer to an statement object.

Implements translator.

statement::pointer translator_pretty::writeln_statement_factory ( expression_list arg  )  [protected, virtual]

The writeln_statement_factory method is used to create a new compound statement instance in dynamic memory.

Parameters:
arg The expressions which detail what the writeln statement is to print.
Returns:
pointer to a statement in dynamic memory

Implements translator.

expression::pointer translator_pretty::boolean_expression_factory ( bool  value  )  [protected, virtual]

The boolean_expression_factory method is used to create a new string constant expression object instance.

Parameters:
value The value of the boolean.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::integer_plus_integer_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The integer_plus_integer_expression_factory method is used to create a new addition expression object instance.

Parameters:
lhs The left hand side of the addition.
rhs The right hand side of the addition.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::real_plus_real_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The real_plus_real_expression_factory method is used to create a new addition expression object instance.

Parameters:
lhs The left hand side of the addition.
rhs The right hand side of the addition.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::integer_minus_integer_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The integer_minus_integer_expression_factory method is used to create a new subtraction expression object instance.

Parameters:
lhs The left hand side of the subtraction.
rhs The right hand side of the subtraction.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::real_minus_real_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The real_minus_real_expression_factory method is used to create a new subtraction expression object instance.

Parameters:
lhs The left hand side of the subtraction.
rhs The right hand side of the subtraction.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::set_difference_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The set_difference_expression_factory method is used to create a new set difference expression object instance.

Parameters:
lhs The left hand side of the set difference.
rhs The right hand side of the set difference.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::set_union_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The set_union_expression_factory method is used to create a new set union expression object instance.

Parameters:
lhs The left hand side of the union.
rhs The right hand side of the union.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::integer_times_integer_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The integer_times_integer_expression_factory method is used to create a new integer multiplication expression object instance.

Parameters:
lhs The left hand side of the multiplication.
rhs The right hand side of the multiplication.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::real_times_real_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The real_times_real_expression_factory method is used to create a new real multiplication expression object instance.

Parameters:
lhs The left hand side of the multiplication.
rhs The right hand side of the multiplication.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::set_intersection_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The set_intersection_expression_factory method is used to create a new set intersection expression object instance.

Parameters:
lhs The left hand side of the set intersection.
rhs The right hand side of the set intersection.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::integer_div_integer_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The integer_div_integer_expression_factory method is used to create a new integer div expression object instance.

Parameters:
lhs The left hand side of the integer division.
rhs The right hand side of the integer division.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::real_over_real_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The real_over_real_expression_factory method is used to create a new real division expression object instance.

Parameters:
lhs The left hand side of the real division.
rhs The right hand side of the real division.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::name_expression_factory ( symbol sp  )  [protected, virtual]

The name_expression_factory method is used to create a new variable reference expression object instance.

Parameters:
sp Symbol corresponding to the name of the expression.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::integer_expression_factory ( const rcstring value  )  [protected, virtual]

The integer_expression_factory method is used to create a new string constant expression object instance.

Parameters:
value The value of the string.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::integer_negate_expression_factory ( const expression::pointer arg  )  [protected, virtual]

The integer_negate_expression_factory method is used to create a new integer negate expression object instance.

Parameters:
arg The integer expression to be negated.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::real_negate_expression_factory ( const expression::pointer arg  )  [protected, virtual]

The real_negate_expression_factory method is used to create a new real negate expression object instance.

Parameters:
arg The real expression to be negated.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::real_expression_factory ( const rcstring value  )  [protected, virtual]

The real_expression_factory method is used to create a new real constant expression object instance.

Parameters:
value The value of the string.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::string_expression_factory ( const rcstring value  )  [protected, virtual]

The real_expression_factory method is used to create a new real constant expression object instance.

Parameters:
value The value of the string.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::boolean_eq_boolean_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The booean_eq_booean_expression_factory method is used to create a new equal to expression object instance.

Parameters:
lhs The left hand side of the equal to.
rhs The right hand side of the equal to.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::integer_eq_integer_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The integer_eq_integer_expression_factory method is used to create a new equal to expression object instance.

Parameters:
lhs The left hand side of the equal to.
rhs The right hand side of the equal to.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::real_eq_real_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The real_eq_real_expression_factory method is used to create a new equal to expression object instance.

Parameters:
lhs The left hand side of the equal to.
rhs The right hand side of the equal to.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::string_eq_string_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The string_eq_string_expression_factory method is used to create a new equal to expression object instance.

Parameters:
lhs The left hand side of the equal to.
rhs The right hand side of the equal to.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::boolean_ne_boolean_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The booean_ne_boolean_expression_factory method is used to create a new not equal to expression object instance.

Parameters:
lhs The left hand side of the not equal to.
rhs The right hand side of the not equal to.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::integer_ne_integer_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The integer_ne_integer_expression_factory method is used to create a new not equal to expression object instance.

Parameters:
lhs The left hand side of the not equal to.
rhs The right hand side of the not equal to.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::real_ne_real_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The integer_ne_integer_expression_factory method is used to create a new not equal to expression object instance.

Parameters:
lhs The left hand side of the not equal to.
rhs The right hand side of the not equal to.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::string_ne_string_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The integer_ne_integer_expression_factory method is used to create a new not equal to expression object instance.

Parameters:
lhs The left hand side of the not equal to.
rhs The right hand side of the not equal to.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::boolean_lt_boolean_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The boolean_lt_boolean_expression_factory method is used to create a new less than expression object instance.

Parameters:
lhs The left hand side of the less than.
rhs The right hand side of the less than.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::integer_lt_integer_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The integer_lt_integer_expression_factory method is used to create a new less than expression object instance.

Parameters:
lhs The left hand side of the less than.
rhs The right hand side of the less than.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::real_lt_real_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The real_lt_real_expression_factory method is used to create a new less than expression object instance.

Parameters:
lhs The left hand side of the less than.
rhs The right hand side of the less than.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::string_lt_string_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The string_lt_string_expression_factory method is used to create a new less than expression object instance.

Parameters:
lhs The left hand side of the less than.
rhs The right hand side of the less than.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::boolean_le_boolean_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The le_expression_factory method is used to create a new less than or equal expression object instance.

Parameters:
lhs The left hand side of the less than or equal.
rhs The right hand side of the less than or equal.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::integer_le_integer_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The le_expression_factory method is used to create a new less than or equal expression object instance.

Parameters:
lhs The left hand side of the less than or equal.
rhs The right hand side of the less than or equal.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::real_le_real_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The le_expression_factory method is used to create a new less than or equal expression object instance.

Parameters:
lhs The left hand side of the less than or equal.
rhs The right hand side of the less than or equal.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::string_le_string_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The le_expression_factory method is used to create a new less than or equal expression object instance.

Parameters:
lhs The left hand side of the less than or equal.
rhs The right hand side of the less than or equal.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::boolean_gt_boolean_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The boolean_gt_boolean_expression_factory method is used to create a new greater than expression object instance.

Parameters:
lhs The left hand side of the greater than.
rhs The right hand side of the greater than.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::integer_gt_integer_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The integer_gt_integer_expression_factory method is used to create a new greater than expression object instance.

Parameters:
lhs The left hand side of the greater than.
rhs The right hand side of the greater than.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::real_gt_real_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The real_gt_real_expression_factory method is used to create a new greater than expression object instance.

Parameters:
lhs The left hand side of the greater than.
rhs The right hand side of the greater than.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::string_gt_string_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The string_gt_string_expression_factory method is used to create a new greater than expression object instance.

Parameters:
lhs The left hand side of the greater than.
rhs The right hand side of the greater than.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::boolean_ge_boolean_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The boolean_ge_boolean_expression_factory method is used to create a new greater than or equal expression object instance.

Parameters:
lhs The left hand side of the greater than or equal.
rhs The right hand side of the greater than or equal.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::integer_ge_integer_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The integer_ge_integer_expression_factory method is used to create a new greater than or equal expression object instance.

Parameters:
lhs The left hand side of the greater than or equal.
rhs The right hand side of the greater than or equal.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::real_ge_real_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The real_ge_real_expression_factory method is used to create a new greater than or equal expression object instance.

Parameters:
lhs The left hand side of the greater than or equal.
rhs The right hand side of the greater than or equal.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::string_ge_string_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The string_ge_string_expression_factory method is used to create a new greater than or equal expression object instance.

Parameters:
lhs The left hand side of the greater than or equal.
rhs The right hand side of the greater than or equal.
Returns:
A pointer to an expression object.

Implements translator.

symbol* translator_pretty::function_symbol_factory ( const rcstring name,
const scope::pointer scp,
int  lex_level 
) [protected, virtual]

The function_symbol_factory is used to create translator-specific function objects. They need to be translator specific, because they need to know how to create translator-specific function call expression nodes.

Parameters:
name The name of the function
scp The scope this function defines.
lex_level The function nesting level.
Returns:
pointer to new function symbol in dynamic memory

Implements translator.

expression::pointer translator_pretty::dereference_expression_factory ( const expression::pointer arg  )  [protected, virtual]

The dereference_expression_factory method is used to create a new dereference expression object instance.

Parameters:
arg The operand of the dereference.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::logical_and_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The logical_and_expression_factory method is used to create a new logical and expression object instance.

Parameters:
lhs The left hand side of the logical and.
rhs The right hand side of the logical and.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::logical_or_expression_factory ( const expression::pointer lhs,
const expression::pointer rhs 
) [protected, virtual]

The logical_or_expression_factory method is used to create a new logical or expression object instance.

Parameters:
lhs The left hand side of the logical or.
rhs The right hand side of the logical or.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::logical_not_expression_factory ( const expression::pointer arg  )  [protected, virtual]

The logical_not_expression_factory method is used to create a new negate expression object instance.

Parameters:
arg The expression to be logically negated.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::real_from_integer_expression_factory ( const expression::pointer arg  )  [protected, virtual]

The real_from_integer_expression_factory method is used to build an implcit real(integer) cast expression node.

Parameters:
arg The integer expression to promote to a real value.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::sizeof_expression_factory ( const expression::pointer arg  )  [protected, virtual]

The sizeof_expression_factory method is used by the sizeof_expression method after routine checks.

Parameters:
arg The expression who's type we want the size of.
Returns:
An expression with the size as a constant.

Reimplemented from translator.

expression::pointer translator_pretty::sizeof_expression_factory ( const type::pointer arg  )  [protected, virtual]

The sizeof_expression_factory method is used by the sizeof_expression method after routine checks.

Parameters:
arg The type we want the size of.
Returns:
An expression with the size as a constant.

Implements translator.

symbol* translator_pretty::builtin_chr_factory (  )  [protected, virtual]

The builtin_chr_factory method is used to create the translator specific implmentation of the built in "chr" function.

Implements translator.

symbol* translator_pretty::builtin_dec_factory (  )  [protected, virtual]

The builtin_dec_factory method is used to create the translator specific implmentation of the built in "dec" function.

Implements translator.

symbol* translator_pretty::builtin_inc_factory (  )  [protected, virtual]

The builtin_inc_factory method is used to create the translator specific implmentation of the built in "inc" function.

Implements translator.

symbol* translator_pretty::builtin_odd_factory (  )  [protected, virtual]

The builtin_odd_factory method is used to create the translator specific implmentation of the built in "odd" function.

Implements translator.

symbol* translator_pretty::builtin_ord_factory (  )  [protected, virtual]

The builtin_ord_factory method is used to create the translator specific implmentation of the built in "ord" function.

Implements translator.

symbol* translator_pretty::builtin_pred_factory (  )  [protected, virtual]

The builtin_pred_factory method is used to create the translator specific implmentation of the built in "pred" function.

Implements translator.

symbol* translator_pretty::builtin_sqr_factory (  )  [protected, virtual]

The builtin_sqr_factory method is used to create the translator specific implmentation of the built in "sqr" function.

Implements translator.

symbol* translator_pretty::builtin_succ_factory (  )  [protected, virtual]

The builtin_succ_factory method is used to create the translator specific implmentation of the built in "succ" function.

Implements translator.

symbol* translator_pretty::builtin_time_factory (  )  [protected, virtual]

The builtin_time_factory method is used to create the translator specific implmentation of the built in "time" function.

Implements translator.

symbol_function* translator_pretty::builtin_syscall_factory ( const rcstring name,
int  proc_num 
) [protected, virtual]

The builtin_syscall_factory method is used to create a symbol for a segment-zero function or procedure.

Parameters:
name the name of the symbol
proc_num the procedure number within segment zero
Returns:
pointer to dynamically allocated symbol

Implements translator.

expression::pointer translator_pretty::set2set_expression_factory ( const type::pointer to,
const expression::pointer from 
) [protected, virtual]

The set2set_expression_factory method is used to create a new cast expression to convert one set type to another.

Parameters:
to The type of the resulting expression.
from the expression to be cast
Returns:
pointer to new expression node.

Implements translator.

expression::pointer translator_pretty::char_expression_factory ( const location locn,
unsigned char  value 
) [protected, virtual]

The char_expression_factory method is used to create a new char constant expression object instance.

Parameters:
locn The location of the constant
value The value of the char.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::empty_set_expression_factory ( const location locn,
const type::pointer tp 
) [protected, virtual]

The empty_set_expression_factory method is used to create a new empty set expression object instance.

Parameters:
locn The source file location of this expression node.
tp The type of the set.
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::set_expression_factory ( const expression::pointer singleton  )  [protected, virtual]

The set_expression_factory method is used to create a new set expression object instance.

Parameters:
singleton The expression to be the whole of the range
Returns:
A pointer to an expression object.

Implements translator.

expression::pointer translator_pretty::set_expression_factory ( const expression::pointer lo,
const expression::pointer hi 
) [protected, virtual]

The set_expression_factory method is used to create a new set expression object instance.

Parameters:
lo The expression to be the low side of the range
hi The expression to be the high side of the range
Returns:
A pointer to an expression object.

Implements translator.

void translator_pretty::print_token ( const rcstring text  ) 

The print_token method is used to pretty print an output token. It can be anything other then a space or a newline. No line wrapping occurs within a token.

Parameters:
text The text of the token to be printed.

void translator_pretty::print_space (  ) 

The print_space method is used to add a space to the list of output tokens. Line wrapping prefers to occur at spaces.

void translator_pretty::print_eoln ( int  extra_wrap_indent = 0  ) 

The print_eoln method is used to indicate a newline is to be printed. Line wrapping may occur at this point, for over-length lines. The right-most white space is the preferred place to wrap, but failing that, the right-most inter-token point will be used.

Parameters:
extra_wrap_indent Usually, over-length lines are indented by one indent width. This agument indicates how much *more* indenting should occur. This is no way to request no indenting for over-length lines.

void translator_pretty::indent_more (  ) 

The indent_more method is used to indicate that nesting has occurred, and that the indent depth should increase by the indent width.

void translator_pretty::indent_less (  ) 

The indent_less method is used to indicate that nesting has finished, and that the indent depth should decrease by the indent width.

void translator_pretty::indent_reset (  ) 

The indent reset is used to indicate the indenting should return to zero, hard against the left margin. Use sparingly.

translator_pretty& translator_pretty::operator= ( const translator_pretty  )  [private]

The assignment operator. Do not use.


Member Data Documentation

output_smart_pointer translator_pretty::os [private]

The os instance variable is used to remember the output stream on which to write the formatted text.

Definition at line 380 of file pretty.h.

int translator_pretty::page_width [private]

The page_width instance variable is used to remember the maximum number of characters wide the output is allowed to be.

Definition at line 386 of file pretty.h.

int translator_pretty::indent_width [private]

The indent_width instance variable is used to remember how many column to more right each time the indent increases. Common values are 2, 3, 4, 5 and 8. Research suggests that 2, 3 or 4 are optimal.

Definition at line 394 of file pretty.h.

int translator_pretty::indent_depth [private]

The indent_depth instance variable is used to remember the current number of characters of indent that have accumulated. Always a multiple of indent_width.

Definition at line 401 of file pretty.h.

rcstring_list translator_pretty::line [private]

The line instance variable is used to remember the tokens which comprise the current line being pretty printed.

Definition at line 407 of file pretty.h.

int translator_pretty::undent [private]

The undent instance variable is used to remember how many times to "undent" at the next end-of-line. This is deferred because the code gets much easier to read when it happens tis way, plus humans expect it.

Definition at line 415 of file pretty.h.

bool translator_pretty::have_printed_var_keyword [private]

Definition at line 417 of file pretty.h.


The documentation for this class was generated from the following file:
Generated on Sun Feb 25 01:27:14 2007 for UCSDp-SystemCrossCompiler by  doxygen 1.5.1