OpenMW
|
#include <parser.hpp>
Public Member Functions | |
Parser (ErrorHandler &errorHandler, Context &context) | |
constructor | |
virtual | ~Parser () |
destructor | |
virtual bool | parseInt (int value, const TokenLoc &loc, Scanner &scanner) |
virtual bool | parseFloat (float value, const TokenLoc &loc, Scanner &scanner) |
virtual bool | parseName (const std::string &name, const TokenLoc &loc, Scanner &scanner) |
virtual bool | parseKeyword (int keyword, const TokenLoc &loc, Scanner &scanner) |
virtual bool | parseSpecial (int code, const TokenLoc &loc, Scanner &scanner) |
virtual bool | parseComment (const std::string &comment, const TokenLoc &loc, Scanner &scanner) |
virtual void | parseEOF (Scanner &scanner) |
virtual void | reset () |
Reset parser to clean state. | |
void | setOptional (bool optional) |
void | start () |
Mark parser as non-empty (at least one token has been parser). | |
bool | isEmpty () const |
Has anything been parsed? | |
Protected Member Functions | |
void | reportSeriousError (const std::string &message, const TokenLoc &loc) |
Report the error and throw a exception. | |
void | reportError (const std::string &message, const TokenLoc &loc) |
Report the error. | |
void | reportWarning (const std::string &message, const TokenLoc &loc) |
Report the warning without throwing an exception. | |
void | reportEOF () |
Report an unexpected EOF condition. | |
ErrorHandler & | getErrorHandler () |
Return error handler. | |
Context & | getContext () |
Return context. | |
Static Protected Member Functions | |
static std::string | toLower (const std::string &name) |
Private Attributes | |
ErrorHandler & | mErrorHandler |
Context & | mContext |
bool | mOptional |
bool | mEmpty |
Parser base class.
This class defines a callback-parser.
Compiler::Parser::Parser | ( | ErrorHandler & | errorHandler, |
Context & | context | ||
) |
constructor
Compiler::Parser::~Parser | ( | ) | [virtual] |
destructor
Context & Compiler::Parser::getContext | ( | ) | [protected] |
Return context.
ErrorHandler & Compiler::Parser::getErrorHandler | ( | ) | [protected] |
Return error handler.
bool Compiler::Parser::isEmpty | ( | ) | const |
Has anything been parsed?
bool Compiler::Parser::parseComment | ( | const std::string & | comment, |
const TokenLoc & | loc, | ||
Scanner & | scanner | ||
) | [virtual] |
Handle comment token.
Reimplemented in CSVWorld::ScriptHighlighter.
void Compiler::Parser::parseEOF | ( | Scanner & | scanner | ) | [virtual] |
Handle EOF token.
Reimplemented in CSVWorld::ScriptHighlighter, Compiler::FileParser, and Compiler::ScriptParser.
bool Compiler::Parser::parseFloat | ( | float | value, |
const TokenLoc & | loc, | ||
Scanner & | scanner | ||
) | [virtual] |
Handle a float token.
Reimplemented in Compiler::ExprParser, Compiler::LineParser, CSVWorld::ScriptHighlighter, and Compiler::SkipParser.
bool Compiler::Parser::parseInt | ( | int | value, |
const TokenLoc & | loc, | ||
Scanner & | scanner | ||
) | [virtual] |
Handle an int token.
Reimplemented in Compiler::ExprParser, Compiler::LineParser, CSVWorld::ScriptHighlighter, and Compiler::SkipParser.
bool Compiler::Parser::parseKeyword | ( | int | keyword, |
const TokenLoc & | loc, | ||
Scanner & | scanner | ||
) | [virtual] |
Handle a keyword token.
Reimplemented in Compiler::ExprParser, Compiler::LineParser, Compiler::ControlParser, CSVWorld::ScriptHighlighter, Compiler::FileParser, Compiler::ScriptParser, and Compiler::SkipParser.
bool Compiler::Parser::parseName | ( | const std::string & | name, |
const TokenLoc & | loc, | ||
Scanner & | scanner | ||
) | [virtual] |
Handle a name token.
Reimplemented in Compiler::ExprParser, Compiler::LineParser, Compiler::ControlParser, CSVWorld::ScriptHighlighter, Compiler::FileParser, Compiler::ScriptParser, Compiler::StringParser, and Compiler::SkipParser.
bool Compiler::Parser::parseSpecial | ( | int | code, |
const TokenLoc & | loc, | ||
Scanner & | scanner | ||
) | [virtual] |
Handle a special character token.
Reimplemented in Compiler::ExprParser, Compiler::LineParser, Compiler::ControlParser, CSVWorld::ScriptHighlighter, Compiler::FileParser, Compiler::ScriptParser, Compiler::SkipParser, and Compiler::StringParser.
void Compiler::Parser::reportEOF | ( | ) | [protected] |
Report an unexpected EOF condition.
void Compiler::Parser::reportError | ( | const std::string & | message, |
const TokenLoc & | loc | ||
) | [protected] |
Report the error.
void Compiler::Parser::reportSeriousError | ( | const std::string & | message, |
const TokenLoc & | loc | ||
) | [protected] |
Report the error and throw a exception.
void Compiler::Parser::reportWarning | ( | const std::string & | message, |
const TokenLoc & | loc | ||
) | [protected] |
Report the warning without throwing an exception.
void Compiler::Parser::reset | ( | ) | [virtual] |
Reset parser to clean state.
Reimplemented in Compiler::ExprParser, Compiler::LineParser, Compiler::ControlParser, Compiler::FileParser, Compiler::ScriptParser, and Compiler::StringParser.
void Compiler::Parser::setOptional | ( | bool | optional | ) |
Optional mode: If nothign has been parsed yet and an unexpected token is delivered, stop parsing without raising an exception (after a reset the parser is in non-optional mode).
void Compiler::Parser::start | ( | ) |
Mark parser as non-empty (at least one token has been parser).
std::string Compiler::Parser::toLower | ( | const std::string & | name | ) | [static, protected] |
Context& Compiler::Parser::mContext [private] |
Reimplemented in CSVWorld::ScriptHighlighter.
bool Compiler::Parser::mEmpty [private] |
ErrorHandler& Compiler::Parser::mErrorHandler [private] |
Reimplemented in CSVWorld::ScriptHighlighter.
bool Compiler::Parser::mOptional [private] |