lestes::lang::cplus::lex::condition_stack Class Reference

Conditional directive stack. More...

#include <condition_stack.hh>

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

Inheritance graph
[legend]
List of all members.

Public Types

enum  directive_type {
  DIR_IF = 1, DIR_IFDEF = 2, DIR_IFNDEF = 3, DIR_ELIF = 4,
  DIR_ELSE = 5, DIR_ENDIF = 6, DIR_EOF = 7
}
 Types of directives. More...

Public Member Functions

bool active_get (void) const
 Tests if the output is active.
bool process (directive_type a_dir, bool value, const ptr< source_location > &a_location)
 Processes a directive.
ulint depth (void) const
 Returns depth of the stack.

Static Public Member Functions

static ptr< condition_stackcreate (void)
 Returns new object.

Protected Member Functions

 condition_stack (void)
 Creates new object.
virtual void gc_mark (void)
 Marks the object.

Private Types

typedef ::lestes::std::vector<
srp< condition > > 
cstack_type
 Conditions stack type.

Private Attributes

bool active
 Output activity flag.
srp< cstack_typecstack
 Conditions stack.

Detailed Description

Conditional directive stack.

Represents stack of conditional directives. Holds information in stack of unfinished directives.


Member Typedef Documentation

typedef ::lestes::std::vector< srp<condition> > lestes::lang::cplus::lex::condition_stack::cstack_type [private]

Conditions stack type.


Member Enumeration Documentation

enum lestes::lang::cplus::lex::condition_stack::directive_type

Types of directives.

Enumerator:
DIR_IF  Directive if.
DIR_IFDEF  Directive ifdef.
DIR_IFNDEF  Directive ifndef.
DIR_ELIF  Directive elif.
DIR_ELSE  Directive else.
DIR_ENDIF  Directive endif.
DIR_EOF  End of file.


Constructor & Destructor Documentation

lestes::lang::cplus::lex::condition_stack::condition_stack ( void   )  [protected]

Creates new object.

Creates empty condition stack.

Postcondition:
active == true


Member Function Documentation

bool lestes::lang::cplus::lex::condition_stack::active_get ( void   )  const

Tests if the output is active.

Tests if the output is active.

Returns:
true If tokens shall be output for the current condition.

bool lestes::lang::cplus::lex::condition_stack::process ( directive_type  a_dir,
bool  value,
const ptr< source_location > &  a_location 
)

Processes a directive.

Processes conditional directive, issues any error messages.

Precondition:
a_location != NULL
Parameters:
a_dir The directive to process
value The value of the condition for if-like directives.
a_location The location of the directive.
Returns:
true If the directive is correct in the current context.

ulint lestes::lang::cplus::lex::condition_stack::depth ( void   )  const

Returns depth of the stack.

Returns depth of the condition stack.

Returns:
The number of nested conditions.

ptr< condition_stack > lestes::lang::cplus::lex::condition_stack::create ( void   )  [static]

Returns new object.

Returns empty condition stack.

Returns:
An empty condition stack.

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

Marks the object.

Marks the object.

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


Member Data Documentation

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

Output activity flag.

srp<cstack_type> lestes::lang::cplus::lex::condition_stack::cstack [private]

Conditions stack.


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