lestes::lang::cplus::lex::evaluator Class Reference

Directives evaluator. More...

#include <evaluator.hh>

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

Inheritance graph
[legend]
List of all members.

Public Member Functions

bool pragma_flag_get (void) const
 Returns pragma flag.
ptr< pp_tokenread (void)
 Reads single token.

Static Public Member Functions

static ptr< evaluatorcreate (const ptr< file_system > &a_fs, const lstring &file_name)
 Returns new instance.

Protected Member Functions

 evaluator (const ptr< file_system > &a_fs, const lstring &file_name)
 Creates new object.
virtual void gc_mark (void)
 Marks the object.

Private Types

enum  state_type { EMPTY, START, BUFFER, END }
 States of the evaluator. More...
enum  { NESTING_LIMIT = 16 }
typedef ::lestes::std::vector<
srp< unit_part > > 
includes_type
 Type of include stack.

Private Member Functions

ptr< pp_tokenprocess_directive (void)
 Processes directive in buffer.
ptr< pp_tokenparse_include (void)
 Parses include directive in buffer.
void check_extra_tokens (const lstring &name)
 Checks extra tokens in directive.
void push_stream (const ptr< named_istream > &ns, const ptr< source_location > &loc)
 Pushes stream to process.
void pop_stream (void)
 Pops the processed stream.
 evaluator (const evaluator &copy)
 Hides copy constructor.
evaluatoroperator= (const evaluator &rhs)
 Hides assignment operator.

Private Attributes

srp< file_systemfs
 File system binding.
state_type state
 State of the evaluator.
bool active
 Output active flag.
srp< macro_storagemacros
 Storage of defined macros.
srp< includes_typeincludes
 Include stack.
srp< expanderinput
 Input into evaluator.
srp< unit_partpart
 Current unit part.
srp< token_sequencebuffer
 Buffer with pending tokens.
bool pragma_flag
 Flag of encountered pragma.
ulint nesting
 Nesting depth of includes.

Detailed Description

Directives evaluator.

Represents evaluator of preprocessing directives. Manages include stack.


Member Typedef Documentation

typedef ::lestes::std::vector< srp<unit_part> > lestes::lang::cplus::lex::evaluator::includes_type [private]

Type of include stack.


Member Enumeration Documentation

enum lestes::lang::cplus::lex::evaluator::state_type [private]

States of the evaluator.

Enumerator:
EMPTY 
START 
BUFFER 
END 

anonymous enum [private]

Enumerator:
NESTING_LIMIT  Nesting limit of include files.


Constructor & Destructor Documentation

lestes::lang::cplus::lex::evaluator::evaluator ( const ptr< file_system > &  a_fs,
const lstring &  file_name 
) [protected]

Creates new object.

Creates new evaluator, try to start processing given file. The state is set to EMPTY when the file could not be opened, or START.

Precondition:
a_fs != NULL
Parameters:
a_fs The file system binding.
file_name The name of the file to process.

lestes::lang::cplus::lex::evaluator::evaluator ( const evaluator copy  )  [private]

Hides copy constructor.


Member Function Documentation

bool lestes::lang::cplus::lex::evaluator::pragma_flag_get ( void   )  const

Returns pragma flag.

Returns the pragma flag.

Returns:
The pragma flag.

ptr< pp_token > lestes::lang::cplus::lex::evaluator::read ( void   )  [virtual]

Reads single token.

Reads next token from current unit part after evaluation of directives.

Returns:
The next token.

Implements lestes::lang::cplus::lex::pp_filter.

ptr< evaluator > lestes::lang::cplus::lex::evaluator::create ( const ptr< file_system > &  a_fs,
const lstring &  file_name 
) [static]

Returns new instance.

Creates new evaluator, try to start processing given file. The state is set to EMPTY when the file could not be opened, or START.

Precondition:
a_fs != NULL
Parameters:
a_fs The file system binding.
file_name The name of the file to process.
Returns:
The evaluator.

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

Marks the object.

Marks the object.

Reimplemented from lestes::lang::cplus::lex::pp_filter.

ptr< pp_token > lestes::lang::cplus::lex::evaluator::process_directive ( void   )  [private]

Processes directive in buffer.

Processes preprocessor directive in buffer.

Returns:
The next token for read().

ptr< pp_token > lestes::lang::cplus::lex::evaluator::parse_include ( void   )  [private]

Parses include directive in buffer.

Parses buffer as file name part of an include directive. Returns the appropriate token, or NULL in case of failure.

Returns:
The token representing the include directive or NULL.

void lestes::lang::cplus::lex::evaluator::check_extra_tokens ( const lstring &  name  )  [private]

Checks extra tokens in directive.

Checks for extra tokens in buffer before the end of line. Used for issuing error for trailing garbage in directives.

Precondition:
The newline is still in buffer.
Parameters:
name The name of the checked directive.

void lestes::lang::cplus::lex::evaluator::push_stream ( const ptr< named_istream > &  ns,
const ptr< source_location > &  loc 
) [private]

Pushes stream to process.

Pushes a new stream to be processed as a part of a translation unit.

Precondition:
ns != NULL
Parameters:
ns The named stream to process.
loc The location of inclusion or NULL for toplevel stream.

void lestes::lang::cplus::lex::evaluator::pop_stream ( void   )  [private]

Pops the processed stream.

Pops a processed stream, returning to the following in the stack.

Precondition:
state != EMPTY

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

Hides assignment operator.


Member Data Documentation

srp<file_system> lestes::lang::cplus::lex::evaluator::fs [private]

File system binding.

state_type lestes::lang::cplus::lex::evaluator::state [private]

State of the evaluator.

bool lestes::lang::cplus::lex::evaluator::active [private]

Output active flag.

srp<macro_storage> lestes::lang::cplus::lex::evaluator::macros [private]

Storage of defined macros.

srp<includes_type> lestes::lang::cplus::lex::evaluator::includes [private]

Include stack.

srp<expander> lestes::lang::cplus::lex::evaluator::input [private]

Input into evaluator.

Reimplemented from lestes::lang::cplus::lex::pp_filter.

srp<unit_part> lestes::lang::cplus::lex::evaluator::part [private]

Current unit part.

srp<token_sequence> lestes::lang::cplus::lex::evaluator::buffer [private]

Buffer with pending tokens.

bool lestes::lang::cplus::lex::evaluator::pragma_flag [private]

Flag of encountered pragma.

ulint lestes::lang::cplus::lex::evaluator::nesting [private]

Nesting depth of includes.


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