Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Xfc::G::Scanner Class Reference

A general purpose lexical scanner. More...

#include <xfc/glib/scanner.hh>

Inheritance diagram for Xfc::G::Scanner:

Xfc::Object Xfc::Trackable List of all members.

Public Types

Public Member Functions

Accessors
Methods

Detailed Description

A general purpose lexical scanner.


Constructor & Destructor Documentation

Xfc::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.

Xfc::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.

Xfc::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.

Xfc::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

GTokenType Xfc::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.

GTokenType Xfc::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 Xfc::G::Scanner::input_file ( int  input_fd  ) 

Prepares to scan a file.

Parameters:
input_fd A file descriptor.

void Xfc::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 Xfc::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 Xfc::G::Scanner::input_text ( const String text  ) 

Prepares to scan a text buffer.

Parameters:
text The text buffer to scan.

unsigned int Xfc::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 Xfc::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 Xfc::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.

void* Xfc::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 Xfc::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* Xfc::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.

void Xfc::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.

void Xfc::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: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3