Fix dependencies
[smatch.git] / parse.h
blob386c785508aabaa20ceb2906fa9166287dbd881b
1 #ifndef PARSE_H
2 #define PARSE_H
3 /*
4 * Basic parsing data structures. Statements and symbols.
6 * Copyright (C) 2003 Transmeta Corp.
7 * 2003 Linus Torvalds
9 * Licensed under the Open Software License version 1.1
12 #include "symbol.h"
14 enum statement_type {
15 STMT_NONE,
16 STMT_EXPRESSION,
17 STMT_COMPOUND,
18 STMT_IF,
19 STMT_RETURN,
20 STMT_CASE,
21 STMT_SWITCH,
22 STMT_ITERATOR,
23 STMT_LABEL,
24 STMT_GOTO,
25 STMT_ASM,
27 /* These only show up after linearization */
28 STMT_CONDTRUE,
29 STMT_CONDFALSE,
30 STMT_MULTIVALUE,
31 STMT_MULTIJMP,
34 struct statement {
35 enum statement_type type;
36 struct position pos;
37 union {
38 struct /* label_arg */ {
39 struct symbol *label;
40 struct statement *label_statement;
42 struct expression *expression;
43 struct /* return_statement */ {
44 struct expression *ret_value;
45 struct symbol *ret_target;
47 struct /* if_statement */ {
48 struct expression *if_conditional;
49 struct statement *if_true;
50 struct statement *if_false;
52 struct /* compound_struct */ {
53 struct symbol_list *syms;
54 struct statement_list *stmts;
55 struct symbol *ret;
57 struct /* labeled_struct */ {
58 struct symbol *label_identifier;
59 struct statement *label_statement;
61 struct /* case_struct */ {
62 struct expression *case_expression;
63 struct expression *case_to;
64 struct statement *case_statement;
65 struct symbol *case_label;
67 struct /* switch_struct */ {
68 struct expression *switch_expression;
69 struct statement *switch_statement;
70 struct symbol *switch_break, *switch_case;
72 struct /* iterator_struct */ {
73 struct symbol *iterator_break;
74 struct symbol *iterator_continue;
75 struct symbol_list *iterator_syms;
76 struct statement *iterator_pre_statement;
77 struct expression *iterator_pre_condition;
79 struct statement *iterator_statement;
81 struct statement *iterator_post_statement;
82 struct expression *iterator_post_condition;
84 struct /* goto_struct */ {
85 struct symbol *goto_label;
86 struct expression *goto_expression;
88 struct /* goto_bb */ {
89 struct expression *bb_conditional;
90 struct symbol *bb_target;
92 struct /* multijmp */ {
93 struct expression *multi_from;
94 struct expression *multi_to;
95 struct symbol *multi_target;
100 extern struct token *parse_expression(struct token *, struct expression **);
101 extern struct token *statement_list(struct token *, struct statement_list **);
102 extern struct symbol *label_symbol(struct token *token);
104 extern int show_statement(struct statement *);
105 extern void show_statement_list(struct statement_list *, const char *);
106 extern int show_expression(struct expression *);
107 extern void translation_unit(struct token *, struct symbol_list **);
109 extern struct symbol *ctype_integer(unsigned int spec);
110 extern struct symbol *ctype_fp(unsigned int spec);
112 extern int match_string_ident(struct ident *, const char *);
113 extern void copy_statement(struct statement *src, struct statement *dst);
114 extern int inline_function(struct expression *expr, struct symbol *sym);
116 #endif /* PARSE_H */