lestes::lang::cplus::lex::pp_lex Class Reference

Integration with flexer. More...

#include <pp_lex.hh>

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

Inheritance graph
[legend]
List of all members.

Public Types

typedef char char_type
 Type of character in lex.
typedef int size_type
 Type of size in lex.

Public Member Functions

virtual ~pp_lex (void)
 Finalizes object.
void activate (void)
 Prepares pp_lex_guts to communicate with this object.
size_type yy_input (char_type *cbuf, size_type max)
 Stores next characters for YY_INPUT.
void location_save (void)
 Saves location of current input token.
ptr< source_location > location_create (void) const
 Creates location for current token.
ptr< line_controllines_get (void) const
 Returns the line control.
ptr< pp_tokenread (bool read_include)
 Reads token from flex.
void interactive_set (bool a_interactive)
 Sets interactive flag.
bool interactive_get (void) const
 Returns interactive flag.

Static Public Member Functions

static ptr< pp_lexcreate (const ptr< pre_lex > &a_input, const ptr< line_control > &a_lines)
 Returns new instance.

Protected Member Functions

 pp_lex (const ptr< pre_lex > &a_input, const ptr< line_control > &a_lines)
 Creates the object.
virtual void gc_mark (void)
 Marks the object.

Private Types

typedef pp_lex_guts::yy_buffer_state * yy_buffer_type
 Type of flex buffer.

Private Member Functions

char_type read_char (void)
 Reads next character from input.
 pp_lex (const pp_lex &copy)
 Hides copy constructor.
pp_lexoperator= (const pp_lex &rhs)
 Hides assignment operator.

Private Attributes

bool interactive
 Flag for interactiveness.
srp< pre_lexinput
 Input stream of tokens.
srp< simple_locationphysical
 Physical location of currently processed token.
srp< line_controllines
 Line control for transforming locations.
srp< ucn_token_bufferbuffer
 Buffer with ucn tokens.
srp< ucn_token_buffererrors
 Error token buffer.
yy_buffer_type yy_buffer
 Flex buffer.

Detailed Description

Integration with flexer.

Handles integration with pp_lex_guts flexer. Passes special character classes to flexer, storing actual characters in own buffer. Each instance is connected to flexer by calling activate() prior to reading tokens (after file change etc.).


Member Typedef Documentation

typedef char lestes::lang::cplus::lex::pp_lex::char_type

Type of character in lex.

typedef int lestes::lang::cplus::lex::pp_lex::size_type

Type of size in lex.

typedef struct pp_lex_guts::yy_buffer_state* lestes::lang::cplus::lex::pp_lex::yy_buffer_type [read, private]

Type of flex buffer.


Constructor & Destructor Documentation

lestes::lang::cplus::lex::pp_lex::~pp_lex ( void   )  [virtual]

Finalizes object.

Finalizes the object, releases flex buffer.

lestes::lang::cplus::lex::pp_lex::pp_lex ( const ptr< pre_lex > &  a_input,
const ptr< line_control > &  a_lines 
) [protected]

Creates the object.

Creates the object, allocates flex buffer.

Precondition:
a_input != NULL

a_lines != NULL

Postcondition:
interactive == true
Parameters:
a_input The input stream of tokens.
a_lines The line control.

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

Hides copy constructor.


Member Function Documentation

void lestes::lang::cplus::lex::pp_lex::activate ( void   ) 

Prepares pp_lex_guts to communicate with this object.

Prepares pp_lex_guts to work with this pp_lex. Sets pp_lex_guts shortcut variables current_utb and current_ppl.

pp_lex::size_type lestes::lang::cplus::lex::pp_lex::yy_input ( char_type cbuf,
size_type  max 
)

Stores next characters for YY_INPUT.

Fills buffer with characters from current source file. Called through YY_INPUT flex macro.

Parameters:
cbuf The buffer to fill.
max Maximum count of characters to fill.
Returns:
The actual count of filled characters.

void lestes::lang::cplus::lex::pp_lex::location_save ( void   ) 

Saves location of current input token.

Saves location of current input token.

ptr< source_location > lestes::lang::cplus::lex::pp_lex::location_create ( void   )  const

Creates location for current token.

Creates location from saved token, file information and line number correction.

Precondition:
location_save() was already called.
Returns:
New location with correct logical line.

ptr<line_control> lestes::lang::cplus::lex::pp_lex::lines_get ( void   )  const

Returns the line control.

ptr< pp_token > lestes::lang::cplus::lex::pp_lex::read ( bool  line_start  ) 

Reads token from flex.

Reads next token from flex.

Parameters:
line_start Whether reading at start of line.
Returns:
The token read from flex.

void lestes::lang::cplus::lex::pp_lex::interactive_set ( bool  a_interactive  ) 

Sets interactive flag.

Sets interactive flag.

Parameters:
a_interactive The new flag.

bool lestes::lang::cplus::lex::pp_lex::interactive_get ( void   )  const

Returns interactive flag.

Returns interactive flag.

Returns:
The flag.

ptr< pp_lex > lestes::lang::cplus::lex::pp_lex::create ( const ptr< pre_lex > &  a_input,
const ptr< line_control > &  a_lines 
) [static]

Returns new instance.

Returns new instance of the object.

Precondition:
a_input != NULL

a_lines != NULL

Parameters:
a_input The input stream of tokens.
a_lines The line control.
Returns:
The new instance with own flexer buffer.

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

Marks the object.

Marks the object.

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

pp_lex::char_type lestes::lang::cplus::lex::pp_lex::read_char ( void   )  [private]

Reads next character from input.

Reads token from input stream, stores it into buffer.

Returns:
The character representing the class of the token on input.

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

Hides assignment operator.


Member Data Documentation

bool lestes::lang::cplus::lex::pp_lex::interactive [private]

Flag for interactiveness.

srp<pre_lex> lestes::lang::cplus::lex::pp_lex::input [private]

Input stream of tokens.

srp<simple_location> lestes::lang::cplus::lex::pp_lex::physical [private]

Physical location of currently processed token.

srp<line_control> lestes::lang::cplus::lex::pp_lex::lines [private]

Line control for transforming locations.

srp<ucn_token_buffer> lestes::lang::cplus::lex::pp_lex::buffer [private]

Buffer with ucn tokens.

srp<ucn_token_buffer> lestes::lang::cplus::lex::pp_lex::errors [private]

Error token buffer.

yy_buffer_type lestes::lang::cplus::lex::pp_lex::yy_buffer [private]

Flex buffer.


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