GFC Logo GFC Title Logo
Reference Manual
Main Page  |  Namespace List  |  Alphabetical List  |  Class List  |  File List

GFC::G::Scanner Class Reference

A general purpose lexical scanner. More...

#include <gfc/glib/scanner.hh>

Inheritance diagram for GFC::G::Scanner:

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

Public Types

Public Member Functions

Constructors
Accessors
Methods

Detailed Description

A general purpose lexical scanner.


Constructor & Destructor Documentation

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

GFC::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 GFC::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 GFC::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 GFC::G::Scanner::input_file int  input_fd  ) 
 

Prepares to scan a file.

Parameters:
input_fd A file descriptor.

void GFC::G::Scanner::input_text const String text  ) 
 

Prepares to scan a text buffer.

Parameters:
text The text buffer to scan.

void GFC::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* GFC::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 GFC::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 GFC::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 GFC::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* GFC::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 GFC::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 GFC::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 GFC::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 GFC::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:
Generated on Tue Aug 24 00:04:58 2004 for GFC-Core by doxygen 1.3.8