]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - lexer.h
Smaller memory footprint, 4/8 bytes vs 12/24 for individual token lex_ctx's. Use...
[xonotic/gmqcc.git] / lexer.h
diff --git a/lexer.h b/lexer.h
index cde0863e80877952a7dd8f518bed167ed0355780..b73fa5f1dbdcbc2c2850006edc57bf6224203667 100644 (file)
--- a/lexer.h
+++ b/lexer.h
@@ -22,7 +22,6 @@
  */
 #ifndef GMQCC_LEXER_HDR
 #define GMQCC_LEXER_HDR
-
 typedef struct token_s token;
 
 struct token_s {
@@ -42,7 +41,7 @@ struct token_s {
     struct token_s *prev;
 #endif
 
-    lex_ctx ctx;
+    lex_ctx *ctx;
 };
 
 #if 0
@@ -111,10 +110,15 @@ typedef struct lex_file_s {
     size_t      open_string_length;
     size_t      open_string_pos;
 
-    char   *name;
-    size_t  line;
     size_t  sline; /* line at the start of a token */
-    size_t  column;
+
+    /* 
+     * no more 'shallow' copies, instead all new instances
+     * of a lex_ctx will just point to this lex_file::ctx.
+     * i.e 4/8 byte pointer. Instead of every token getting
+     * a 'shallow' 12/24 byte structure.
+     */
+    lex_ctx ctx;
 
     int     peek[256];
     size_t  peekpos;