OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
scripthighlighter.hpp
Go to the documentation of this file.
1 #ifndef CSV_WORLD_SCRIPTHIGHLIGHTER_H
2 #define CSV_WORLD_SCRIPTHIGHLIGHTER_H
3 
4 #include <map>
5 
6 #include <QSyntaxHighlighter>
7 
11 
12 #include "../../model/world/scriptcontext.hpp"
13 
14 namespace CSMPrefs
15 {
16  class Setting;
17 }
18 
19 namespace CSVWorld
20 {
22  {
23  public:
24 
25  enum Type
26  {
27  Type_Int = 0,
29  Type_Name = 2,
33  Type_Id = 6
34  };
35 
36  enum Mode
37  {
41  };
42 
43  private:
44 
48  std::map<Type, QTextCharFormat> mScheme;
50 
51  private:
52 
53  virtual bool parseInt (int value, const Compiler::TokenLoc& loc,
54  Compiler::Scanner& scanner);
57 
58  virtual bool parseFloat (float value, const Compiler::TokenLoc& loc,
59  Compiler::Scanner& scanner);
62 
63  virtual bool parseName (const std::string& name,
64  const Compiler::TokenLoc& loc, Compiler::Scanner& scanner);
67 
68  virtual bool parseKeyword (int keyword, const Compiler::TokenLoc& loc,
69  Compiler::Scanner& scanner);
72 
73  virtual bool parseSpecial (int code, const Compiler::TokenLoc& loc,
74  Compiler::Scanner& scanner);
77 
78  virtual bool parseComment (const std::string& comment, const Compiler::TokenLoc& loc,
79  Compiler::Scanner& scanner);
82 
83  virtual void parseEOF (Compiler::Scanner& scanner);
85 
86  void highlight (const Compiler::TokenLoc& loc, Type type);
87 
88  public:
89 
90  ScriptHighlighter (const CSMWorld::Data& data, Mode mode, QTextDocument *parent);
91 
92  virtual void highlightBlock (const QString& text);
93 
94  void invalidateIds();
95 
96  bool settingChanged (const CSMPrefs::Setting *setting);
97  };
98 }
99 
100 #endif
Mode
Definition: scripthighlighter.hpp:36
void highlight(const Compiler::TokenLoc &loc, Type type)
Definition: scripthighlighter.cpp:66
Definition: scripthighlighter.hpp:40
bool settingChanged(const CSMPrefs::Setting *setting)
Definition: scripthighlighter.cpp:113
Definition: scriptcontext.hpp:15
void invalidateIds()
Definition: scripthighlighter.cpp:108
virtual bool parseName(const std::string &name, const Compiler::TokenLoc &loc, Compiler::Scanner &scanner)
Definition: scripthighlighter.cpp:25
Type
Definition: scripthighlighter.hpp:25
Definition: scripthighlighter.hpp:28
virtual void highlightBlock(const QString &text)
Definition: scripthighlighter.cpp:95
virtual bool parseComment(const std::string &comment, const Compiler::TokenLoc &loc, Compiler::Scanner &scanner)
Definition: scripthighlighter.cpp:56
Definition: scripthighlighter.hpp:32
CSMWorld::ScriptContext mContext
Definition: scripthighlighter.hpp:47
Location of a token in a source file.
Definition: tokenloc.hpp:10
std::map< Type, QTextCharFormat > mScheme
Definition: scripthighlighter.hpp:48
Compiler::NullErrorHandler mErrorHandler
Definition: scripthighlighter.hpp:45
virtual void parseEOF(Compiler::Scanner &scanner)
Handle EOF token.
Definition: scripthighlighter.cpp:63
virtual bool parseFloat(float value, const Compiler::TokenLoc &loc, Compiler::Scanner &scanner)
Definition: scripthighlighter.cpp:18
Definition: scripthighlighter.hpp:31
Error handler implementation: Ignore all error messages.
Definition: nullerrorhandler.hpp:10
Definition: scripthighlighter.hpp:30
Collection of compiler extensions.
Definition: extensions.hpp:39
Definition: scripthighlighter.hpp:38
virtual bool parseInt(int value, const Compiler::TokenLoc &loc, Compiler::Scanner &scanner)
Definition: scripthighlighter.cpp:11
virtual bool parseSpecial(int code, const Compiler::TokenLoc &loc, Compiler::Scanner &scanner)
Definition: scripthighlighter.cpp:49
Definition: data.hpp:77
Definition: scripthighlighter.hpp:27
Definition: setting.hpp:22
Definition: scripthighlighter.hpp:29
ScriptHighlighter(const CSMWorld::Data &data, Mode mode, QTextDocument *parent)
Definition: scripthighlighter.cpp:78
Definition: scripthighlighter.hpp:39
int code
Definition: crashcatcher.cpp:70
Compiler::Extensions mExtensions
Definition: scripthighlighter.hpp:46
Mode mMode
Definition: scripthighlighter.hpp:49
Definition: scripthighlighter.hpp:21
Definition: scripthighlighter.hpp:33
Parser base class.
Definition: parser.hpp:17
virtual bool parseKeyword(int keyword, const Compiler::TokenLoc &loc, Compiler::Scanner &scanner)
Definition: scripthighlighter.cpp:32
Scanner.
Definition: scanner.hpp:21
const char * name
Definition: crashcatcher.cpp:59