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

#include <stringparser.hpp>

Inheritance diagram for Compiler::StringParser:
Collaboration diagram for Compiler::StringParser:

Public Member Functions

 StringParser (ErrorHandler &errorHandler, const Context &context, Literals &literals)
 
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 append (std::vector< Interpreter::Type_Code > &code)
 Append code for parsed string. More...
 
void smashCase ()
 Transform all scanned strings to lower case. More...
 
void reset ()
 Reset parser to clean state (this includes the smashCase function). More...
 
const TokenLocgetTokenLoc () const
 
void discard ()
 
- 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, CommaState }
 

Private Attributes

LiteralsmLiterals
 
State mState
 
std::vector
< Interpreter::Type_Code
mCode
 
bool mSmashCase
 
TokenLoc mTokenLoc
 
bool mDiscard
 

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 Enumeration Documentation

Enumerator
StartState 
CommaState 

Constructor & Destructor Documentation

Compiler::StringParser::StringParser ( ErrorHandler errorHandler,
const Context context,
Literals literals 
)

Member Function Documentation

void Compiler::StringParser::append ( std::vector< Interpreter::Type_Code > &  code)

Append code for parsed string.

Here is the caller graph for this function:

void Compiler::StringParser::discard ( )

If parsing a string, do not add it to the literal table and do not create code for it.

Here is the caller graph for this function:

const TokenLoc & Compiler::StringParser::getTokenLoc ( ) const

Returns TokenLoc object for string. If no string has been parsed, the TokenLoc object will be default initialised.

Here is the caller graph for this function:

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

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

void Compiler::StringParser::reset ( )
virtual

Reset parser to clean state (this includes the smashCase function).

Reimplemented from Compiler::Parser.

Here is the call graph for this function:

Here is the caller graph for this function:

void Compiler::StringParser::smashCase ( )

Transform all scanned strings to lower case.

Here is the caller graph for this function:

Member Data Documentation

std::vector<Interpreter::Type_Code> Compiler::StringParser::mCode
private
bool Compiler::StringParser::mDiscard
private
Literals& Compiler::StringParser::mLiterals
private
bool Compiler::StringParser::mSmashCase
private
State Compiler::StringParser::mState
private
TokenLoc Compiler::StringParser::mTokenLoc
private

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