Scanner Class Reference

Scanner reads scripts by checking individual tokens. More...

#include <scanner.h>


class  ParserState

Public Types

enum  MessageLevel { ML_ERROR, ML_WARNING, ML_NOTICE }

Public Member Functions

 Scanner (const char *data, int length=-1)
void checkForMeta ()
void checkForWhitespace ()
bool checkToken (char token)
int currentLine () const
int currentLinePos () const
int currentPos () const
unsigned int currentScanPos () const
void expandState ()
void mustGetToken (char token)
bool nextString ()
bool nextToken (bool autoExpandState=true)
const ParserStateoperator* () const
const ParserStateoperator-> () const
void rewind ()
const char * scriptData () const
 Only can rewind one step. More...
void scriptMessage (MessageLevel level, const char *error,...) const
void setScriptIdentifier (const QString &ident)
int skipLine ()
ParserStatestate ()
const ParserStatestate () const
bool tokensLeft () const

Static Public Member Functions

static const QString & escape (QString &str)
static void setMessageHandler (void(*handler)(MessageLevel, const char *, va_list))
static const QString & unescape (QString &str)

Protected Member Functions

void incrementLine ()

Detailed Description

Scanner reads scripts by checking individual tokens.


Definition at line 75 of file scanner.h.

Member Function Documentation

void Scanner::checkForWhitespace ( )

Moves the position ahead any whitespace that there might be from the current position.

Definition at line 165 of file scanner.cpp.

bool Scanner::checkToken ( char  token)

This function will scan the next token and return if it is of the specified type. If it returns true, then the position will be moved to after the token, otherwise it will be reset.

Definition at line 237 of file scanner.cpp.

void Scanner::expandState ( )

Transfers nextState over for use.

Definition at line 276 of file scanner.cpp.

void Scanner::incrementLine ( )

Changes the values in line and lineStart, does not change the actual scanning position in the file.

Definition at line 286 of file scanner.cpp.

bool Scanner::nextToken ( bool  autoExpandState = true)

Gets whatever token is next returning true on success.

expandStateUsed by checkToken, leave as true.

Definition at line 364 of file scanner.cpp.

const char * Scanner::scriptData ( ) const

Only can rewind one step.

Definition at line 677 of file scanner.cpp.

bool Scanner::tokensLeft ( ) const

Returns true if there is still more to read.

Definition at line 757 of file scanner.cpp.

The documentation for this class was generated from the following files: