]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - gmqcc.h
Fix parser bug
[xonotic/gmqcc.git] / gmqcc.h
diff --git a/gmqcc.h b/gmqcc.h
index d8dafe2d337184721d6767387df8dd3600500450..681e53902824dc16d8e231907d78f583352a3867 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
 #define INSTR_BITAND    59
 #define INSTR_BITOR     60
 
-#define mem_a(x) malloc(x)
-#define mem_d(x) free  (x)
-
 /*
  * This is the smallest lexer I've ever wrote: and I must say, it's quite
  * more nicer than those large bulky complex parsers that most people write
@@ -146,7 +143,7 @@ struct lex_file {
 
 /*
  * It's important that this table never exceed 32 keywords, the ascii
- * table starts at 33 (which we need)
+ * table starts at 33 (and we don't want conflicts)
  */
 #define TOKEN_DO       0
 #define TOKEN_ELSE     1
@@ -158,12 +155,11 @@ struct lex_file {
 #define TOKEN_GOTO     7
 #define TOKEN_FOR      8   // extension
 #define TOKEN_TYPEDEF  9   // extension
-#define TOKEN_INT      10  // extension
-#define TOKEN_VOID     11
-#define TOKEN_STRING   12
-#define TOKEN_FLOAT    13
-#define TOKEN_VECTOR   14
-#define TOKEN_ENTITY   15
+#define TOKEN_VOID     10
+#define TOKEN_STRING   11
+#define TOKEN_FLOAT    12
+#define TOKEN_VECTOR   13
+#define TOKEN_ENTITY   14
 
 /*
  * Lexer state constants, these are numbers for where exactly in
@@ -177,7 +173,6 @@ struct lex_file {
 
 int              lex_token(struct lex_file *);
 void             lex_reset(struct lex_file *);
-int              lex_debug(struct lex_file *);
 int              lex_close(struct lex_file *);
 struct lex_file *lex_open (FILE *);
 
@@ -205,4 +200,14 @@ void          typedef_init();
 typedef_node *typedef_find(const char *);
 int           typedef_add (const char *, const char *);
 
+/* alloc.c */
+void *memory_a(unsigned int, unsigned int, const char *);
+void  memory_d(void       *, unsigned int, const char *);
+#ifdef NOTRACK
+#      define mem_a(x) malloc(x)
+#      define mem_d(x) free  (x)
+#else
+#      define mem_a(x) memory_a((x), __LINE__, __FILE__)
+#      define mem_d(x) memory_d((x), __LINE__, __FILE__)
+#endif
 #endif