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 | |
087cd0f5 | 12 | #include "ast.hpp" |
e98a2d6e PP |
13 | |
14 | #ifndef YY_TYPEDEF_YY_SCANNER_T | |
4164020e SM |
15 | # define YY_TYPEDEF_YY_SCANNER_T |
16 | typedef void *yyscan_t; | |
e98a2d6e PP |
17 | #endif |
18 | ||
19 | struct ctf_scanner_scope; | |
4164020e SM |
20 | struct ctf_scanner_scope |
21 | { | |
22 | struct ctf_scanner_scope *parent; | |
23 | GHashTable *classes; | |
e98a2d6e PP |
24 | }; |
25 | ||
4164020e SM |
26 | struct ctf_scanner |
27 | { | |
0f5c5d5c SM |
28 | explicit ctf_scanner(const bt2c::Logger& parentLogger) : |
29 | logger {parentLogger, "PLUGIN/CTF/META/PARSER"} | |
30 | { | |
31 | } | |
32 | ||
33 | bt2c::Logger logger; | |
34 | yyscan_t scanner {}; | |
35 | ctf_ast *ast = nullptr; | |
36 | ctf_scanner_scope root_scope {}; | |
37 | ctf_scanner_scope *cs = nullptr; | |
38 | struct objstack *objstack = nullptr; | |
e98a2d6e PP |
39 | }; |
40 | ||
0f5c5d5c | 41 | struct ctf_scanner *ctf_scanner_alloc(const bt2c::Logger& parentLogger); |
d07cfd1a | 42 | |
e98a2d6e | 43 | void ctf_scanner_free(struct ctf_scanner *scanner); |
d07cfd1a | 44 | |
e98a2d6e PP |
45 | int ctf_scanner_append_ast(struct ctf_scanner *scanner, FILE *input); |
46 | ||
4164020e | 47 | static inline struct ctf_ast *ctf_scanner_get_ast(struct ctf_scanner *scanner) |
e98a2d6e | 48 | { |
4164020e | 49 | return scanner->ast; |
e98a2d6e PP |
50 | } |
51 | ||
e98a2d6e PP |
52 | int is_type(struct ctf_scanner *scanner, const char *id); |
53 | ||
54 | #endif /* _CTF_SCANNER_H */ |