GCC Middle and Back End API Reference
s_expr_writer Class Reference
Inheritance diagram for s_expr_writer:

Public Member Functions

 s_expr_writer ()
void write_new_line ()
void write_any_indent (int leading_spaces)
void begin_s_expr (const char *tag)
void end_s_expr ()

Private Attributes

int m_indent_amount
int m_had_recent_newline

Detailed Description

   A class for writing out s-expressions, keeping track of newlines and
   nested indentation.  

Constructor & Destructor Documentation

s_expr_writer::s_expr_writer ( )
   class s_expr_writer's trivial constructor.  

Member Function Documentation

void s_expr_writer::begin_s_expr ( const char *  tag)
   Write the beginning of a new s-expresion e.g. "(!foo "
   The writer automatically adds whitespace to show the hierarchical
   structure of the expressions, so each one starts on a new line,
   and any within it will be at an increased indentation level.  

Referenced by state_writer::write_state_array_type(), state_writer::write_state_param_structs(), state_writer::write_state_type(), and state_writer::write_state_typedefs().

void s_expr_writer::end_s_expr ( void  )
   Write out the end of an s-expression: any necssessary indentation,
   a closing parenthesis, and a new line.  

References fatal().

Referenced by state_writer::write_state_param_structs(), state_writer::write_state_type(), and state_writer::write_state_typedefs().

void s_expr_writer::write_any_indent ( int  leading_spaces)
   If we've just had a newline, write the indentation amount, potentially
   omitting some spaces.

   LEADING_SPACES exists to support code that writes strings with leading
   spaces (e.g " foo") which might occur within a line, or could be the first
   thing on a line.  By passing leading_spaces == 1, when such a string is the
   first thing on a line, write_any_indent () swallows the successive
   leading spaces into the indentation so that the "foo" begins at the expected
   column.  

References m_indent_amount, and write_new_line().

Referenced by state_writer::write_state_array_type(), state_writer::write_state_fileloc(), state_writer::write_state_scalar_type(), state_writer::write_state_type(), state_writer::write_state_union_type(), and state_writer::write_state_version().

void s_expr_writer::write_new_line ( void  )
   Write a newline to the output file, merging adjacent newlines.  
     Don't add a newline if we've just had one.  

References m_had_recent_newline, and m_indent_amount.

Referenced by write_any_indent().


Field Documentation

int s_expr_writer::m_had_recent_newline
private

Referenced by write_new_line().

int s_expr_writer::m_indent_amount
private

Referenced by write_any_indent(), and write_new_line().


The documentation for this class was generated from the following file: