Reference Manual
Inti Logo
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

Inti::G::Scanner Class Reference

A general purpose lexical scanner. More...

#include <inti/glib/scanner.h>

Inheritance diagram for Inti::G::Scanner:

Inti::ReferencedObject Inti::ReferencedBase List of all members.

Public Types

Public Member Functions

Constructors
Accessors
Methods

Detailed Description

A general purpose lexical scanner.


Constructor & Destructor Documentation

Inti::G::Scanner::Scanner (  const GScannerConfig *  initial_settings  ) 
 

Construct a new scanner.

Parameters:
initial_settings A GScannerConfig structure specifiying the initial settings for the scanner.

If you pass null for the initial_settings, the default settings are used.

Inti::G::Scanner::Scanner (  GScanner *  scanner  )  [explicit]
 

Construct a scanner from an existing GScanner.

Parameters:
scanner A pointer to a GScanner.

The Scanner object takes over the ownership of the GScanner and destroys it when the destructor is called.


Member Function Documentation

void Inti::G::Scanner::error (  const char *  format,
... 
) 
 

Outputs an error message, via the GScanner message handler.

Parameters:
format The message format. See the printf() documentation.
... The parameters to insert into the format string.

GTokenType Inti::G::Scanner::get_next_token (   )  const
 

Gets the next token, removing it from the input stream.

The token data is placed in the token(), value(), line(), and position() fields.

void Inti::G::Scanner::input_file (  int  input_fd  ) 
 

Prepares to scan a file.

Parameters:
input_fd A file descriptor.

void Inti::G::Scanner::input_text (  const String &  text  ) 
 

Prepares to scan a text buffer.

Parameters:
text The text buffer to scan.

void Inti::G::Scanner::input_text (  const char *  text,
unsigned int  length
) 
 

Prepares to scan a text buffer.

Parameters:
text The text buffer to scan.
length The length of the text buffer.

void* Inti::G::Scanner::lookup_symbol (  const char *  symbol  ) 
 

Looks up a symbol in the current scope and returns its value.

Parameters:
symbol The symbol to look up.
Returns:
The value of symbol in the current scope, or null if symbol is not bound in the current scope.

GTokenType Inti::G::Scanner::peek_next_token (   )  const
 

Gets the next token, without removing it from the input stream.

The token data is placed in the next_token(), next_value(), next_line(), and next_position() fields.

void Inti::G::Scanner::scope_add_symbol (  unsigned int  scope_id,
const char *  symbol,
void *  value
) 
 

Adds a symbol to the given scope.

Parameters:
scope_id The scope id.
symbol The symbol to add.
value The value of the symbol.

void Inti::G::Scanner::scope_foreach_symbol (  unsigned int  scope_id,
const ScopeForeachSymbolSlot *  slot
) 
 

Calls the given slot for each of the symbol/value pairs in the given scope of the scanner.

Parameters:
scope_id The scope id.
slot The ScopeForeachSymbolSlot method to call.

The slot method is passed the symbol and value of each pair as a parameter.

void* Inti::G::Scanner::scope_lookup_symbol (  unsigned int  scope_id,
const char *  symbol
) 
 

Looks up a symbol in a scope and returns its value.

Parameters:
scope_id The scope id.
symbol The symbol to look up.

If the symbol is not bound in the scope, null is returned.

void Inti::G::Scanner::scope_remove_symbol (  unsigned int  scope_id,
const char *  symbol
) 
 

Removes a symbol from a scope.

Parameters:
scope_id The scope id.
symbol The symbol to remove.

unsigned int Inti::G::Scanner::set_scope (  unsigned int  scope_id  ) 
 

Sets the current scope.

Parameters:
scope_id The new scope id.
Returns:
The old scope id.

void Inti::G::Scanner::sync_file_offset (   ) 
 

Rewinds the file descriptor to the current buffer position and blows the file read ahead buffer.

This is useful for third party uses of the scanners filedescriptor, which hooks onto the current scanning position.

void Inti::G::Scanner::warn (  const char *  format,
... 
) 
 

Outputs a warning message, via the GScanner message handler.

Parameters:
format The message format. See the printf() documentation.
... The parameters to insert into the format string.


The documentation for this class was generated from the following file: Main Page - Footer


Generated on Sun Sep 14 20:08:09 2003 for Inti by doxygen 1.3.2 written by Dimitri van Heesch, © 1997-2002