Scanner reads scripts by checking individual tokens. More...
#include <scanner.h>
Classes | |
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 (unsigned char token) |
bool | nextString () |
bool | nextToken (bool autoExpandState=true) |
const ParserState & | operator* () const |
const ParserState * | operator-> () const |
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 () |
ParserState & | state () |
const ParserState & | state () const |
bool | tokensLeft () const |
Protected Member Functions | |
void | incrementLine () |
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.
|
protected |
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.
expandState | Used 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 756 of file scanner.cpp.