move my_id parameter [part 2 of 2]
[smatch.git] / parse.h
bloba2b9aa3fa6053d510db6247e5a6ac00b39f65548
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_DECLARATION,
17 STMT_EXPRESSION,
18 STMT_COMPOUND,
19 STMT_IF,
20 STMT_RETURN,
21 STMT_CASE,
22 STMT_SWITCH,
23 STMT_ITERATOR,
24 STMT_LABEL,
25 STMT_GOTO,
26 STMT_ASM,
27 STMT_CONTEXT,
28 STMT_RANGE,
31 struct statement {
32 enum statement_type type;
33 struct position pos;
34 union {
35 struct /* declaration */ {
36 struct symbol_list *declaration;
38 struct /* label_arg */ {
39 struct symbol *label;
40 struct statement *label_statement;
42 struct { /* __context__ */
43 struct expression *expression;
44 struct expression *context;
45 struct expression *required;
47 struct /* return_statement */ {
48 struct expression *ret_value;
49 struct symbol *ret_target;
51 struct /* if_statement */ {
52 struct expression *if_conditional;
53 struct statement *if_true;
54 struct statement *if_false;
56 struct /* compound_struct */ {
57 struct statement_list *stmts;
58 struct symbol *ret;
59 struct symbol *inline_fn;
60 struct statement *args;
62 struct /* labeled_struct */ {
63 struct symbol *label_identifier;
64 struct statement *label_statement;
66 struct /* case_struct */ {
67 struct expression *case_expression;
68 struct expression *case_to;
69 struct statement *case_statement;
70 struct symbol *case_label;
72 struct /* switch_struct */ {
73 struct expression *switch_expression;
74 struct statement *switch_statement;
75 struct symbol *switch_break, *switch_case;
77 struct /* iterator_struct */ {
78 struct symbol *iterator_break;
79 struct symbol *iterator_continue;
80 struct symbol_list *iterator_syms;
81 struct statement *iterator_pre_statement;
82 struct expression *iterator_pre_condition;
84 struct statement *iterator_statement;
86 struct statement *iterator_post_statement;
87 struct expression *iterator_post_condition;
89 struct /* goto_struct */ {
90 struct symbol *goto_label;
92 /* computed gotos have these: */
93 struct expression *goto_expression;
94 struct symbol_list *target_list;
96 struct /* goto_bb */ {
97 struct expression *bb_conditional;
98 struct symbol *bb_target;
100 struct /* multijmp */ {
101 struct expression *multi_from;
102 struct expression *multi_to;
103 struct symbol *multi_target;
105 struct /* asm */ {
106 struct expression *asm_string;
107 struct expression_list *asm_outputs;
108 struct expression_list *asm_inputs;
109 struct expression_list *asm_clobbers;
111 struct /* range */ {
112 struct expression *range_expression;
113 struct expression *range_low;
114 struct expression *range_high;
119 extern struct symbol_list *function_computed_target_list;
120 extern struct statement_list *function_computed_goto_list;
122 extern struct token *parse_expression(struct token *, struct expression **);
123 extern struct symbol *label_symbol(struct token *token);
125 extern int show_statement(struct statement *);
126 extern void show_statement_list(struct statement_list *, const char *);
127 extern int show_expression(struct expression *);
129 extern struct token *external_declaration(struct token *token, struct symbol_list **list);
131 extern struct symbol *ctype_integer(unsigned long spec);
132 extern struct symbol *ctype_fp(unsigned long spec);
134 extern void copy_statement(struct statement *src, struct statement *dst);
135 extern int inline_function(struct expression *expr, struct symbol *sym);
136 extern void uninline(struct symbol *sym);
137 extern void init_parser(int);
139 #endif /* PARSE_H */