Debian Codegraph @

src/fcml_parser_utils.h

raw
1 /*
2 * FCML - Free Code Manipulation Library.
3 * Copyright (C) 2010-2020 Slawomir Wojtasiak
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #ifndef FCML_PUTILS_H_
21 #define FCML_PUTILS_H_
22
23 #include <fcml_common.h>
24
25 #include "fcml_env_int.h"
26 #include "fcml_apc_ast.h"
27 #include "fcml_ceh.h"
28 #include "fcml_coll.h"
29
30 /** Override default memory allocation function used by bison parser */
31 #define YYMALLOC fcml_fn_env_memory_alloc
32
33 /** Override default memory deallocation function used by bison parser */
34 #define YYFREE fcml_fn_env_memory_free
35
36 typedef struct fcml_st_parser_data {
37 /* Lexer context. */
38 void *scannerInfo;
39 /* Instruction pointer used to declare symbols. */
40 fcml_ip ip;
41 /* Defined symbol. */
42 fcml_st_symbol *symbol;
43 /* Abstract syntax tree of parsed isntruction. */
44 fcml_st_ast_node *tree;
45 /* All potential errors going here. */
46 fcml_st_ceh_error_container errors;
47 } fcml_st_parser_data;
48
49 void fcml_fn_pu_parse_integer(const fcml_char *str,
50 fcml_st_ast_val_integer *integer_value, int base);
51
52 void fcml_fn_pu_parse_float(const fcml_char *str,
53 fcml_st_ast_val_float *float_value);
54
55 void fcml_fn_pu_parse_register(fcml_en_register type, fcml_usize size,
56 fcml_uint8_t num, fcml_bool x64_exp, fcml_st_register *reg_dest);
57
58 fcml_char* fcml_fn_pu_reg_type_to_string(fcml_en_register type);
59
60 #endif /* FCML_PUTILS_H_ */