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

#include <scripthighlighter.hpp>

Inheritance diagram for CSVWorld::ScriptHighlighter:
Collaboration diagram for CSVWorld::ScriptHighlighter:

Public Types

enum  Type {
  Type_Int = 0, Type_Float = 1, Type_Name = 2, Type_Keyword = 3,
  Type_Special = 4, Type_Comment = 5, Type_Highlight = 6, Type_Id = 7
}
 
enum  Mode { Mode_General, Mode_Console, Mode_Dialogue }
 

Public Member Functions

 ScriptHighlighter (const CSMWorld::Data &data, Mode mode, QTextDocument *parent)
 
virtual void highlightBlock (const QString &text)
 
void setMarkOccurrences (bool)
 
void setMarkedWord (const std::string &name)
 
void invalidateIds ()
 
bool settingChanged (const CSMPrefs::Setting *setting)
 

Private Member Functions

virtual bool parseInt (int value, const Compiler::TokenLoc &loc, Compiler::Scanner &scanner)
 
virtual bool parseFloat (float value, const Compiler::TokenLoc &loc, Compiler::Scanner &scanner)
 
virtual bool parseName (const std::string &name, const Compiler::TokenLoc &loc, Compiler::Scanner &scanner)
 
virtual bool parseKeyword (int keyword, const Compiler::TokenLoc &loc, Compiler::Scanner &scanner)
 
virtual bool parseSpecial (int code, const Compiler::TokenLoc &loc, Compiler::Scanner &scanner)
 
virtual bool parseComment (const std::string &comment, const Compiler::TokenLoc &loc, Compiler::Scanner &scanner)
 
virtual void parseEOF (Compiler::Scanner &scanner)
 Handle EOF token. More...
 
void highlight (const Compiler::TokenLoc &loc, Type type)
 
- Private Member Functions inherited from Compiler::Parser
 Parser (ErrorHandler &errorHandler, const Context &context)
 constructor More...
 
virtual ~Parser ()
 destructor More...
 
virtual void reset ()
 Reset parser to clean state. More...
 
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...
 
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...
 
ErrorHandler & getErrorHandler ()
 Return error handler. More...
 
const Context & getContext () const
 Return context. More...
 

Private Attributes

Compiler::NullErrorHandler mErrorHandler
 
Compiler::Extensions mExtensions
 
CSMWorld::ScriptContext mContext
 
std::map< Type, QTextCharFormat > mScheme
 
Mode mMode
 
bool mMarkOccurrences
 
std::string mMarkedWord
 

Additional Inherited Members

- Static Private Member Functions inherited from Compiler::Parser
static std::string toLower (const std::string &name)
 

Member Enumeration Documentation

Enumerator
Mode_General 
Mode_Console 
Mode_Dialogue 
Enumerator
Type_Int 
Type_Float 
Type_Name 
Type_Keyword 
Type_Special 
Type_Comment 
Type_Highlight 
Type_Id 

Constructor & Destructor Documentation

CSVWorld::ScriptHighlighter::ScriptHighlighter ( const CSMWorld::Data &  data,
Mode  mode,
QTextDocument *  parent 
)

Here is the call graph for this function:

Member Function Documentation

void CSVWorld::ScriptHighlighter::highlight ( const Compiler::TokenLoc &  loc,
Type  type 
)
private

Here is the caller graph for this function:

void CSVWorld::ScriptHighlighter::highlightBlock ( const QString &  text)
virtual

Here is the call graph for this function:

void CSVWorld::ScriptHighlighter::invalidateIds ( )
bool CSVWorld::ScriptHighlighter::parseComment ( const std::string &  comment,
const Compiler::TokenLoc &  loc,
Compiler::Scanner &  scanner 
)
privatevirtual

Handle comment token.

Returns
fetch another token?

Reimplemented from Compiler::Parser.

void CSVWorld::ScriptHighlighter::parseEOF ( Compiler::Scanner &  scanner)
privatevirtual

Handle EOF token.

Reimplemented from Compiler::Parser.

bool CSVWorld::ScriptHighlighter::parseFloat ( float  value,
const Compiler::TokenLoc &  loc,
Compiler::Scanner &  scanner 
)
privatevirtual

Handle a float token.

Returns
fetch another token?

Reimplemented from Compiler::Parser.

bool CSVWorld::ScriptHighlighter::parseInt ( int  value,
const Compiler::TokenLoc &  loc,
Compiler::Scanner &  scanner 
)
privatevirtual

Handle an int token.

Returns
fetch another token?

Reimplemented from Compiler::Parser.

Here is the call graph for this function:

bool CSVWorld::ScriptHighlighter::parseKeyword ( int  keyword,
const Compiler::TokenLoc &  loc,
Compiler::Scanner &  scanner 
)
privatevirtual

Handle a keyword token.

Returns
fetch another token?

Reimplemented from Compiler::Parser.

bool CSVWorld::ScriptHighlighter::parseName ( const std::string &  name,
const Compiler::TokenLoc &  loc,
Compiler::Scanner &  scanner 
)
privatevirtual

Handle a name token.

Returns
fetch another token?

Reimplemented from Compiler::Parser.

bool CSVWorld::ScriptHighlighter::parseSpecial ( int  code,
const Compiler::TokenLoc &  loc,
Compiler::Scanner &  scanner 
)
privatevirtual

Handle a special character token.

Returns
fetch another token?

Reimplemented from Compiler::Parser.

void CSVWorld::ScriptHighlighter::setMarkedWord ( const std::string &  name)
void CSVWorld::ScriptHighlighter::setMarkOccurrences ( bool  flag)
bool CSVWorld::ScriptHighlighter::settingChanged ( const CSMPrefs::Setting *  setting)

Here is the call graph for this function:

Member Data Documentation

CSMWorld::ScriptContext CSVWorld::ScriptHighlighter::mContext
private
Compiler::NullErrorHandler CSVWorld::ScriptHighlighter::mErrorHandler
private
Compiler::Extensions CSVWorld::ScriptHighlighter::mExtensions
private
std::string CSVWorld::ScriptHighlighter::mMarkedWord
private
bool CSVWorld::ScriptHighlighter::mMarkOccurrences
private
Mode CSVWorld::ScriptHighlighter::mMode
private
std::map<Type, QTextCharFormat> CSVWorld::ScriptHighlighter::mScheme
private

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