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::LineParser Class Reference

Line parser, to be used in console scripts and as part of ScriptParser. More...

#include <lineparser.hpp>

Inheritance diagram for Compiler::LineParser:
Collaboration diagram for Compiler::LineParser:

Public Member Functions

 LineParser (ErrorHandler &errorHandler, const Context &context, Locals &locals, Literals &literals, std::vector< Interpreter::Type_Code > &code, bool allowExpression=false)
 
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. More...
 
- Public Member Functions inherited from Compiler::Parser
 Parser (ErrorHandler &errorHandler, const Context &context)
 constructor More...
 
virtual ~Parser ()
 destructor More...
 
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 {
  BeginState, SetState, SetLocalVarState, SetGlobalVarState,
  SetPotentialMemberVarState, SetMemberVarState, SetMemberVarState2, MessageState,
  MessageCommaState, MessageButtonState, MessageButtonCommaState, EndState,
  PotentialEndState, PotentialExplicitState, ExplicitState, MemberState
}
 

Private Member Functions

void parseExpression (Scanner &scanner, const TokenLoc &loc)
 

Private Attributes

LocalsmLocals
 
LiteralsmLiterals
 
std::vector
< Interpreter::Type_Code > & 
mCode
 
State mState
 
std::string mName
 
std::string mMemberName
 
bool mReferenceMember
 
int mButtons
 
std::string mExplicit
 
char mType
 
ExprParser mExprParser
 
bool mAllowExpression
 

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)
 

Detailed Description

Line parser, to be used in console scripts and as part of ScriptParser.

Member Enumeration Documentation

Enumerator
BeginState 
SetState 
SetLocalVarState 
SetGlobalVarState 
SetPotentialMemberVarState 
SetMemberVarState 
SetMemberVarState2 
MessageState 
MessageCommaState 
MessageButtonState 
MessageButtonCommaState 
EndState 
PotentialEndState 
PotentialExplicitState 
ExplicitState 
MemberState 

Constructor & Destructor Documentation

Compiler::LineParser::LineParser ( ErrorHandler errorHandler,
const Context context,
Locals locals,
Literals literals,
std::vector< Interpreter::Type_Code > &  code,
bool  allowExpression = false 
)
Parameters
allowExpressionAllow lines consisting of a naked expression (result is send to the messagebox interface)

Member Function Documentation

void Compiler::LineParser::parseExpression ( Scanner scanner,
const TokenLoc loc 
)
private

Here is the call graph for this function:

Here is the caller graph for this function:

bool Compiler::LineParser::parseFloat ( float  value,
const TokenLoc loc,
Scanner scanner 
)
virtual

Handle a float token.

Returns
fetch another token?

Reimplemented from Compiler::Parser.

Here is the call graph for this function:

bool Compiler::LineParser::parseInt ( int  value,
const TokenLoc loc,
Scanner scanner 
)
virtual

Handle an int token.

Returns
fetch another token?

Reimplemented from Compiler::Parser.

Here is the call graph for this function:

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

Handle a keyword token.

Returns
fetch another token?
Todo:
add option to disable this
Todo:
add option to disable this

Reimplemented from Compiler::Parser.

Here is the call graph for this function:

Here is the caller graph for this function:

bool Compiler::LineParser::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:

Here is the caller graph for this function:

bool Compiler::LineParser::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:

Here is the caller graph for this function:

void Compiler::LineParser::reset ( )
virtual

Reset parser to clean state.

Reimplemented from Compiler::Parser.

Here is the caller graph for this function:

Member Data Documentation

bool Compiler::LineParser::mAllowExpression
private
int Compiler::LineParser::mButtons
private
std::vector<Interpreter::Type_Code>& Compiler::LineParser::mCode
private
std::string Compiler::LineParser::mExplicit
private
ExprParser Compiler::LineParser::mExprParser
private
Literals& Compiler::LineParser::mLiterals
private
Locals& Compiler::LineParser::mLocals
private
std::string Compiler::LineParser::mMemberName
private
std::string Compiler::LineParser::mName
private
bool Compiler::LineParser::mReferenceMember
private
State Compiler::LineParser::mState
private
char Compiler::LineParser::mType
private

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