#include <scanner.h>
Classes | |
struct | 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) |
void | expandState () |
int | currentLine () const |
int | currentLinePos () const |
int | currentPos () const |
unsigned int | currentScanPos () const |
bool | nextString () |
bool | nextToken (bool autoExpandState=true) |
void | mustGetToken (char token) |
void | rewind () |
const char * | scriptData () const |
Only can rewind one step. | |
void | scriptMessage (MessageLevel level, const char *error,...) const |
void | setScriptIdentifier (const QString &ident) |
int | skipLine () |
bool | tokensLeft () |
const ParserState & | operator* () const |
const ParserState * | operator-> () const |
Static Public Member Functions | |
static const QString & | escape (QString &str) |
static const QString & | unescape (QString &str) |
static void | setMessageHandler (void(*handler)(MessageLevel, const char *, va_list)) |
Public Attributes | |
ParserState | state |
Protected Member Functions | |
void | incrementLine () |
Scanner reads scripts by checking individual tokens.
void Scanner::checkForWhitespace | ( | ) |
Moves the position ahead any whitespace that there might be from the current position.
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.
void Scanner::expandState | ( | ) |
Transfers nextState over for use.
void Scanner::incrementLine | ( | ) | [protected] |
Changes the values in line and lineStart, does not change the actual scanning position in the file.
bool Scanner::nextToken | ( | bool | autoExpandState = true |
) |
Gets whatever token is next returning true on success.
expandState | Used by checkToken, leave as true. |
bool Scanner::tokensLeft | ( | ) | [inline] |
Returns true if there is still more to read.