Split "STMT_GOTO_BB" into "STMT_CONDTRUE" and "STMT_CONDFALSE".
[smatch.git] / parse.h
blob18a4bf9eb05a490498d75211b70f9a6b79cd8acf
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,
32 struct statement {
33 enum statement_type type;
34 struct position pos;
35 union {
36 struct /* label_arg */ {
37 struct symbol *label;
38 struct statement *label_statement;
40 struct expression *expression;
41 struct /* return_statement */ {
42 struct expression *ret_value;
43 struct symbol *ret_target;
45 struct /* if_statement */ {
46 struct expression *if_conditional;
47 struct statement *if_true;
48 struct statement *if_false;
50 struct /* compound_struct */ {
51 struct symbol_list *syms;
52 struct statement_list *stmts;
53 struct symbol *ret;
55 struct /* labeled_struct */ {
56 struct symbol *label_identifier;
57 struct statement *label_statement;
59 struct /* case_struct */ {
60 struct expression *case_expression;
61 struct expression *case_to;
62 struct statement *case_statement;
63 struct symbol *case_label;
65 struct /* switch_struct */ {
66 struct expression *switch_expression;
67 struct statement *switch_statement;
68 struct symbol *switch_break, *switch_case;
70 struct /* iterator_struct */ {
71 struct symbol *iterator_break;
72 struct symbol *iterator_continue;
73 struct symbol_list *iterator_syms;
74 struct statement *iterator_pre_statement;
75 struct expression *iterator_pre_condition;
77 struct statement *iterator_statement;
79 struct statement *iterator_post_statement;
80 struct expression *iterator_post_condition;
82 struct /* goto_struct */ {
83 struct symbol *goto_label;
84 struct expression *goto_expression;
86 struct /* goto_bb */ {
87 struct expression *bb_conditional;
88 struct symbol *bb_target;
93 extern struct token *parse_expression(struct token *, struct expression **);
94 extern struct token *statement_list(struct token *, struct statement_list **);
95 extern struct symbol *label_symbol(struct token *token);
97 extern int show_statement(struct statement *);
98 extern void show_statement_list(struct statement_list *, const char *);
99 extern int show_expression(struct expression *);
100 extern void translation_unit(struct token *, struct symbol_list **);
102 extern struct symbol *ctype_integer(unsigned int spec);
103 extern struct symbol *ctype_fp(unsigned int spec);
105 extern int match_string_ident(struct ident *, const char *);
106 extern void copy_statement(struct statement *src, struct statement *dst);
107 extern int inline_function(struct expression *expr, struct symbol *sym);
109 #endif /* PARSE_H */