lestes::lang::cplus::lex::line_control Class Reference

Line number control. More...

#include <line_control.hh>

Inheritance diagram for lestes::lang::cplus::lex::line_control:

Inheritance graph
[legend]
List of all members.

Public Member Functions

ptr< source_location > translate_location (const ptr< simple_location > &physical) const
 Translates physical location to source location.
void change_line (const ptr< source_location > &before, ulint line_number)
 Changes line numbering.
void change_file (const lstring &file_name)
 Changes file name.

Static Public Member Functions

static ptr< line_controlcreate (const ptr< file_info > &a_info)
 Returns new instance, initializes with file information.

Protected Member Functions

 line_control (const ptr< file_info > &a_info)
 Creates the object.
virtual void gc_mark (void)
 Marks the object.

Private Member Functions

 line_control (const line_control &)
 Hides copy constructor.
line_controloperator= (const line_control &)
 Hides assignment operator.

Private Attributes

srp< file_info > file
 The file information for locations.
ulint delta
 The delta between physical and logical line number.

Detailed Description

Line number control.

Performs translating physical location to full featured source location information. Handles line number and file name changes as of line directive.


Constructor & Destructor Documentation

lestes::lang::cplus::lex::line_control::line_control ( const ptr< file_info > &  a_file  )  [protected]

Creates the object.

Creates line control, initializes with file information.

Precondition:
a_file != NULL
Parameters:
a_file The file information for the created locations.

lestes::lang::cplus::lex::line_control::line_control ( const line_control  )  [private]

Hides copy constructor.


Member Function Documentation

ptr< source_location > lestes::lang::cplus::lex::line_control::translate_location ( const ptr< simple_location > &  physical  )  const

Translates physical location to source location.

Translates physical location to full source location considering changes of file names.

Parameters:
physical The physical location to translate.
Returns:
The location with current file information and line number transformed appropriately.

void lestes::lang::cplus::lex::line_control::change_line ( const ptr< source_location > &  before,
ulint  line_number 
)

Changes line numbering.

Changes line numbering so that the line after location will be to line_number. The behaviour is as through the line directive.

Parameters:
before Location on line just before the change to take effect, due to multiline comments, it has to be the location of the newline at the end of the line directive.
line_number The new line number for the next line after the line directive.

void lestes::lang::cplus::lex::line_control::change_file ( const lstring &  file_name  ) 

Changes file name.

Changes current file name, so that the location will contain the new file name. The inclusion chain is left intact, only the most nested entry is affected.

Parameters:
file_name The new file name for the current file.

ptr< line_control > lestes::lang::cplus::lex::line_control::create ( const ptr< file_info > &  a_file  )  [static]

Returns new instance, initializes with file information.

Returns new instance, initializes with file information.

Parameters:
a_file The file information for the created locations.

void lestes::lang::cplus::lex::line_control::gc_mark ( void   )  [protected, virtual]

Marks the object.

Marks the object.

Reimplemented from lestes::std::mem::keystone.

line_control& lestes::lang::cplus::lex::line_control::operator= ( const line_control  )  [private]

Hides assignment operator.


Member Data Documentation

srp<file_info> lestes::lang::cplus::lex::line_control::file [private]

The file information for locations.

ulint lestes::lang::cplus::lex::line_control::delta [private]

The delta between physical and logical line number.


The documentation for this class was generated from the following files:
Generated on Mon Feb 12 18:43:44 2007 for lestes by doxygen 1.5.1-20070107