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