glib.ScannerG.ScannerG Class Reference

List of all members.

Detailed Description

Description The GScanner and its associated functions provide a general purpose lexical scanner.


Public Member Functions

GScannergetScannerGStruct ()
 this (GScanner *gScanner)
 Sets our main struct and passes it to the parent class.
void _InputFile (int inputFd)
 Prepares to scan a file.
void _SyncFileOffset ()
 Rewinds the filedescriptor to the current buffer position and blows the file read ahead buffer.
void _InputText (char[] text, uint textLen)
 Prepares to scan a text buffer.
GTokenType _PeekNextToken ()
 Gets the next token, without removing it from the input stream.
GTokenType _GetNextToken ()
 Gets the next token, removing it from the input stream.
uint _CurLine ()
 Gets the current line in the input stream (counting from 1).
uint _CurPosition ()
 Gets the current position in the current line (counting from 0).
GTokenType _CurToken ()
 Gets the current token type.
GTokenValue _CurValue ()
 Gets the current token value.
int _Eof ()
 Returns TRUE if the scanner has reached the end of the file or text buffer.
uint _SetScope (uint scopeId)
 Sets the current scope.
void _ScopeAddSymbol (uint scopeId, char[] symbol, void *value)
 Adds a symbol to the given scope.
void _ScopeForeachSymbol (uint scopeId, GHFunc func, void *userData)
 Calls the given function for each of the symbol/value pairs in the given scope of the GScanner.
void * _ScopeLookupSymbol (uint scopeId, char[] symbol)
 Looks up a symbol in a scope and return its value.
void _ScopeRemoveSymbol (uint scopeId, char[] symbol)
 Removes a symbol from a scope.
void * _LookupSymbol (char[] symbol)
 Looks up a symbol in the current scope and return its value.
void _Warn (char[] format,...)
 Outputs a warning message, via the GScanner message handler.
void _Error (char[] format,...)
 Outputs an error message, via the GScanner message handler.
void _UnexpToken (GTokenType expectedToken, char[] identifierSpec, char[] symbolSpec, char[] symbolName, char[] message, int isError)
 Outputs a message through the scanner's msg_handler, resulting from an unexpected token in the input stream.
void _Destroy ()
 Frees all memory used by the GScanner.

Static Public Member Functions

static ScannerG _New (GScannerConfig *configTempl)
 Creates a new GScanner.

Protected Member Functions

void * getStruct ()
 the main Gtk struct as a void*

Protected Attributes

GScannergScanner
 the main Gtk struct


Constructor & Destructor Documentation

glib.ScannerG.ScannerG.this ( GScanner gScanner  ) 

Sets our main struct and passes it to the parent class.


Member Function Documentation

uint glib.ScannerG.ScannerG._CurLine (  ) 

Gets the current line in the input stream (counting from 1).

scanner: a GScanner. Returns: the current line.

uint glib.ScannerG.ScannerG._CurPosition (  ) 

Gets the current position in the current line (counting from 0).

scanner: a GScanner. Returns: the current position on the line.

GTokenType glib.ScannerG.ScannerG._CurToken (  ) 

Gets the current token type.

This is simply the token field in the GScanner structure. scanner: a GScanner. Returns: the current token type.

GTokenValue glib.ScannerG.ScannerG._CurValue (  ) 

Gets the current token value.

This is simply the value field in the GScanner structure. scanner: a GScanner. Returns: the current token value.

void glib.ScannerG.ScannerG._Destroy (  ) 

Frees all memory used by the GScanner.

scanner: a GScanner.

int glib.ScannerG.ScannerG._Eof (  ) 

Returns TRUE if the scanner has reached the end of the file or text buffer.

scanner: a GScanner. Returns: TRUE if the scanner has reached the end of the file or text buffer.

void glib.ScannerG.ScannerG._Error ( char[]  format,
  ... 
)

Outputs an error message, via the GScanner message handler.

scanner: a GScanner. format: the message format. See the printf() documentation. ...: the parameters to insert into the format string.

GTokenType glib.ScannerG.ScannerG._GetNextToken (  ) 

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

The token data is placed in the token, value, line, and position fields of the GScanner structure. scanner: a GScanner. Returns: the type of the token.

void glib.ScannerG.ScannerG._InputFile ( int  inputFd  ) 

Prepares to scan a file.

scanner: a GScanner. input_fd: a file descriptor.

void glib.ScannerG.ScannerG._InputText ( char[]  text,
uint  textLen 
)

Prepares to scan a text buffer.

scanner: a GScanner. text: the text buffer to scan. text_len: the length of the text buffer.

void* glib.ScannerG.ScannerG._LookupSymbol ( char[]  symbol  ) 

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

If the symbol is not bound in the current scope, NULL is returned. scanner: a GScanner. 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.

static ScannerG glib.ScannerG.ScannerG._New ( GScannerConfig configTempl  )  [static]

Creates a new GScanner.

The config_templ structure specifies the initial settings of the scanner, which are copied into the GScanner config field. If you pass NULL then the default settings are used. config_templ: the initial scanner settings. Returns: the new GScanner.

GTokenType glib.ScannerG.ScannerG._PeekNextToken (  ) 

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 of the GScanner structure. Note that, while the token is not removed from the input stream (i.e. the next call to g_scanner_get_next_token() will return the same token), it will not be reevaluated. This can lead to surprising results when changing scope after peeking for the next token. Getting the next token after switching the scope will return whatever was peeked before, regardless of any symbols that may have been added or removed in the new scope. scanner: a GScanner. Returns: the type of the token.

void glib.ScannerG.ScannerG._ScopeAddSymbol ( uint  scopeId,
char[]  symbol,
void *  value 
)

Adds a symbol to the given scope.

scanner: a GScanner. scope_id: the scope id. symbol: the symbol to add. value: the value of the symbol.

void glib.ScannerG.ScannerG._ScopeForeachSymbol ( uint  scopeId,
GHFunc  func,
void *  userData 
)

Calls the given function for each of the symbol/value pairs in the given scope of the GScanner.

The function is passed the symbol and value of each pair, and the given user_data parameter. scanner: a GScanner. scope_id: the scope id. func: the function to call for each symbol/value pair. user_data: user data to pass to the function.

void* glib.ScannerG.ScannerG._ScopeLookupSymbol ( uint  scopeId,
char[]  symbol 
)

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

If the symbol is not bound in the scope, NULL is returned. scanner: a GScanner. scope_id: the scope id. symbol: the symbol to look up. Returns: the value of symbol in the given scope, or NULL if symbol is not bound in the given scope.

void glib.ScannerG.ScannerG._ScopeRemoveSymbol ( uint  scopeId,
char[]  symbol 
)

Removes a symbol from a scope.

scanner: a GScanner. scope_id: the scope id. symbol: the symbol to remove.

uint glib.ScannerG.ScannerG._SetScope ( uint  scopeId  ) 

Sets the current scope.

scanner: a GScanner. scope_id: the new scope id. Returns: the old scope id.

void glib.ScannerG.ScannerG._SyncFileOffset (  ) 

Rewinds the filedescriptor 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. scanner: a GScanner.

void glib.ScannerG.ScannerG._UnexpToken ( GTokenType  expectedToken,
char[]  identifierSpec,
char[]  symbolSpec,
char[]  symbolName,
char[]  message,
int  isError 
)

Outputs a message through the scanner's msg_handler, resulting from an unexpected token in the input stream.

Note that you should not call g_scanner_peek_next_token() followed by g_scanner_unexp_token() without an intermediate call to g_scanner_get_next_token(), as g_scanner_unexp_token() evaluates the scanner's current token (not the peeked token) to construct part of the message. scanner: a GScanner. expected_token: the expected token. identifier_spec: a string describing how the scanner's user refers to identifiers (NULL defaults to "identifier"). This is used if expected_token is G_TOKEN_IDENTIFIER or G_TOKEN_IDENTIFIER_NULL. symbol_spec: a string describing how the scanner's user refers to symbols (NULL defaults to "symbol"). This is used if expected_token is G_TOKEN_SYMBOL or any token value greater than G_TOKEN_LAST. symbol_name: the name of the symbol, if the scanner's current token is a symbol. message: a message string to output at the end of the warning/error, or NULL. is_error: if TRUE it is output as an error. If FALSE it is output as a warning.

void glib.ScannerG.ScannerG._Warn ( char[]  format,
  ... 
)

Outputs a warning message, via the GScanner message handler.

scanner: a GScanner. format: the message format. See the printf() documentation. ...: the parameters to insert into the format string.

GScanner* glib.ScannerG.ScannerG.getScannerGStruct (  ) 

void* glib.ScannerG.ScannerG.getStruct (  )  [protected]

the main Gtk struct as a void*


Member Data Documentation

GScanner* glib.ScannerG.ScannerG.gScanner [protected]

the main Gtk struct


SourceForge.net Logo DSource.org Logo digitalmars.com Logo