| 1 | #ifndef _CTF_SCANNER_H |
| 2 | #define _CTF_SCANNER_H |
| 3 | |
| 4 | #include <stdio.h> |
| 5 | #include "ctf-ast.h" |
| 6 | |
| 7 | #ifndef YY_TYPEDEF_YY_SCANNER_T |
| 8 | #define YY_TYPEDEF_YY_SCANNER_T |
| 9 | typedef void* yyscan_t; |
| 10 | #endif |
| 11 | |
| 12 | struct ctf_scanner_scope; |
| 13 | struct ctf_scanner_scope { |
| 14 | struct ctf_scanner_scope *parent; |
| 15 | GHashTable *types; |
| 16 | }; |
| 17 | |
| 18 | struct ctf_scanner { |
| 19 | yyscan_t scanner; |
| 20 | struct ctf_ast *ast; |
| 21 | struct ctf_scanner_scope root_scope; |
| 22 | struct ctf_scanner_scope *cs; |
| 23 | struct cds_list_head allocated_strings; |
| 24 | }; |
| 25 | |
| 26 | struct ctf_scanner *ctf_scanner_alloc(FILE *input); |
| 27 | void ctf_scanner_free(struct ctf_scanner *scanner); |
| 28 | int ctf_scanner_append_ast(struct ctf_scanner *scanner); |
| 29 | |
| 30 | static inline |
| 31 | struct ctf_ast *ctf_scanner_get_ast(struct ctf_scanner *scanner) |
| 32 | { |
| 33 | return scanner->ast; |
| 34 | } |
| 35 | |
| 36 | int is_type(struct ctf_scanner *scanner, const char *id); |
| 37 | |
| 38 | #endif /* _CTF_SCANNER_H */ |