]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - parser.h
ir: fix generation of multi-op vinstrs
[xonotic/gmqcc.git] / parser.h
index a09238df68d768dbd1d0f2fbee2bc5165c0d5686..e5361a8aae020ba1c8ac8d2e2d74bcc78a55ecc9 100644 (file)
--- a/parser.h
+++ b/parser.h
@@ -2,7 +2,7 @@
 #define GMQCC_PARSER_HDR
 #include "gmqcc.h"
 #include "lexer.h"
-//#include "ast.h"
+#include "ast.h"
 
 #include "intrin.h"
 #include "fold.h"
@@ -12,7 +12,10 @@ struct parser_t;
 #define parser_ctx(p) ((p)->lex->tok.ctx)
 
 struct parser_t {
-    parser_t() { }
+    parser_t();
+    ~parser_t();
+
+    void remove_ast();
 
     lex_file *lex;
     int tok;
@@ -45,17 +48,17 @@ struct parser_t {
     std::vector<const char *> continues;
 
     /* A list of hashtables for each scope */
-    ht *variables;
+    std::vector<ht> variables;
     ht htfields;
     ht htglobals;
-    ht *typedefs;
+    std::vector<ht> typedefs;
 
     /* not to be used directly, we use the hash table */
-    ast_expression **_locals;
-    size_t *_blocklocals;
-    ast_value **_typedefs;
-    size_t *_blocktypedefs;
-    lex_ctx_t *_block_ctx;
+    std::vector<ast_expression*> _locals;
+    std::vector<size_t> _blocklocals;
+    std::vector<std::unique_ptr<ast_value>> _typedefs;
+    std::vector<size_t> _blocktypedefs;
+    std::vector<lex_ctx_t> _block_ctx;
 
     /* we store the '=' operator info */
     const oper_info *assign_op;