#include <line_control.hh>
Inheritance diagram for lestes::lang::cplus::lex::line_control:

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_control > | create (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_control & | operator= (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. | |
Performs translating physical location to full featured source location information. Handles line number and file name changes as of line directive.
Definition at line 61 of file line_control.hh.
| 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.
| a_file | The file information for the created locations. |
Definition at line 51 of file line_control.cc.
Referenced by create().
| lestes::lang::cplus::lex::line_control::line_control | ( | const line_control & | ) | [private] |
Hides copy constructor.
| 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.
| physical | The physical location to translate. |
Definition at line 86 of file line_control.cc.
00087 { 00088 return source_location::create(file,physical->line_get() + delta,physical->column_get()); 00089 }
| 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.
| 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. |
Definition at line 64 of file line_control.cc.
References delta.
00065 { 00066 // the new delta is a correction of line_number by physical line number of the next line 00067 delta = line_number - (before->line_get() + 1 - delta); 00068 }
| 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.
| file_name | The new file name for the current file. |
Definition at line 75 of file line_control.cc.
References file.
00076 { 00077 // TODO pt make this a clone on file_info ??? 00078 file = file_info::create(file_name,file->origin_get()); 00079 }
| 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.
| a_file | The file information for the created locations. |
Definition at line 104 of file line_control.cc.
References line_control().
00105 { 00106 return new line_control(a_file); 00107 }
| void lestes::lang::cplus::lex::line_control::gc_mark | ( | void | ) | [protected, virtual] |
Marks the object.
Marks the object.
Reimplemented from lestes::std::mem::keystone.
Definition at line 94 of file line_control.cc.
References file.
00095 { 00096 file.gc_mark(); 00097 object::gc_mark(); 00098 }
| line_control& lestes::lang::cplus::lex::line_control::operator= | ( | const line_control & | ) | [private] |
Hides assignment operator.
srp<file_info> lestes::lang::cplus::lex::line_control::file [private] |
The file information for locations.
Definition at line 78 of file line_control.hh.
Referenced by change_file(), gc_mark(), and translate_location().
ulint lestes::lang::cplus::lex::line_control::delta [private] |
The delta between physical and logical line number.
Definition at line 80 of file line_control.hh.
Referenced by change_line(), and translate_location().
1.5.1-20070107