OpenMW
Public Member Functions | Private Types | Private Member Functions | Private Attributes
Compiler::LineParser Class Reference

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

#include <lineparser.hpp>

List of all members.

Public Member Functions

 LineParser (ErrorHandler &errorHandler, 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.

Private Types

enum  State {
  BeginState, ShortState, LongState, FloatState,
  SetState, SetLocalVarState, SetGlobalVarState, SetPotentialMemberVarState,
  SetMemberVarState, SetMemberVarState2, MessageState, MessageCommaState,
  MessageButtonState, MessageButtonCommaState, EndState, 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
int mButtons
std::string mExplicit
char mType
ExprParser mExprParser
bool mAllowExpression

Detailed Description

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


Member Enumeration Documentation

Enumerator:
BeginState 
ShortState 
LongState 
FloatState 
SetState 
SetLocalVarState 
SetGlobalVarState 
SetPotentialMemberVarState 
SetMemberVarState 
SetMemberVarState2 
MessageState 
MessageCommaState 
MessageButtonState 
MessageButtonCommaState 
EndState 
PotentialExplicitState 
ExplicitState 
MemberState 

Constructor & Destructor Documentation

Compiler::LineParser::LineParser ( ErrorHandler errorHandler,
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]
bool Compiler::LineParser::parseFloat ( float  value,
const TokenLoc loc,
Scanner scanner 
) [virtual]

Handle a float token.

Returns:
fetch another token?

Reimplemented from Compiler::Parser.

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

Handle an int token.

Returns:
fetch another token?

Reimplemented from Compiler::Parser.

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

Handle a keyword token.

Returns:
fetch another token?

Reimplemented from Compiler::Parser.

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

Handle a name token.

Returns:
fetch another token?
Todo:
add option to make re-declared local variables an error

Reimplemented from Compiler::Parser.

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.

void Compiler::LineParser::reset ( ) [virtual]

Reset parser to clean state.

Reimplemented from Compiler::Parser.


Member Data Documentation

std::string Compiler::LineParser::mExplicit [private]
std::string Compiler::LineParser::mMemberName [private]
std::string Compiler::LineParser::mName [private]

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