Commit | Line | Data |
---|---|---|
e98a2d6e | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
e98a2d6e | 3 | * |
0235b0db | 4 | * Copyright 2011-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
e98a2d6e PP |
5 | */ |
6 | ||
0235b0db MJ |
7 | #ifndef _CTF_SCANNER_H |
8 | #define _CTF_SCANNER_H | |
9 | ||
e98a2d6e | 10 | #include <stdio.h> |
c802cacb | 11 | |
91d81473 | 12 | #include "common/macros.h" |
c802cacb | 13 | |
087cd0f5 | 14 | #include "ast.hpp" |
e98a2d6e PP |
15 | |
16 | #ifndef YY_TYPEDEF_YY_SCANNER_T | |
4164020e SM |
17 | # define YY_TYPEDEF_YY_SCANNER_T |
18 | typedef void *yyscan_t; | |
e98a2d6e PP |
19 | #endif |
20 | ||
21 | struct ctf_scanner_scope; | |
4164020e SM |
22 | struct ctf_scanner_scope |
23 | { | |
24 | struct ctf_scanner_scope *parent; | |
25 | GHashTable *classes; | |
e98a2d6e PP |
26 | }; |
27 | ||
4164020e SM |
28 | struct ctf_scanner |
29 | { | |
30 | yyscan_t scanner; | |
31 | struct ctf_ast *ast; | |
32 | struct ctf_scanner_scope root_scope; | |
33 | struct ctf_scanner_scope *cs; | |
34 | struct objstack *objstack; | |
e98a2d6e PP |
35 | }; |
36 | ||
37 | struct ctf_scanner *ctf_scanner_alloc(void); | |
d07cfd1a | 38 | |
e98a2d6e | 39 | void ctf_scanner_free(struct ctf_scanner *scanner); |
d07cfd1a | 40 | |
e98a2d6e PP |
41 | int ctf_scanner_append_ast(struct ctf_scanner *scanner, FILE *input); |
42 | ||
4164020e | 43 | static inline struct ctf_ast *ctf_scanner_get_ast(struct ctf_scanner *scanner) |
e98a2d6e | 44 | { |
4164020e | 45 | return scanner->ast; |
e98a2d6e PP |
46 | } |
47 | ||
e98a2d6e PP |
48 | int is_type(struct ctf_scanner *scanner, const char *id); |
49 | ||
50 | #endif /* _CTF_SCANNER_H */ |