{
int ret;
- ret = (int) (long) g_hash_table_lookup(s->types, id);
+ ret = GPOINTER_TO_INT(g_hash_table_lookup(s->types, id));
printf_debug("lookup %p %s %d\n", s, id, ret);
return ret;
}
return ast;
}
-int ctf_scanner_append_ast(struct ctf_scanner *scanner)
+int ctf_scanner_append_ast(struct ctf_scanner *scanner, FILE *input)
{
+ /* Start processing new stream */
+ yyrestart(input, scanner->scanner);
+ if (yydebug)
+ fprintf(stdout, "Scanner input is a%s.\n",
+ isatty(fileno(input)) ? "n interactive tty" :
+ " noninteractive file");
return yyparse(scanner, scanner->scanner);
}
-struct ctf_scanner *ctf_scanner_alloc(FILE *input)
+struct ctf_scanner *ctf_scanner_alloc(void)
{
struct ctf_scanner *scanner;
int ret;
if (!scanner)
return NULL;
memset(scanner, 0, sizeof(*scanner));
-
ret = yylex_init_extra(scanner, &scanner->scanner);
if (ret) {
printf_fatal("yylex_init error");
goto cleanup_scanner;
}
- /* Start processing new stream */
- yyrestart(input, scanner->scanner);
-
scanner->objstack = objstack_create();
if (!scanner->objstack)
goto cleanup_lexer;
init_scope(&scanner->root_scope, NULL);
scanner->cs = &scanner->root_scope;
- if (yydebug)
- fprintf(stdout, "Scanner input is a%s.\n",
- isatty(fileno(input)) ? "n interactive tty" :
- " noninteractive file");
-
return scanner;
cleanup_objstack:
{
int ret;
+ if (!scanner)
+ return;
finalize_scope(&scanner->root_scope);
objstack_destroy(scanner->objstack);
ret = yylex_destroy(scanner->scanner);
bt_list_splice(&($1)->tmp_head, &($$)->tmp_head);
bt_list_add_tail(&($$)->siblings, &($$)->tmp_head);
}
+ | postfix_expression DOT keywords
+ {
+ $$ = make_node(scanner, NODE_UNARY_EXPRESSION);
+ $$->u.unary_expression.type = UNARY_STRING;
+ $$->u.unary_expression.u.string = yylval.s;
+ $$->u.unary_expression.link = UNARY_DOTLINK;
+ bt_list_splice(&($1)->tmp_head, &($$)->tmp_head);
+ bt_list_add_tail(&($$)->siblings, &($$)->tmp_head);
+ }
| postfix_expression RARROW IDENTIFIER
{
$$ = make_node(scanner, NODE_UNARY_EXPRESSION);