OpenMW
Public Member Functions | Private Member Functions | Private Attributes
Compiler::ExprParser Class Reference

#include <exprparser.hpp>

List of all members.

Public Member Functions

 ExprParser (ErrorHandler &errorHandler, Context &context, Locals &locals, Literals &literals, bool argument=false)
char getType () const
 Return type of parsed expression ('l' integer, 'f' float)
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)
void reset ()
 Reset parser to clean state.
char append (std::vector< Interpreter::Type_Code > &code)
int parseArguments (const std::string &arguments, Scanner &scanner, std::vector< Interpreter::Type_Code > &code, bool invert=false)

Private Member Functions

int getPriority (char op) const
char getOperandType (int Index=0) const
char getOperator () const
bool isOpen () const
void popOperator ()
void popOperand ()
void replaceBinaryOperands ()
void pop ()
void pushIntegerLiteral (int value)
void pushFloatLiteral (float value)
void pushBinaryOperator (char c)
void close ()
int parseArguments (const std::string &arguments, Scanner &scanner)
bool handleMemberAccess (const std::string &name)

Private Attributes

LocalsmLocals
LiteralsmLiterals
std::vector< char > mOperands
std::vector< char > mOperators
bool mNextOperand
TokenLoc mTokenLoc
std::vector
< Interpreter::Type_Code
mCode
bool mFirst
bool mArgument
std::string mExplicit
bool mRefOp
bool mMemberOp

Constructor & Destructor Documentation

Compiler::ExprParser::ExprParser ( ErrorHandler errorHandler,
Context context,
Locals locals,
Literals literals,
bool  argument = false 
)

constructor

Parameters:
argumentParser is used to parse function- or instruction- arguments (this influences the precedence rules).

Member Function Documentation

char Compiler::ExprParser::append ( std::vector< Interpreter::Type_Code > &  code)

Generate code for parsed expression.

Returns:
Type ('l': integer, 'f': float)
void Compiler::ExprParser::close ( ) [private]
char Compiler::ExprParser::getOperandType ( int  Index = 0) const [private]
char Compiler::ExprParser::getOperator ( ) const [private]
int Compiler::ExprParser::getPriority ( char  op) const [private]

Return type of parsed expression ('l' integer, 'f' float)

bool Compiler::ExprParser::handleMemberAccess ( const std::string &  name) [private]
bool Compiler::ExprParser::isOpen ( ) const [private]
int Compiler::ExprParser::parseArguments ( const std::string &  arguments,
Scanner scanner 
) [private]
int Compiler::ExprParser::parseArguments ( const std::string &  arguments,
Scanner scanner,
std::vector< Interpreter::Type_Code > &  code,
bool  invert = false 
)

Parse sequence of arguments specified by arguments.

Parameters:
argumentsEach character represents one arguments ('l': integer, 'f': float, 'S': string, 'c': string (case smashed), '/': following arguments are optional)
invertStore arguments in reverted order.
Returns:
number of optional arguments
bool Compiler::ExprParser::parseFloat ( float  value,
const TokenLoc loc,
Scanner scanner 
) [virtual]

Handle a float token.

Returns:
fetch another token?

Reimplemented from Compiler::Parser.

bool Compiler::ExprParser::parseInt ( int  value,
const TokenLoc loc,
Scanner scanner 
) [virtual]

Handle an int token.

Returns:
fetch another token?

Reimplemented from Compiler::Parser.

bool Compiler::ExprParser::parseKeyword ( int  keyword,
const TokenLoc loc,
Scanner scanner 
) [virtual]

Handle a keyword token.

Returns:
fetch another token?

Reimplemented from Compiler::Parser.

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

Handle a name token.

Returns:
fetch another token?

Reimplemented from Compiler::Parser.

bool Compiler::ExprParser::parseSpecial ( int  code,
const TokenLoc loc,
Scanner scanner 
) [virtual]

Handle a special character token.

Returns:
fetch another token?

Reimplemented from Compiler::Parser.

void Compiler::ExprParser::pop ( ) [private]
void Compiler::ExprParser::pushBinaryOperator ( char  c) [private]
void Compiler::ExprParser::pushFloatLiteral ( float  value) [private]
void Compiler::ExprParser::pushIntegerLiteral ( int  value) [private]
void Compiler::ExprParser::reset ( ) [virtual]

Reset parser to clean state.

Reimplemented from Compiler::Parser.


Member Data Documentation

std::string Compiler::ExprParser::mExplicit [private]
std::vector<char> Compiler::ExprParser::mOperands [private]
std::vector<char> Compiler::ExprParser::mOperators [private]

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