scriptreader.h

changeset 38
e4bbd540663b
parent 37
c349dca807f9
child 40
9e4f785501db
equal deleted inserted replaced
37:c349dca807f9 38:e4bbd540663b
45 #include "str.h" 45 #include "str.h"
46 #include "objwriter.h" 46 #include "objwriter.h"
47 #include "commands.h" 47 #include "commands.h"
48 48
49 #define MAX_FILESTACK 8 49 #define MAX_FILESTACK 8
50 #define MAX_STRUCTSTACK 32
50 51
51 class ScriptVar; 52 class ScriptVar;
52 53
53 class ScriptReader { 54 class ScriptReader {
54 public: 55 public:
59 int fc; 60 int fc;
60 61
61 unsigned int pos[MAX_FILESTACK]; 62 unsigned int pos[MAX_FILESTACK];
62 unsigned int curline[MAX_FILESTACK]; 63 unsigned int curline[MAX_FILESTACK];
63 unsigned int curchar[MAX_FILESTACK]; 64 unsigned int curchar[MAX_FILESTACK];
65 unsigned int blockstack[MAX_STRUCTSTACK];
64 long savedpos[MAX_FILESTACK]; // filepointer cursor position 66 long savedpos[MAX_FILESTACK]; // filepointer cursor position
65 str token; 67 str token;
66 int commentmode; 68 int commentmode;
67 long prevpos; 69 long prevpos;
68 str prevtoken; 70 str prevtoken;
83 void MustNext (const char* c = ""); 85 void MustNext (const char* c = "");
84 void MustThis (const char* c); 86 void MustThis (const char* c);
85 void MustString (bool gotquote = false); 87 void MustString (bool gotquote = false);
86 void MustNumber (bool fromthis = false); 88 void MustNumber (bool fromthis = false);
87 void MustBool (); 89 void MustBool ();
88 void MustValue (int type);
89 bool BoolValue (); 90 bool BoolValue ();
90 91
91 void ParserError (const char* message, ...); 92 void ParserError (const char* message, ...);
92 void ParserWarning (const char* message, ...); 93 void ParserWarning (const char* message, ...);
93 94
131 OPER_ASSIGN, 132 OPER_ASSIGN,
132 OPER_ASSIGNADD, 133 OPER_ASSIGNADD,
133 OPER_ASSIGNSUB, 134 OPER_ASSIGNSUB,
134 OPER_ASSIGNMUL, 135 OPER_ASSIGNMUL,
135 OPER_ASSIGNDIV, 136 OPER_ASSIGNDIV,
136 OPER_ASSIGNMOD 137 OPER_ASSIGNMOD, // -- 10
138 OPER_EQUALS,
139 OPER_NOTEQUALS,
140 OPER_LESSTHAN,
141 OPER_GREATERTHAN,
142 OPER_LESSTHANEQUALS,
143 OPER_GREATERTHANEQUALS,
137 }; 144 };
138 145
139 // Mark types 146 // Mark types
140 enum { 147 enum {
141 MARKTYPE_LABEL, 148 MARKTYPE_LABEL,

mercurial