OpenMW
|
#include <parser.hpp>
Public Member Functions | |
Parser (ErrorHandler &errorHandler, const Context &context) | |
constructor More... | |
virtual | ~Parser () |
destructor More... | |
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. More... | |
void | setOptional (bool optional) |
void | start () |
Mark parser as non-empty (at least one token has been parser). More... | |
bool | isEmpty () const |
Has anything been parsed? More... | |
Protected Member Functions | |
void | reportSeriousError (const std::string &message, const TokenLoc &loc) |
Report the error and throw a exception. More... | |
void | reportWarning (const std::string &message, const TokenLoc &loc) |
Report the warning without throwing an exception. More... | |
void | reportEOF () |
Report an unexpected EOF condition. More... | |
ErrorHandler & | getErrorHandler () |
Return error handler. More... | |
const Context & | getContext () const |
Return context. More... | |
Static Protected Member Functions | |
static std::string | toLower (const std::string &name) |
Private Attributes | |
ErrorHandler & | mErrorHandler |
const Context & | mContext |
bool | mOptional |
bool | mEmpty |
Parser base class.
This class defines a callback-parser.
Compiler::Parser::Parser | ( | ErrorHandler & | errorHandler, |
const Context & | context | ||
) |
constructor
|
virtual |
destructor
|
protected |
Return context.
|
protected |
Return error handler.
bool Compiler::Parser::isEmpty | ( | ) | const |
Has anything been parsed?
|
virtual |
Handle comment token.
Reimplemented in CSVWorld::ScriptHighlighter.
|
virtual |
Handle EOF token.
Reimplemented in CSVWorld::ScriptHighlighter, Compiler::FileParser, Compiler::ScriptParser, and Compiler::QuickFileParser.
Handle a float token.
Reimplemented in Compiler::ExprParser, Compiler::LineParser, CSVWorld::ScriptHighlighter, Compiler::DiscardParser, Compiler::JunkParser, and Compiler::SkipParser.
Handle an int token.
Reimplemented in Compiler::ExprParser, Compiler::LineParser, CSVWorld::ScriptHighlighter, Compiler::DiscardParser, Compiler::JunkParser, and Compiler::SkipParser.
|
virtual |
Handle a keyword token.
Reimplemented in Compiler::ExprParser, CSVWorld::ScriptHighlighter, Compiler::LineParser, Compiler::ControlParser, Compiler::FileParser, Compiler::StringParser, Compiler::ScriptParser, Compiler::JunkParser, Compiler::SkipParser, Compiler::DeclarationParser, and Compiler::QuickFileParser.
|
virtual |
Handle a name token.
Reimplemented in Compiler::ExprParser, CSVWorld::ScriptHighlighter, Compiler::LineParser, Compiler::ControlParser, Compiler::FileParser, Compiler::StringParser, Compiler::DiscardParser, Compiler::ScriptParser, Compiler::JunkParser, Compiler::SkipParser, Compiler::DeclarationParser, and Compiler::QuickFileParser.
Handle a special character token.
Reimplemented in Compiler::ExprParser, CSVWorld::ScriptHighlighter, Compiler::LineParser, Compiler::ControlParser, Compiler::FileParser, Compiler::StringParser, Compiler::ScriptParser, Compiler::DiscardParser, Compiler::JunkParser, Compiler::SkipParser, Compiler::DeclarationParser, and Compiler::QuickFileParser.
|
protected |
Report an unexpected EOF condition.
|
protected |
Report the error and throw a exception.
|
protected |
Report the warning without throwing an exception.
|
virtual |
Reset parser to clean state.
Reimplemented in Compiler::ExprParser, Compiler::LineParser, Compiler::ControlParser, Compiler::FileParser, Compiler::StringParser, Compiler::ScriptParser, Compiler::DiscardParser, and Compiler::DeclarationParser.
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).
|
staticprotected |
|
private |
|
private |
|
private |
|
private |