Oops. The argument symbol initializers got lost on inlining,
[smatch.git] / parse.h
blobbe4106f12a27ea3247b5add48a27ea973c73cbe2
1 #ifndef PARSE_H
2 #define PARSE_H
3 /*
4 * Basic parsing data structures. Statements and symbols.
6 * Copyright (C) 2003 Transmeta Corp.
8 * Licensed under the Open Software License version 1.1
9 */
11 #include "symbol.h"
13 enum statement_type {
14 STMT_NONE,
15 STMT_EXPRESSION,
16 STMT_COMPOUND,
17 STMT_IF,
18 STMT_RETURN,
19 STMT_CASE,
20 STMT_SWITCH,
21 STMT_ITERATOR,
22 STMT_LABEL,
23 STMT_GOTO,
24 STMT_ASM,
27 struct statement {
28 enum statement_type type;
29 struct position pos;
30 union {
31 struct /* label_arg */ {
32 struct symbol *label;
33 struct statement *label_statement;
35 struct expression *expression;
36 struct /* return_statement */ {
37 struct expression *ret_value;
38 struct symbol *ret_target;
40 struct /* if_statement */ {
41 struct expression *if_conditional;
42 struct statement *if_true;
43 struct statement *if_false;
45 struct /* compound_struct */ {
46 struct symbol_list *syms;
47 struct statement_list *stmts;
48 struct symbol *ret;
50 struct /* labeled_struct */ {
51 struct symbol *label_identifier;
52 struct statement *label_statement;
54 struct /* case_struct */ {
55 struct expression *case_expression;
56 struct expression *case_to;
57 struct statement *case_statement;
58 struct symbol *case_label;
60 struct /* switch_struct */ {
61 struct expression *switch_expression;
62 struct statement *switch_statement;
63 struct symbol *switch_break, *switch_case;
65 struct /* iterator_struct */ {
66 struct symbol *iterator_break;
67 struct symbol *iterator_continue;
68 struct symbol_list *iterator_syms;
69 struct statement *iterator_pre_statement;
70 struct expression *iterator_pre_condition;
72 struct statement *iterator_statement;
74 struct statement *iterator_post_statement;
75 struct expression *iterator_post_condition;
77 struct /* goto_struct */ {
78 struct symbol *goto_label;
79 struct expression *goto_expression;
84 extern struct token *parse_expression(struct token *, struct expression **);
85 extern struct token *statement_list(struct token *, struct statement_list **);
86 extern struct symbol *label_symbol(struct token *token);
88 extern int show_statement(struct statement *);
89 extern void show_statement_list(struct statement_list *, const char *);
90 extern int show_expression(struct expression *);
91 extern void translation_unit(struct token *, struct symbol_list **);
93 extern struct symbol *ctype_integer(unsigned int spec);
94 extern struct symbol *ctype_fp(unsigned int spec);
96 extern int match_string_ident(struct ident *, const char *);
97 extern void copy_statement(struct statement *src, struct statement *dst);
98 extern int inline_function(struct expression *expr, struct symbol *sym);
100 #endif /* PARSE_H */