1 #ifndef GMQCC_PARSER_HDR
2 #define GMQCC_PARSER_HDR
12 std::vector<ast_value*> imm_float;
13 std::vector<ast_value*> imm_vector;
14 std::vector<ast_value*> imm_string;
15 hash_table_t *imm_string_untranslate; /* map<string, ast_value*> */
16 hash_table_t *imm_string_dotranslate; /* map<string, ast_value*> */
19 #define parser_ctx(p) ((p)->lex->tok.ctx)
29 std::vector<ast_expression *> globals;
30 std::vector<ast_expression *> fields;
31 std::vector<ast_function *> functions;
34 /* must be deleted first, they reference immediates and values */
35 std::vector<ast_value *> accessors;
38 ast_value *reserved_version;
43 ast_function *function;
46 /* All the labels the function defined...
47 * Should they be in ast_function instead?
49 std::vector<ast_label*> labels;
50 std::vector<ast_goto*> gotos;
51 std::vector<const char *> breaks;
52 std::vector<const char *> continues;
54 /* A list of hashtables for each scope */
60 /* not to be used directly, we use the hash table */
61 ast_expression **_locals;
63 ast_value **_typedefs;
64 size_t *_blocktypedefs;
65 lex_ctx_t *_block_ctx;
67 /* we store the '=' operator info */
68 const oper_info *assign_op;
71 ast_value *const_vec[3];
76 /* collected information */
77 size_t max_param_count;
85 char *parser_strdup (const char *str);
86 ast_expression *parser_find_global(parser_t *parser, const char *name);
89 fold_t *fold_init (parser_t *);
90 void fold_cleanup (fold_t *);
91 ast_expression *fold_constgen_float (fold_t *, qcfloat_t, bool);
92 ast_expression *fold_constgen_vector(fold_t *, vec3_t);
93 ast_expression *fold_constgen_string(fold_t *, const char *, bool);
94 bool fold_generate (fold_t *, ir_builder *);
95 ast_expression *fold_op (fold_t *, const oper_info *, ast_expression **);
96 ast_expression *fold_intrin (fold_t *, const char *, ast_expression **);
98 ast_expression *fold_binary (lex_ctx_t ctx, int, ast_expression *, ast_expression *);
99 int fold_cond_ifthen (ir_value *, ast_function *, ast_ifthen *);
100 int fold_cond_ternary (ir_value *, ast_function *, ast_ternary *);