scriptreader.h

changeset 68
588cc27e84bb
parent 66
4fc1ec88aa41
--- a/scriptreader.h	Wed Dec 19 04:20:02 2012 +0200
+++ b/scriptreader.h	Wed Dec 19 13:44:18 2012 +0200
@@ -43,8 +43,8 @@
 
 #include <stdio.h>
 #include "str.h"
+#include "commands.h"
 #include "objwriter.h"
-#include "commands.h"
 
 #define MAX_FILESTACK 8
 #define MAX_SCOPE 32
@@ -52,14 +52,6 @@
 
 class ScriptVar;
 
-enum type_e {
-	TYPE_VOID = 0,
-	TYPE_INT,
-	TYPE_STRING,
-	TYPE_FLOAT,
-	TYPE_BOOL
-};
-
 // Operators
 enum operator_e {
 	OPER_ADD,
@@ -89,6 +81,7 @@
 	OPER_BITWISEAND,
 	OPER_BITWISEEOR,
 	OPER_TERNARY,
+	OPER_STRLEN,
 };
 
 // Mark types
@@ -135,6 +128,13 @@
 };
 
 // ============================================================================
+typedef struct {
+	str name;
+	type_e type;
+	str val;
+} constinfo_t;
+
+// ============================================================================
 // The script reader reads the script, parses it and tells the object writer
 // the bytecode it needs to write to file.
 class ScriptReader {
@@ -181,10 +181,11 @@
 	// parser.cxx:
 	void ParseBotScript (ObjWriter* w);
 	DataBuffer* ParseCommand (CommandDef* comm);
-	DataBuffer* ParseExpression (int reqtype);
+	DataBuffer* ParseExpression (type_e reqtype);
 	DataBuffer* ParseAssignment (ScriptVar* var);
 	int ParseOperator (bool peek = false);
-	DataBuffer* ParseExprValue (int reqtype);
+	DataBuffer* ParseExprValue (type_e reqtype);
+	str ParseFloat ();
 	void PushScope ();
 	
 	// preprocessor.cxx:
@@ -204,6 +205,7 @@
 	str PPReadWord (char &term);
 };
 
+constinfo_t* FindConstant (str token);
 extern bool g_Neurosphere;
 
 #endif // __SCRIPTREADER_H__
\ No newline at end of file

mercurial