OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Compiler::ControlParser Class Reference

#include <controlparser.hpp>

Inheritance diagram for Compiler::ControlParser:
Collaboration diagram for Compiler::ControlParser:

Public Member Functions

 ControlParser (ErrorHandler &errorHandler, const Context &context, Locals &locals, Literals &literals)
 
void appendCode (std::vector< Interpreter::Type_Code > &code) const
 store generated code in code. More...
 
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)
 
void reset ()
 Reset parser to clean state. More...
 
- Public Member Functions inherited from Compiler::Parser
 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 parseComment (const std::string &comment, const TokenLoc &loc, Scanner &scanner)
 
virtual void parseEOF (Scanner &scanner)
 
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...
 

Private Types

enum  State {
  StartState, IfEndState, IfBodyState, IfElseifEndState,
  IfElseifBodyState, IfElseEndState, IfElseBodyState, IfEndifState,
  WhileEndState, WhileBodyState, WhileEndwhileState, IfElseJunkState
}
 
typedef std::vector
< Interpreter::Type_Code
Codes
 
typedef std::vector< std::pair
< Codes, Codes > > 
IfCodes
 

Private Member Functions

bool parseIfBody (int keyword, const TokenLoc &loc, Scanner &scanner)
 
bool parseWhileBody (int keyword, const TokenLoc &loc, Scanner &scanner)
 

Private Attributes

LocalsmLocals
 
LiteralsmLiterals
 
Codes mCode
 
Codes mCodeBlock
 
IfCodes mIfCode
 
LineParser mLineParser
 
ExprParser mExprParser
 
State mState
 

Additional Inherited Members

- Protected Member Functions inherited from Compiler::Parser
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...
 
ErrorHandlergetErrorHandler ()
 Return error handler. More...
 
const ContextgetContext () const
 Return context. More...
 
- Static Protected Member Functions inherited from Compiler::Parser
static std::string toLower (const std::string &name)
 

Member Typedef Documentation

typedef std::vector<std::pair<Codes, Codes> > Compiler::ControlParser::IfCodes
private

Member Enumeration Documentation

Enumerator
StartState 
IfEndState 
IfBodyState 
IfElseifEndState 
IfElseifBodyState 
IfElseEndState 
IfElseBodyState 
IfEndifState 
WhileEndState 
WhileBodyState 
WhileEndwhileState 
IfElseJunkState 

Constructor & Destructor Documentation

Compiler::ControlParser::ControlParser ( ErrorHandler errorHandler,
const Context context,
Locals locals,
Literals literals 
)

Member Function Documentation

void Compiler::ControlParser::appendCode ( std::vector< Interpreter::Type_Code > &  code) const

store generated code in code.

Here is the caller graph for this function:

bool Compiler::ControlParser::parseIfBody ( int  keyword,
const TokenLoc loc,
Scanner scanner 
)
private
Todo:
should be IfElseEndState; add an option for that

Here is the call graph for this function:

Here is the caller graph for this function:

bool Compiler::ControlParser::parseKeyword ( int  keyword,
const TokenLoc loc,
Scanner scanner 
)
virtual

Handle a keyword token.

Returns
fetch another token?

Reimplemented from Compiler::Parser.

Here is the call graph for this function:

Here is the caller graph for this function:

bool Compiler::ControlParser::parseName ( const std::string &  name,
const TokenLoc loc,
Scanner scanner 
)
virtual

Handle a name token.

Returns
fetch another token?

Reimplemented from Compiler::Parser.

Here is the call graph for this function:

bool Compiler::ControlParser::parseSpecial ( int  code,
const TokenLoc loc,
Scanner scanner 
)
virtual

Handle a special character token.

Returns
fetch another token?

Reimplemented from Compiler::Parser.

Here is the call graph for this function:

bool Compiler::ControlParser::parseWhileBody ( int  keyword,
const TokenLoc loc,
Scanner scanner 
)
private

Here is the call graph for this function:

Here is the caller graph for this function:

void Compiler::ControlParser::reset ( )
virtual

Reset parser to clean state.

Reimplemented from Compiler::Parser.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Codes Compiler::ControlParser::mCode
private
Codes Compiler::ControlParser::mCodeBlock
private
ExprParser Compiler::ControlParser::mExprParser
private
IfCodes Compiler::ControlParser::mIfCode
private
LineParser Compiler::ControlParser::mLineParser
private
Literals& Compiler::ControlParser::mLiterals
private
Locals& Compiler::ControlParser::mLocals
private
State Compiler::ControlParser::mState
private

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